summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2015-06-14 21:10:32 +0200
committerMatthias Beyer <mail@beyermatthias.de>2015-07-31 11:16:56 +0200
commit93b9d7130105d43ff2f49ee9e897fec9784d8693 (patch)
treedad4acd21f239e3b497733c910285ed68a1d2d7d
parentf80f37a0c21440b1f13a29d739a63678e43f33c2 (diff)
Add feature to be able to do everything, but not nixos-rebuild
-rwxr-xr-xnix-script-switch.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/nix-script-switch.sh b/nix-script-switch.sh
index 30f0fb8..3359e32 100755
--- a/nix-script-switch.sh
+++ b/nix-script-switch.sh
@@ -17,6 +17,7 @@ usage() {
-t <tagname> Custom tag name
-p <pkgs> Generate the switch tag in the nixpkgs at <pkgs> as well.
-f <tag-flags> Flags for git-tag (see 'git tag --help')
+ -b Do not call nixos-rebuild at all.
-h Show this help and exit
This command helps you rebuilding your system and keeping track
@@ -53,8 +54,9 @@ TAG_NAME=
HOSTNAME="$(hostname)"
NIXPKGS=""
TAG_FLAGS=""
+DONT_BUILD=
-while getopts "c:w:t:np:f:h" OPTION
+while getopts "c:w:t:nbp:f:h" OPTION
do
case $OPTION in
c)
@@ -85,6 +87,11 @@ do
dbg "TAG_FLAGS = $TAG_FLAGS"
;;
+ b)
+ DONT_BUILD=1
+ dbg "DONT_BUILD = $DONT_BUILD"
+ ;;
+
h)
usage
exit 1
@@ -121,8 +128,14 @@ dbg "ARGS = $ARGS"
[[ ! -d "$WD" ]] && stderr "No directory: $WD" && exit 1
[[ -z "$COMMAND" ]] && COMMAND="switch"
-explain sudo nixos-rebuild $COMMAND $ARGS
-REBUILD_EXIT=$?
+if [[ -z "$DONT_BUILD" ]]
+then
+ explain sudo nixos-rebuild $COMMAND $ARGS
+ REBUILD_EXIT=$?
+else
+ stdout "Do not call nixos-rebuild"
+ REBUILD_EXIT=0
+fi
if [[ $REBUILD_EXIT -eq 0 ]]
then