mirror of
https://github.com/hyprwm/hyprland-protocols.git
synced 2024-11-22 13:15:59 +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": {
|
"root": {
|
||||||
"inputs": {
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
32
flake.nix
32
flake.nix
|
@ -1,22 +1,24 @@
|
||||||
{
|
{
|
||||||
description = "Hyprland Protocols";
|
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 = {
|
outputs = {
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
|
systems,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
genSystems = lib.genAttrs [
|
eachSystem = lib.genAttrs (import systems);
|
||||||
"aarch64-linux"
|
pkgsFor = eachSystem (system:
|
||||||
"x86_64-linux"
|
|
||||||
];
|
|
||||||
pkgsFor = genSystems (system:
|
|
||||||
import nixpkgs {
|
import nixpkgs {
|
||||||
inherit system;
|
localSystem = system;
|
||||||
overlays = [self.overlays.default];
|
overlays = [self.overlays.hyprland-protocols];
|
||||||
});
|
});
|
||||||
mkDate = longDate: (lib.concatStringsSep "-" [
|
mkDate = longDate: (lib.concatStringsSep "-" [
|
||||||
(builtins.substring 0 4 longDate)
|
(builtins.substring 0 4 longDate)
|
||||||
|
@ -25,14 +27,18 @@
|
||||||
]);
|
]);
|
||||||
version = "0.1" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
version = "0.1" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
||||||
in {
|
in {
|
||||||
overlays.default = final: prev: {
|
overlays = {
|
||||||
|
hyprland-protocols = final: prev: {
|
||||||
hyprland-protocols = final.callPackage ./nix/default.nix {inherit version;};
|
hyprland-protocols = final.callPackage ./nix/default.nix {inherit version;};
|
||||||
};
|
};
|
||||||
|
default = self.overlays.hyprland-protocols;
|
||||||
|
};
|
||||||
|
|
||||||
packages = genSystems (system:
|
packages = eachSystem (system: {
|
||||||
(self.overlays.default pkgsFor.${system} pkgsFor.${system})
|
inherit (pkgsFor.${system}) hyprland-protocols;
|
||||||
// {default = self.packages.${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