aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2026-10-15 07:31:36 +0200
committerMartin Fischer <martin@push-f.com>2026-10-15 07:38:55 +0200
commitd9ca24398ad71aca208c94a6399f13c46228b103 (patch)
treeadad427caa5824bc3656378f45dfa7255396bde1
parent1c10d56a396518562bf466fb7a7ffd8a4d054655 (diff)
feat: set system.configurationRevisionHEADmaster
-rw-r--r--nixos/profiles/common/default.nix6
-rwxr-xr-xnixos/rebuild7
2 files changed, 13 insertions, 0 deletions
diff --git a/nixos/profiles/common/default.nix b/nixos/profiles/common/default.nix
index 1705adf..0681dde 100644
--- a/nixos/profiles/common/default.nix
+++ b/nixos/profiles/common/default.nix
@@ -1,6 +1,12 @@
{ config, pkgs, ... }:
{
+ system.configurationRevision =
+ let
+ revision = builtins.getEnv "NIXOS_CONFIG_REVISION";
+ in
+ if revision == "" then null else revision;
+
imports =
let
sources = import <top/npins>;
diff --git a/nixos/rebuild b/nixos/rebuild
index bb44fe8..d714977 100755
--- a/nixos/rebuild
+++ b/nixos/rebuild
@@ -25,6 +25,13 @@ if [ ! -f "$configPath" ]; then
exit 1
fi
+# Make the configuration repository's commit available to the NixOS module.
+export NIXOS_CONFIG_REVISION
+NIXOS_CONFIG_REVISION=$(git -C "$top" rev-parse --verify HEAD)
+if [[ -n $(git -C "$top" status --porcelain) ]]; then
+ NIXOS_CONFIG_REVISION+="-dirty"
+fi
+
nixpkgsPath=$(
cd "$top" &&
nix-instantiate --eval --raw \