nixos-rebuild: Allow to use --repair.
Unfortunately, the flag only works directly and without the daemon, so this adds an extra variable $repair, to avoid the daemon. This is to avoid to iterate through the $extraBuildFlags just to test whether "--repair" exists. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
parent
ef5e2be339
commit
5a2390327d
modules/installer/tools
|
@ -49,6 +49,7 @@ action=
|
||||||
buildNix=1
|
buildNix=1
|
||||||
rollback=
|
rollback=
|
||||||
upgrade=
|
upgrade=
|
||||||
|
repair=
|
||||||
|
|
||||||
while [ "$#" -gt 0 ]; do
|
while [ "$#" -gt 0 ]; do
|
||||||
i="$1"; shift 1
|
i="$1"; shift 1
|
||||||
|
@ -71,6 +72,10 @@ while [ "$#" -gt 0 ]; do
|
||||||
--upgrade)
|
--upgrade)
|
||||||
upgrade=1
|
upgrade=1
|
||||||
;;
|
;;
|
||||||
|
--repair)
|
||||||
|
repair=1
|
||||||
|
extraBuildFlags+=("$i")
|
||||||
|
;;
|
||||||
--show-trace|--no-build-hook|--keep-failed|-K|--keep-going|-k|--verbose|-v|--fallback|--repair)
|
--show-trace|--no-build-hook|--keep-failed|-K|--keep-going|-k|--verbose|-v|--fallback|--repair)
|
||||||
extraBuildFlags+=("$i")
|
extraBuildFlags+=("$i")
|
||||||
;;
|
;;
|
||||||
|
@ -111,7 +116,9 @@ trap 'rm -rf "$tmpDir"' EXIT
|
||||||
# This matters if the new Nix in Nixpkgs has a schema change. It
|
# This matters if the new Nix in Nixpkgs has a schema change. It
|
||||||
# would upgrade the schema, which should only happen once we actually
|
# would upgrade the schema, which should only happen once we actually
|
||||||
# switch to the new configuration.
|
# switch to the new configuration.
|
||||||
if systemctl show nix-daemon.socket nix-daemon.service | grep -q ActiveState=active; then
|
# If --repair is given, don't try to use the Nix daemon, because the
|
||||||
|
# flag can only be used directly.
|
||||||
|
if [ -z "$repair" ] && systemctl show nix-daemon.socket nix-daemon.service | grep -q ActiveState=active; then
|
||||||
export NIX_REMOTE=${NIX_REMOTE:-daemon}
|
export NIX_REMOTE=${NIX_REMOTE:-daemon}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue