scripts/update: pass through nix flags like --show-trace

This commit is contained in:
2024-12-28 14:13:48 +00:00
parent 8585c7ce4b
commit 4ad470469f

View File

@@ -53,7 +53,7 @@ getPkgs() {
# nix-instantiate -A nix "$NIX_FILES_TOP" # nix-instantiate -A nix "$NIX_FILES_TOP"
# nix-instantiate -A nixpkgs-bootstrap.master "$NIX_FILES_TOP" # nix-instantiate -A nixpkgs-bootstrap.master "$NIX_FILES_TOP"
debug "querying packages to update as part of '$attrPrefix'" debug "querying packages to update as part of '$attrPrefix'"
local attrs=$(nix eval --raw -f "$NIX_FILES_TOP" 'updateTargets."'"$attrPrefix"'"' --apply 'builtins.concatStringsSep " "') local attrs=$(nix eval --raw -f "$NIX_FILES_TOP" 'updateTargets."'"$attrPrefix"'"' --apply 'builtins.concatStringsSep " "' "${nixFlags[@]}")
debug "got: $attrs" debug "got: $attrs"
attrsArr+=($attrs) attrsArr+=($attrs)
} }
@@ -61,17 +61,17 @@ getPkgs() {
updateOnePkg() { updateOnePkg() {
local attrPath="$1" local attrPath="$1"
local updateScript=$(nix eval --raw -f "$NIX_FILES_TOP" 'updateScripts."'"$attrPath"'"') local updateScript=$(nix eval --raw -f "$NIX_FILES_TOP" 'updateScripts."'"$attrPath"'"' "${nixFlags[@]}")
if [ -z "$updateScript" ]; then if [ -z "$updateScript" ]; then
warn "don't know how to update '$attrPath'" warn "don't know how to update '$attrPath'"
return return
fi fi
# make sure everything needed to invoke the update script exists in-store # make sure everything needed to invoke the update script exists in-store
local context=$(nix eval --raw -f "$NIX_FILES_TOP" 'updateScripts."'"$attrPath"'"' --apply 's: builtins.concatStringsSep " " (builtins.attrNames (builtins.getContext s))') local context=$(nix eval --raw -f "$NIX_FILES_TOP" 'updateScripts."'"$attrPath"'"' --apply 's: builtins.concatStringsSep " " (builtins.attrNames (builtins.getContext s))' "${nixFlags[@]}")
for c in $context; do for c in $context; do
debug "realizing updateScript requisite: $context" debug "realizing updateScript requisite: $context"
nix-store --realize "$c" || true nix-store --realize "$c" "${nixFlags[@]}" || true
done done
info "updating: '$attrPath'" info "updating: '$attrPath'"
@@ -87,6 +87,7 @@ updatePkgsInParallel() {
} }
scriptFlags=() scriptFlags=()
nixFlags=()
dryRun= dryRun=
toplevelsToUpdate=() toplevelsToUpdate=()
verbose= verbose=
@@ -106,6 +107,9 @@ parseArgs() {
scriptFlags+=(--verbose) scriptFlags+=(--verbose)
verbose=1 verbose=1
;; ;;
(--*)
nixFlags+=("$arg")
;;
(*) (*)
toplevelsToUpdate+=("$arg") toplevelsToUpdate+=("$arg")
;; ;;