Nix: makeover

This commit is contained in:
Mihai Fufezan 2024-07-18 20:58:37 +03:00
parent 45032489e2
commit c36676ad0c
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg
3 changed files with 84 additions and 33 deletions

View file

@ -1,12 +1,35 @@
{ {
"nodes": { "nodes": {
"hyprutils": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1721324102,
"narHash": "sha256-WAZ0X6yJW1hFG6otkHBfyJDKRpNP5stsRqdEuHrFRpk=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "962582a090bc233c4de9d9897f46794280288989",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprutils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1683014792, "lastModified": 1721138476,
"narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=", "narHash": "sha256-+W5eZOhhemLQxelojLxETfbFbc19NWawsXBlapYpqIA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42", "rev": "ad0b5eed1b6031efaed382844806550c3dcb4206",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -18,7 +41,24 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs" "hyprutils": "hyprutils",
"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,20 +1,30 @@
{ {
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";
hyprutils = {
url = "github:hyprwm/hyprutils";
inputs.nixpkgs.follows = "nixpkgs";
inputs.systems.follows = "systems";
};
};
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
systems,
... ...
}: let } @ inputs: 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)
@ -22,26 +32,25 @@
]); ]);
version = lib.removeSuffix "\n" (builtins.readFile ./VERSION); version = lib.removeSuffix "\n" (builtins.readFile ./VERSION);
in { in {
overlays.default = _: prev: rec { overlays = {
hyprpicker = prev.callPackage ./nix/default.nix { default = self.overlays.hyprpicker;
stdenv = prev.gcc12Stdenv; hyprpicker = lib.composeManyExtensions [
version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); inputs.hyprutils.overlays.default
wayland-protocols = prev.wayland-protocols.overrideAttrs (self: super: { (final: prev: {
version = "1.34"; hyprpicker = prev.callPackage ./nix/default.nix {
src = prev.fetchurl { stdenv = prev.gcc13Stdenv;
url = "https://gitlab.freedesktop.org/wayland/${self.pname}/-/releases/${self.version}/downloads/${self.pname}-${self.version}.tar.xz"; version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
hash = "sha256-xZsnys2F9guvTuX4DfXA0Vdg6taiQysAq34uBXTcr+s=";
}; };
}); hyprpicker-debug = final.hyprpicker.override {debug = true;};
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);
}; };
} }

View file

@ -5,6 +5,7 @@
cmake, cmake,
cairo, cairo,
fribidi, fribidi,
hyprutils,
libdatrie, libdatrie,
libGL, libGL,
libjpeg, libjpeg,
@ -19,7 +20,7 @@
wayland, wayland,
wayland-protocols, wayland-protocols,
wayland-scanner, wayland-scanner,
libXdmcp, xorg,
debug ? false, debug ? false,
version ? "git", version ? "git",
}: }:
@ -42,21 +43,22 @@ stdenv.mkDerivation {
buildInputs = [ buildInputs = [
cairo cairo
fribidi fribidi
hyprutils
libdatrie libdatrie
libGL libGL
libjpeg libjpeg
libselinux libselinux
libsepol libsepol
libthai libthai
libxkbcommon
pango pango
pcre pcre
pcre2 pcre2
utillinux
wayland wayland
wayland-protocols wayland-protocols
wayland-scanner wayland-scanner
libXdmcp xorg.libXdmcp
libxkbcommon
utillinux
]; ];
outputs = [ outputs = [