aboutsummaryrefslogtreecommitdiff
path: root/nixos/rebuild
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-20 17:05:52 +0200
commit6af39ed926b30a42cbc7bba8ff4419091c6e0e0a (patch)
tree540c4e5861ce97b96b73b15b7a3d93864958062b /nixos/rebuild
parent9eea67161fb5653e969411b9ccc67e577c8761e3 (diff)
feat(common): set system.configurationRevision
Diffstat (limited to 'nixos/rebuild')
-rwxr-xr-xnixos/rebuild7
1 files changed, 7 insertions, 0 deletions
diff --git a/nixos/rebuild b/nixos/rebuild
index 395f78d..3589dc4 100755
--- a/nixos/rebuild
+++ b/nixos/rebuild
@@ -9,6 +9,13 @@ if [ ! -d "$hostDir" ]; 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
+
(
# The result symlink created in the current directory is registered as a root of the Nix
# garbage collector, so it's important that we call nixos-rebuild from the host directory.