summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2015-09-24 19:30:06 +0200
committerMatthias Beyer <mail@beyermatthias.de>2015-10-04 14:10:44 +0200
commitcbe184ccdc4fbf713bae56ffa1a4a70c44b17753 (patch)
treee777436af492f80df61903cca0d5c40898bf2266
parent4bb80ed0998abf86d1aba24310ccc369ab670a91 (diff)
Fetch commit hash before nixos-rebuild
As described in #81, we should fetch the hash of the current HEAD before starting the nixos-rebuild run, as if this run takes a lot of time, the HEAD could have changed in between and so we would generate a tag on a wrong commit.
-rwxr-xr-xnix-script-switch.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/nix-script-switch.sh b/nix-script-switch.sh
index 6848a57..bd26c76 100755
--- a/nix-script-switch.sh
+++ b/nix-script-switch.sh
@@ -147,6 +147,9 @@ dbg "ARGS = $ARGS"
[[ ! -d "$WD" ]] && stderr "No directory: $WD" && exit 1
+TAG_TARGET=$(__git "$WD" rev-parse HEAD)
+stdout "Tag in config will be generated at '$TAG_TARGET'"
+
if [[ -z "$DONT_BUILD" ]]
then
__q="-Q"
@@ -181,7 +184,7 @@ then
fi
fi
-__git "$WD" tag $TAG_FLAGS "$TAG_NAME"
+__git "$WD" tag $TAG_FLAGS "$TAG_NAME" "$TAG_TARGET"
if [[ $TAG_NIXPKGS -eq 1 ]]
then