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": { "nodes": {
"hyprlang": { "hyprlang": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1704230242, "lastModified": 1711250455,
"narHash": "sha256-S8DM+frECqmAdaUb3y5n3RjY73ajZcL5rnmx5YO+CkY=", "narHash": "sha256-LSq1ZsTpeD7xsqvlsepDEelWRDtAhqwetp6PusHXJRo=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprlang", "repo": "hyprlang",
"rev": "db5e1399b90d5a339330bdd49c5bca6fe58d6f60", "rev": "b3e430f81f3364c5dd1a3cc9995706a4799eb3fa",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,11 +21,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1702645756, "lastModified": 1708475490,
"narHash": "sha256-qKI6OR3TYJYQB3Q8mAZ+DG4o/BR9ptcv9UnRV2hzljc=", "narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
"owner": "nixos", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "40c3c94c241286dd2243ea34d3aef8a488f9e4d0", "rev": "0e74ca98a74bc7270d28838369593635a5db3260",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -36,11 +37,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1703637592, "lastModified": 1711163522,
"narHash": "sha256-8MXjxU0RfFfzl57Zy3OfXCITS0qWDNLzlBAdwxGZwfY=", "narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "cfc3698c31b1fb9cdcf10f36c9643460264d0ca8", "rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -53,7 +54,38 @@
"root": { "root": {
"inputs": { "inputs": {
"hyprlang": "hyprlang", "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"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
hyprlang.url = "github:hyprwm/hyprlang"; hyprlang.url = "github:hyprwm/hyprlang";
systems.url = "github:nix-systems/default-linux";
}; };
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
systems,
... ...
} @ inputs: let } @ inputs: let
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
genSystems = lib.genAttrs [ eachSystem = lib.genAttrs (import systems);
# Add more systems if they are supported
"x86_64-linux" pkgsFor = eachSystem (system:
"aarch64-linux" import nixpkgs {
]; localSystem.system = system;
pkgsFor = nixpkgs.legacyPackages; overlays = with self.overlays; [hyprpaper];
});
mkDate = longDate: (lib.concatStringsSep "-" [ mkDate = longDate: (lib.concatStringsSep "-" [
(__substring 0 4 longDate) (builtins.substring 0 4 longDate)
(__substring 4 2 longDate) (builtins.substring 4 2 longDate)
(__substring 6 2 longDate) (builtins.substring 6 2 longDate)
]); ]);
in { in {
overlays.default = _: prev: rec { overlays = {
hyprpaper = prev.callPackage ./nix/default.nix { default = self.overlays.hyprpaper;
stdenv = prev.gcc13Stdenv; hyprpaper = final: prev: rec {
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); hyprpaper = final.callPackage ./nix/default.nix {
inherit (prev.xorg) libXdmcp; stdenv = final.gcc13Stdenv;
inherit (inputs.hyprlang.packages.${prev.system}) hyprlang; version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
inherit (final.xorg) libXdmcp;
inherit (inputs.hyprlang.packages.${final.system}) hyprlang;
};
hyprpaper-debug = hyprpaper.override {debug = true;};
}; };
hyprpaper-debug = hyprpaper.override {debug = true;};
}; };
packages = genSystems (system: packages = eachSystem (system: {
(self.overlays.default null pkgsFor.${system}) default = self.packages.${system}.hyprpaper;
// {default = self.packages.${system}.hyprpaper;}); inherit (pkgsFor.${system}) hyprpaper hyprpaper-debug;
});
homeManagerModules = { homeManagerModules = {
default = self.homeManagerModules.hyprpaper; default = self.homeManagerModules.hyprpaper;
hyprpaper = import ./nix/hm-module.nix self; hyprpaper = import ./nix/hm-module.nix self;
}; };
formatter = genSystems (system: pkgsFor.${system}.alejandra); formatter = eachSystem (system: pkgsFor.${system}.alejandra);
}; };
} }