mirror of
https://github.com/hyprwm/hyprland-protocols.git
synced 2024-11-21 20:55:58 +01:00
Nix: corrections for overlays, overrideable system (#6)
* flake: change formatter to use legacyPackages * flake: add overlay with explicit name * flake: make systems overrideable * flake: inherit packages from pkgsFor
This commit is contained in:
parent
8c279b9fb0
commit
0c2ce70625
2 changed files with 37 additions and 15 deletions
18
flake.lock
18
flake.lock
|
@ -18,7 +18,23 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
34
flake.nix
34
flake.nix
|
@ -1,22 +1,24 @@
|
|||
{
|
||||
description = "Hyprland Protocols";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
# <https://github.com/nix-systems/nix-systems>
|
||||
systems.url = "github:nix-systems/default-linux";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
systems,
|
||||
...
|
||||
}: let
|
||||
inherit (nixpkgs) lib;
|
||||
genSystems = lib.genAttrs [
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
];
|
||||
pkgsFor = genSystems (system:
|
||||
eachSystem = lib.genAttrs (import systems);
|
||||
pkgsFor = eachSystem (system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [self.overlays.default];
|
||||
localSystem = system;
|
||||
overlays = [self.overlays.hyprland-protocols];
|
||||
});
|
||||
mkDate = longDate: (lib.concatStringsSep "-" [
|
||||
(builtins.substring 0 4 longDate)
|
||||
|
@ -25,14 +27,18 @@
|
|||
]);
|
||||
version = "0.1" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
||||
in {
|
||||
overlays.default = final: prev: {
|
||||
hyprland-protocols = final.callPackage ./nix/default.nix {inherit version;};
|
||||
overlays = {
|
||||
hyprland-protocols = final: prev: {
|
||||
hyprland-protocols = final.callPackage ./nix/default.nix {inherit version;};
|
||||
};
|
||||
default = self.overlays.hyprland-protocols;
|
||||
};
|
||||
|
||||
packages = genSystems (system:
|
||||
(self.overlays.default pkgsFor.${system} pkgsFor.${system})
|
||||
// {default = self.packages.${system}.hyprland-protocols;});
|
||||
packages = eachSystem (system: {
|
||||
inherit (pkgsFor.${system}) hyprland-protocols;
|
||||
default = self.packages.${system}.hyprland-protocols;
|
||||
});
|
||||
|
||||
formatter = genSystems (system: pkgsFor.${system}.alejandra);
|
||||
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.alejandra);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue