Skip to content

Commit b4a725a

Browse files
bors[bot]Kranzes
andauthored
Merge #26
26: nixos-remote.sh: don't create symlink in dir & add --print-build-logs/-L flag r=Mic92 a=Kranzes Co-authored-by: Ilan Joselevich <personal@ilanjoselevich.com>
2 parents ed7b973 + 4d04a9d commit b4a725a

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

src/nixos-remote.sh

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Options:
66
77
* -f, --flake flake
88
set the flake to install the system from
9+
* -L, --print-build-logs
10+
print full build logs
911
* -s, --store-paths
1012
set the store paths to the disko-script and nixos-system directly
1113
if this is give, flake is not needed
@@ -44,6 +46,9 @@ while [[ $# -gt 0 ]]; do
4446
flake=$2
4547
shift
4648
;;
49+
-L | --print-build-logs)
50+
print_build_logs=y
51+
;;
4752
-s | --store-paths)
4853
disko_script=$(readlink -f "$2")
4954
nixos_system=$(readlink -f "$3")
@@ -63,6 +68,7 @@ while [[ $# -gt 0 ]]; do
6368
;;
6469
--debug)
6570
enable_debug="-x"
71+
print_build_logs=y
6672
set -x
6773
;;
6874
--extra-files)
@@ -100,15 +106,26 @@ timeout_ssh_() {
100106
ssh_() {
101107
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$ssh_connection" "$@"
102108
}
103-
nixCopy() {
104-
NIX_SSHOPTS='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' nix copy --extra-experimental-features nix-command "$@"
109+
110+
nix_options=(
111+
--extra-experimental-features 'nix-command flakes'
112+
"--no-write-lock-file"
113+
)
114+
115+
if [[ ${print_build_logs-n} == "y" ]]; then
116+
nix_options+=("-L")
117+
fi
118+
119+
nix_copy() {
120+
NIX_SSHOPTS='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' nix copy \
121+
"${nix_options[@]}" \
122+
"$@"
105123
}
106124
nix_build() {
107-
nix \
108-
--experimental-features flakes build \
109-
--extra-experimental-features nix-command \
110-
--no-write-lock-file \
125+
nix build \
126+
"${nix_options[@]}" \
111127
--print-out-paths \
128+
--no-link \
112129
"$@"
113130
}
114131

@@ -216,14 +233,14 @@ do
216233
ssh_ "umask 077; cat > $path" < "${disk_encryption_keys[$path]}"
217234
done
218235

219-
nixCopy --to "ssh://$ssh_connection" "$disko_script"
236+
nix_copy --to "ssh://$ssh_connection" "$disko_script"
220237
ssh_ "$disko_script"
221238

222239
if [[ ${stop_after_disko-n} == "y" ]]; then
223240
exit 0
224241
fi
225242

226-
nixCopy --to "ssh://$ssh_connection?remote-store=local?root=/mnt" "$nixos_system"
243+
nix_copy --to "ssh://$ssh_connection?remote-store=local?root=/mnt" "$nixos_system"
227244
if [[ -n ${extra_files:-} ]]; then
228245
if [[ -d "$extra_files" ]]; then
229246
extra_files="$extra_files/"

0 commit comments

Comments
 (0)