aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-03-14 10:50:07 +0100
committerSefa Eyeoglu <contact@scrumplex.net>2023-03-14 10:50:07 +0100
commit950f921c09930076a19621bea9730cc866c3c482 (patch)
treefdeacba74392c32792795b529c30b6f674c2b0f6
parent9dff1bac838b5a827b1e323bdc983b0f7d1e61bd (diff)
downloadPrismLauncher-950f921c09930076a19621bea9730cc866c3c482.tar.gz
PrismLauncher-950f921c09930076a19621bea9730cc866c3c482.tar.bz2
PrismLauncher-950f921c09930076a19621bea9730cc866c3c482.zip
refactor(nix): use flake-utils
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
-rw-r--r--flake.lock16
-rw-r--r--flake.nix39
2 files changed, 38 insertions, 17 deletions
diff --git a/flake.lock b/flake.lock
index 051e1664..a0f503cd 100644
--- a/flake.lock
+++ b/flake.lock
@@ -16,6 +16,21 @@
"type": "github"
}
},
+ "flake-utils": {
+ "locked": {
+ "lastModified": 1676283394,
+ "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
"libnbtplusplus": {
"flake": false,
"locked": {
@@ -51,6 +66,7 @@
"root": {
"inputs": {
"flake-compat": "flake-compat",
+ "flake-utils": "flake-utils",
"libnbtplusplus": "libnbtplusplus",
"nixpkgs": "nixpkgs"
}
diff --git a/flake.nix b/flake.nix
index f173511c..f476fdf9 100644
--- a/flake.nix
+++ b/flake.nix
@@ -3,6 +3,7 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
@@ -16,6 +17,7 @@
outputs = {
self,
nixpkgs,
+ flake-utils,
libnbtplusplus,
...
}: let
@@ -23,26 +25,29 @@
version = builtins.substring 0 8 self.lastModifiedDate;
# Supported systems (qtbase is currently broken for "aarch64-darwin")
- supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux"];
-
- # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
- forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
-
- # Nixpkgs instantiated for supported systems.
- pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
+ supportedSystems = with flake-utils.lib.system; [
+ x86_64-linux
+ x86_64-darwin
+ aarch64-linux
+ ];
packagesFn = pkgs: rec {
- prismlauncher-qt5 = pkgs.libsForQt5.callPackage ./nix {inherit version self libnbtplusplus;};
- prismlauncher = pkgs.qt6Packages.callPackage ./nix {inherit version self libnbtplusplus;};
+ prismlauncher-qt5 = pkgs.libsForQt5.callPackage ./nix {
+ inherit version self libnbtplusplus;
+ };
+ prismlauncher = pkgs.qt6Packages.callPackage ./nix {
+ inherit version self libnbtplusplus;
+ };
};
- in {
- packages = forAllSystems (
- system: let
- packages = packagesFn pkgs.${system};
+ in
+ flake-utils.lib.eachSystem supportedSystems (system: let
+ pkgs = nixpkgs.legacyPackages.${system};
+ in {
+ packages = let
+ packages = packagesFn pkgs;
in
- packages // {default = packages.prismlauncher;}
- );
+ packages // {default = packages.prismlauncher;};
- overlay = final: packagesFn;
- };
+ overlay = final: packagesFn;
+ });
}