forked from mirrors/nixpkgs
Merge pull request #22758 from dezgeg/pr-nixos-rebuild
nixos-rebuild: Don't rebuild nixos-rebuild when --fast is used
This commit is contained in:
commit
14c47bd546
|
@ -15,6 +15,7 @@ origArgs=("$@")
|
|||
extraBuildFlags=()
|
||||
action=
|
||||
buildNix=1
|
||||
fast=
|
||||
rollback=
|
||||
upgrade=
|
||||
repair=
|
||||
|
@ -52,13 +53,13 @@ while [ "$#" -gt 0 ]; do
|
|||
repair=1
|
||||
extraBuildFlags+=("$i")
|
||||
;;
|
||||
--show-trace|--no-build-hook|--keep-failed|-K|--keep-going|-k|--verbose|-v|-vv|-vvv|-vvvv|-vvvvv|--fallback|--repair|--no-build-output|-Q)
|
||||
extraBuildFlags+=("$i")
|
||||
;;
|
||||
--max-jobs|-j|--cores|-I)
|
||||
j="$1"; shift 1
|
||||
extraBuildFlags+=("$i" "$j")
|
||||
;;
|
||||
--show-trace|--no-build-hook|--keep-failed|-K|--keep-going|-k|--verbose|-v|-vv|-vvv|-vvvv|-vvvvv|--fallback|--repair|--no-build-output|-Q|-j*)
|
||||
extraBuildFlags+=("$i")
|
||||
;;
|
||||
--option)
|
||||
j="$1"; shift 1
|
||||
k="$1"; shift 1
|
||||
|
@ -66,6 +67,7 @@ while [ "$#" -gt 0 ]; do
|
|||
;;
|
||||
--fast)
|
||||
buildNix=
|
||||
fast=1
|
||||
extraBuildFlags+=(--show-trace)
|
||||
;;
|
||||
--profile-name|-p)
|
||||
|
@ -217,7 +219,7 @@ if [ -z "$_NIXOS_REBUILD_REEXEC" ]; then
|
|||
fi
|
||||
|
||||
# Re-execute nixos-rebuild from the Nixpkgs tree.
|
||||
if [ -z "$_NIXOS_REBUILD_REEXEC" -a -n "$canRun" ]; then
|
||||
if [ -z "$_NIXOS_REBUILD_REEXEC" -a -n "$canRun" -a -z "$fast" ]; then
|
||||
if p=$(nix-build --no-out-link --expr 'with import <nixpkgs/nixos> {}; config.system.build.nixos-rebuild' "${extraBuildFlags[@]}"); then
|
||||
export _NIXOS_REBUILD_REEXEC=1
|
||||
exec $p/bin/nixos-rebuild "${origArgs[@]}"
|
||||
|
|
Loading…
Reference in a new issue