summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2015-07-04 16:47:03 +0200
committerMatthias Beyer <mail@beyermatthias.de>2015-07-04 16:47:03 +0200
commitc2d250d539edae760de31060dc1e379d4ed3c049 (patch)
treefcc8596c02b0425deeabb117c92fc99324eab408
parent1c7ebbb0cc217c86df9b58e6ff2d2b50f03531bb (diff)
parentb49516b1043b2190990668657aa5593cff94fc12 (diff)
Merge pull request #37 from matthiasbeyer/fix-switch
Fix switch
-rwxr-xr-xnix-script-switch.sh3
-rw-r--r--nix-utils.sh2
2 files changed, 2 insertions, 3 deletions
diff --git a/nix-script-switch.sh b/nix-script-switch.sh
index 6cf585d..2290b33 100755
--- a/nix-script-switch.sh
+++ b/nix-script-switch.sh
@@ -90,8 +90,7 @@ REBUILD_EXIT=$?
if [[ $REBUILD_EXIT -eq 0 ]]
then
- LASTGEN=$(sudo nix-env -p /nix/var/nix/profiles/system --list-generations |\
- grep current | cut -d " " -f 2)
+ LASTGEN=$(current_system_generation)
sudo -k
if [[ -z "$TAG_NAME" ]]
diff --git a/nix-utils.sh b/nix-utils.sh
index 2d84a43..7cd1bb2 100644
--- a/nix-utils.sh
+++ b/nix-utils.sh
@@ -37,7 +37,7 @@ explain() {
}
grep_generation() {
- $* | grep current | cut -d " " -f 2
+ $* | grep current | sed -r 's,\s*([0-9]*)(.*),\1,'
}
current_system_generation() {