Skip to content

Commit

Permalink
Nix: overhaul flake
Browse files Browse the repository at this point in the history
  • Loading branch information
fufexan committed Mar 24, 2024
1 parent 0eb4919 commit d5b9c7e
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 21 deletions.
24 changes: 20 additions & 4 deletions flake.lock

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

47 changes: 30 additions & 17 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,46 +1,59 @@
{
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 = {
self,
nixpkgs,
systems,
...
}: 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)
]);
in {
overlays.default = _: prev: rec {
hyprpicker = prev.callPackage ./nix/default.nix {
stdenv = prev.gcc12Stdenv;
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
overlays = {
default = self.overlays.hyprpicker;
hyprpicker = lib.composeManyExtensions [
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: {
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=";
};
});
inherit (prev.xorg) libXdmcp;
};
hyprpicker-debug = 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);
};
}

0 comments on commit d5b9c7e

Please sign in to comment.