refactor(nix): use flake-utils

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2023-03-14 10:50:07 +01:00
parent 9dff1bac83
commit 950f921c09
No known key found for this signature in database
GPG Key ID: E13DFD4B47127951
2 changed files with 38 additions and 17 deletions

16
flake.lock generated
View File

@ -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"
}

View File

@ -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;
});
}