Skip to content

Commit

Permalink
make sure nixosSystem is always defined
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 authored and mergify[bot] committed Sep 16, 2024
1 parent ac9d12f commit af2d9d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/nixos-anywhere.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ kexecUrl=""
kexecExtraFlags=""
enableDebug=""
diskoScript=""
nixosSystem=""
nixOptions=(
--extra-experimental-features 'nix-command flakes'
"--no-write-lock-file"
Expand Down Expand Up @@ -448,7 +449,8 @@ runDisko() {
}

nixosInstall() {
if [[ -n ${nixosSystem-} ]]; then
local nixosSystem=$1
if [[ -n ${nixosSystem} ]]; then
step Uploading the system closure
nixCopy --to "ssh://$sshConnection?remote-store=local?root=/mnt" "$nixosSystem"
elif [[ ${buildOnRemote} == "y" ]]; then
Expand Down Expand Up @@ -517,7 +519,7 @@ main() {
diskoScript=$(nixBuild "${flake}#nixosConfigurations.\"${flakeAttr}\".config.system.build.diskoScript")
nixosSystem=$(nixBuild "${flake}#nixosConfigurations.\"${flakeAttr}\".config.system.build.toplevel")
fi
elif [[ -n ${diskoScript} ]] && [[ -n ${nixosSystem-} ]]; then
elif [[ -n ${diskoScript} ]] && [[ -n ${nixosSystem} ]]; then
if [[ ! -e ${diskoScript} ]] || [[ ! -e ${nixosSystem} ]]; then
abort "${diskoScript} and ${nixosSystem} must be existing store-paths"
fi
Expand Down Expand Up @@ -578,7 +580,7 @@ main() {
fi

if [[ ${phases[install]-} == 1 ]]; then
nixosInstall
nixosInstall "$nixosSystem"
fi

if [[ ${phases[reboot]-} == 1 ]]; then
Expand Down

0 comments on commit af2d9d0

Please sign in to comment.