Nix: overhaul flake

This commit is contained in:
Mihai Fufezan 2024-03-24 14:30:05 +02:00
parent 0eb49192a5
commit d5b9c7e18b
No known key found for this signature in database
2 changed files with 50 additions and 21 deletions

View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1683014792, "lastModified": 1711163522,
"narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=", "narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42", "rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -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"
} }
} }
}, },

View file

@ -1,30 +1,44 @@
{ {
description = "Hyprpicker - a wlroots-compatible Wayland color picker that does not suck"; description = "Hyprpicker - a wlroots-compatible Wayland color picker that does not suck";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
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);
# Add more systems if they are supported pkgsFor = eachSystem (system:
"aarch64-linux" import nixpkgs {
"x86_64-linux" localSystem.system = system;
]; overlays = with self.overlays; [hyprpicker];
pkgsFor = nixpkgs.legacyPackages; });
mkDate = longDate: (lib.concatStringsSep "-" [ mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate) (builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate) (builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate) (builtins.substring 6 2 longDate)
]); ]);
in { in {
overlays.default = _: prev: rec { overlays = {
hyprpicker = prev.callPackage ./nix/default.nix { default = self.overlays.hyprpicker;
stdenv = prev.gcc12Stdenv; hyprpicker = lib.composeManyExtensions [
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); self.overlays.overrides
(final: prev: rec {
hyprpicker = 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;
};
hyprpicker-debug = hyprpicker.override {debug = true;};
})
];
overrides = final: prev: {
wayland-protocols = prev.wayland-protocols.overrideAttrs (self: super: { wayland-protocols = prev.wayland-protocols.overrideAttrs (self: super: {
version = "1.34"; version = "1.34";
src = prev.fetchurl { src = prev.fetchurl {
@ -32,15 +46,14 @@
hash = "sha256-xZsnys2F9guvTuX4DfXA0Vdg6taiQysAq34uBXTcr+s="; hash = "sha256-xZsnys2F9guvTuX4DfXA0Vdg6taiQysAq34uBXTcr+s=";
}; };
}); });
inherit (prev.xorg) libXdmcp;
}; };
hyprpicker-debug = hyprpicker.override {debug = true;};
}; };
packages = genSystems (system: packages = eachSystem (system: {
(self.overlays.default null pkgsFor.${system}) default = self.packages.${system}.hyprpicker;
// {default = self.packages.${system}.hyprpicker;}); inherit (pkgsFor.${system}) hyprpicker hyprpicker-debug;
});
formatter = genSystems (system: pkgsFor.${system}.alejandra); formatter = eachSystem (system: pkgsFor.${system}.alejandra);
}; };
} }