Skip to content

Commit

Permalink
Nix: makeover
Browse files Browse the repository at this point in the history
  • Loading branch information
fufexan committed Jul 18, 2024
1 parent 4503248 commit c36676a
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 33 deletions.
48 changes: 44 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 34 additions & 25 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,47 +1,56 @@
{
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)
(builtins.substring 6 2 longDate)
]);
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);
};
}
10 changes: 6 additions & 4 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
cmake,
cairo,
fribidi,
hyprutils,
libdatrie,
libGL,
libjpeg,
Expand All @@ -19,7 +20,7 @@
wayland,
wayland-protocols,
wayland-scanner,
libXdmcp,
xorg,
debug ? false,
version ? "git",
}:
Expand All @@ -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 = [
Expand Down

0 comments on commit c36676a

Please sign in to comment.