nix: pass commit info to cmake

This commit is contained in:
Mihai Fufezan 2024-12-21 23:20:38 +02:00
parent ee37e41723
commit f2c153c09b
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg
3 changed files with 9 additions and 1 deletions

View file

@ -40,7 +40,7 @@
overlays = with self.overlays; [default];
});
in {
overlays = import ./nix/overlays.nix {inherit inputs lib;};
overlays = import ./nix/overlays.nix {inherit inputs lib self;};
packages = eachSystem (system: {
default = self.packages.${system}.hyprlock;

View file

@ -22,6 +22,7 @@
wayland-protocols,
wayland-scanner,
version ? "git",
shortRev ? "",
}:
stdenv.mkDerivation {
pname = "hyprlock";
@ -55,6 +56,11 @@ stdenv.mkDerivation {
wayland-protocols
];
cmakeFlags = lib.mapAttrsToList lib.cmakeFeature {
HYPRLOCK_COMMIT = shortRev;
HYPRLOCK_VERSION_COMMIT = shortRev;
};
meta = {
homepage = "https://github.com/hyprwm/hyprlock";
description = "A gpu-accelerated screen lock for Hyprland";

View file

@ -1,6 +1,7 @@
{
lib,
inputs,
self,
}: let
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
@ -22,6 +23,7 @@ in {
stdenv = prev.gcc14Stdenv;
version = version + "+date=" + (mkDate (inputs.self.lastModifiedDate or "19700101")) + "_" + (inputs.self.shortRev or "dirty");
inherit (final) hyprlang;
shortRev = self.sourceInfo.shortRev or "dirty";
};
})
];