Nix: overhaul flake

This commit is contained in:
Mihai Fufezan 2024-03-24 14:38:34 +02:00
parent 518adcaf90
commit ef2ab4ae27
No known key found for this signature in database
2 changed files with 72 additions and 32 deletions

View file

@ -2,14 +2,15 @@
"nodes": {
"hyprlang": {
"inputs": {
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"systems": "systems"
},
"locked": {
"lastModified": 1704230242,
"narHash": "sha256-S8DM+frECqmAdaUb3y5n3RjY73ajZcL5rnmx5YO+CkY=",
"lastModified": 1711250455,
"narHash": "sha256-LSq1ZsTpeD7xsqvlsepDEelWRDtAhqwetp6PusHXJRo=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "db5e1399b90d5a339330bdd49c5bca6fe58d6f60",
"rev": "b3e430f81f3364c5dd1a3cc9995706a4799eb3fa",
"type": "github"
},
"original": {
@ -20,11 +21,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1702645756,
"narHash": "sha256-qKI6OR3TYJYQB3Q8mAZ+DG4o/BR9ptcv9UnRV2hzljc=",
"owner": "nixos",
"lastModified": 1708475490,
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "40c3c94c241286dd2243ea34d3aef8a488f9e4d0",
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
"type": "github"
},
"original": {
@ -36,11 +37,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1703637592,
"narHash": "sha256-8MXjxU0RfFfzl57Zy3OfXCITS0qWDNLzlBAdwxGZwfY=",
"lastModified": 1711163522,
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "cfc3698c31b1fb9cdcf10f36c9643460264d0ca8",
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github"
},
"original": {
@ -53,7 +54,38 @@
"root": {
"inputs": {
"hyprlang": "hyprlang",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs_2",
"systems": "systems_2"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
}
},

View file

@ -5,45 +5,53 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
hyprlang.url = "github:hyprwm/hyprlang";
systems.url = "github:nix-systems/default-linux";
};
outputs = {
self,
nixpkgs,
systems,
...
} @ inputs: let
inherit (nixpkgs) lib;
genSystems = lib.genAttrs [
# Add more systems if they are supported
"x86_64-linux"
"aarch64-linux"
];
pkgsFor = nixpkgs.legacyPackages;
eachSystem = lib.genAttrs (import systems);
pkgsFor = eachSystem (system:
import nixpkgs {
localSystem.system = system;
overlays = with self.overlays; [hyprpaper];
});
mkDate = longDate: (lib.concatStringsSep "-" [
(__substring 0 4 longDate)
(__substring 4 2 longDate)
(__substring 6 2 longDate)
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in {
overlays.default = _: prev: rec {
hyprpaper = prev.callPackage ./nix/default.nix {
stdenv = prev.gcc13Stdenv;
overlays = {
default = self.overlays.hyprpaper;
hyprpaper = final: prev: rec {
hyprpaper = final.callPackage ./nix/default.nix {
stdenv = final.gcc13Stdenv;
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
inherit (prev.xorg) libXdmcp;
inherit (inputs.hyprlang.packages.${prev.system}) hyprlang;
inherit (final.xorg) libXdmcp;
inherit (inputs.hyprlang.packages.${final.system}) hyprlang;
};
hyprpaper-debug = hyprpaper.override {debug = true;};
};
};
packages = genSystems (system:
(self.overlays.default null pkgsFor.${system})
// {default = self.packages.${system}.hyprpaper;});
packages = eachSystem (system: {
default = self.packages.${system}.hyprpaper;
inherit (pkgsFor.${system}) hyprpaper hyprpaper-debug;
});
homeManagerModules = {
default = self.homeManagerModules.hyprpaper;
hyprpaper = import ./nix/hm-module.nix self;
};
formatter = genSystems (system: pkgsFor.${system}.alejandra);
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
};
}