diff --git a/flake.lock b/flake.lock index 6567c73..5abff22 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,35 @@ { "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": { "locked": { - "lastModified": 1683014792, - "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=", + "lastModified": 1721138476, + "narHash": "sha256-+W5eZOhhemLQxelojLxETfbFbc19NWawsXBlapYpqIA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42", + "rev": "ad0b5eed1b6031efaed382844806550c3dcb4206", "type": "github" }, "original": { @@ -18,7 +41,24 @@ }, "root": { "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" } } }, diff --git a/flake.nix b/flake.nix index 54d781c..a246760 100644 --- a/flake.nix +++ b/flake.nix @@ -1,20 +1,30 @@ { 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 = { self, nixpkgs, + systems, ... - }: let + } @ inputs: let inherit (nixpkgs) lib; - genSystems = lib.genAttrs [ - # Add more systems if they are supported - "aarch64-linux" - "x86_64-linux" - ]; - pkgsFor = nixpkgs.legacyPackages; + eachSystem = lib.genAttrs (import systems); + pkgsFor = eachSystem (system: + import nixpkgs { + localSystem.system = system; + overlays = with self.overlays; [hyprpicker]; + }); mkDate = longDate: (lib.concatStringsSep "-" [ (builtins.substring 0 4 longDate) (builtins.substring 4 2 longDate) @@ -22,26 +32,25 @@ ]); version = lib.removeSuffix "\n" (builtins.readFile ./VERSION); in { - overlays.default = _: prev: rec { - hyprpicker = prev.callPackage ./nix/default.nix { - stdenv = prev.gcc12Stdenv; - version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); - wayland-protocols = prev.wayland-protocols.overrideAttrs (self: super: { - version = "1.34"; - src = prev.fetchurl { - url = "https://gitlab.freedesktop.org/wayland/${self.pname}/-/releases/${self.version}/downloads/${self.pname}-${self.version}.tar.xz"; - hash = "sha256-xZsnys2F9guvTuX4DfXA0Vdg6taiQysAq34uBXTcr+s="; + overlays = { + default = self.overlays.hyprpicker; + hyprpicker = lib.composeManyExtensions [ + inputs.hyprutils.overlays.default + (final: prev: { + hyprpicker = prev.callPackage ./nix/default.nix { + stdenv = prev.gcc13Stdenv; + version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); }; - }); - inherit (prev.xorg) libXdmcp; - }; - hyprpicker-debug = hyprpicker.override {debug = true;}; + hyprpicker-debug = final.hyprpicker.override {debug = true;}; + }) + ]; }; - packages = genSystems (system: - (self.overlays.default null pkgsFor.${system}) - // {default = self.packages.${system}.hyprpicker;}); + packages = eachSystem (system: { + default = self.packages.${system}.hyprpicker; + inherit (pkgsFor.${system}) hyprpicker hyprpicker-debug; + }); - formatter = genSystems (system: pkgsFor.${system}.alejandra); + formatter = eachSystem (system: pkgsFor.${system}.alejandra); }; } diff --git a/nix/default.nix b/nix/default.nix index db74368..0e64f6d 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -5,6 +5,7 @@ cmake, cairo, fribidi, + hyprutils, libdatrie, libGL, libjpeg, @@ -19,7 +20,7 @@ wayland, wayland-protocols, wayland-scanner, - libXdmcp, + xorg, debug ? false, version ? "git", }: @@ -42,21 +43,22 @@ stdenv.mkDerivation { buildInputs = [ cairo fribidi + hyprutils libdatrie libGL libjpeg libselinux libsepol libthai + libxkbcommon pango pcre pcre2 + utillinux wayland wayland-protocols wayland-scanner - libXdmcp - libxkbcommon - utillinux + xorg.libXdmcp ]; outputs = [