Skip to content

Commit 563b819

Browse files
committed
add --from option
1 parent b9b9208 commit 563b819

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,14 @@ Options:
5555
* --disk-encryption-keys remote_path local_path
5656
copy the contents of the file or pipe in local_path to remote_path in the installer environment,
5757
after kexec but before installation. Can be repeated.
58+
* --no-substitute-on-destination
59+
disable passing --substitute-on-destination to nix-copy
5860
* --debug
5961
enable debug output
62+
* --option KEY VALUE
63+
nix option to pass to every nix related command
64+
* --from store-uri
65+
URL of the source Nix store to copy the nixos and disko closure from
6066
```
6167
6268
## Using your own kexec image

src/nixos-remote.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Options:
3030
enable debug output
3131
* --option KEY VALUE
3232
nix option to pass to every nix related command
33+
* --from store-uri
34+
URL of the source Nix store to copy the nixos and disko closure from
3335
USAGE
3436
}
3537

@@ -42,11 +44,12 @@ default_kexec_url=https://github.com/nix-community/nixos-images/releases/downloa
4244
kexec_url="$default_kexec_url"
4345
enable_debug=""
4446
maybe_reboot="sleep 6 && reboot"
45-
substitute_on_destination="--substitute-on-destination"
4647
nix_options=(
4748
--extra-experimental-features 'nix-command flakes'
4849
"--no-write-lock-file"
4950
)
51+
substitute_on_destination=y
52+
nix_copy_options=()
5053

5154
declare -A disk_encryption_keys
5255

@@ -96,6 +99,10 @@ while [[ $# -gt 0 ]]; do
9699
--no-reboot)
97100
maybe_reboot=""
98101
;;
102+
--from)
103+
nix_copy_options+=("--from" "$2")
104+
shift
105+
;;
99106
--option)
100107
key=$2
101108
shift
@@ -104,7 +111,7 @@ while [[ $# -gt 0 ]]; do
104111
nix_options+=("--option" "$key" "$value")
105112
;;
106113
--no-substitute-on-destination)
107-
substitute_on_destination=""
114+
substitute_on_destination=n
108115
;;
109116

110117
*)
@@ -131,9 +138,14 @@ if [[ ${print_build_logs-n} == "y" ]]; then
131138
nix_options+=("-L")
132139
fi
133140

141+
if [[ ${substitute_on_destination-n} == "y" ]]; then
142+
nix_copy_options+=("--substitute-on-destination")
143+
fi
144+
134145
nix_copy() {
135146
NIX_SSHOPTS='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' nix copy \
136-
"${substitute_on_destination}" "${nix_options[@]}" \
147+
"${nix_options[@]}" \
148+
"${nix_copy_options[@]}" \
137149
"$@"
138150
}
139151
nix_build() {

0 commit comments

Comments
 (0)