From 1e1fc79d84c35a673c52cfa0be1ea9df1aed8442 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Sun, 5 May 2024 15:04:53 +0300 Subject: [PATCH] Nix: add commit hash --- flake.nix | 1 + nix/default.nix | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/flake.nix b/flake.nix index 5abaa3b..c0984bf 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,7 @@ hyprpaper = final.callPackage ./nix/default.nix { stdenv = final.gcc13Stdenv; version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); + commit = self.rev or ""; inherit (final.xorg) libXdmcp; inherit (inputs.hyprlang.packages.${final.system}) hyprlang; }; diff --git a/nix/default.nix b/nix/default.nix index ab24856..32b0eee 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -23,6 +23,7 @@ wayland-protocols, wayland-scanner, libXdmcp, + commit, debug ? false, version ? "git", }: @@ -32,6 +33,11 @@ stdenv.mkDerivation { src = ../.; + prePatch = '' + substituteInPlace src/main.cpp \ + --replace GIT_COMMIT_HASH '"${commit}"' + ''; + cmakeBuildType = if debug then "Debug"