File tree Expand file tree Collapse file tree 5 files changed +26
-4
lines changed
Expand file tree Collapse file tree 5 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ module "nixos-rebuild" {
5656 target_host = var. target_host
5757 target_user = var. target_user
5858 target_port = var. target_port
59+ install_bootloader = var. install_bootloader
5960}
6061
6162output "result" {
Original file line number Diff line number Diff line change @@ -143,3 +143,9 @@ variable "build_on_remote" {
143143 description = " Build the closure on the remote machine instead of building it locally and copying it over"
144144 default = false
145145}
146+
147+ variable "install_bootloader" {
148+ type = bool
149+ description = " Install/re-install the bootloader"
150+ default = false
151+ }
Original file line number Diff line number Diff line change 33set -uex -o pipefail
44
55if [ " $# " -ne 5 ]; then
6- echo " USAGE: $0 NIXOS_SYSTEM TARGET_USER TARGET_HOST TARGET_PORT IGNORE_SYSTEMD_ERRORS" >&2
6+ echo " USAGE: $0 NIXOS_SYSTEM TARGET_USER TARGET_HOST TARGET_PORT IGNORE_SYSTEMD_ERRORS INSTALL_BOOTLOADER " >&2
77 exit 1
88fi
99
@@ -12,7 +12,9 @@ TARGET_USER=$2
1212TARGET_HOST=$3
1313TARGET_PORT=$4
1414IGNORE_SYSTEMD_ERRORS=$5
15- shift 3
15+ INSTALL_BOOTLOADER=$6
16+
17+ shift 6
1618
1719TARGET=" ${TARGET_USER} @${TARGET_HOST} "
1820
@@ -46,7 +48,14 @@ until NIX_SSHOPTS="${sshOpts[*]}" nix copy -s --experimental-features nix-comman
4648 try=$(( try + 1 ))
4749done
4850
49- switchCommand=" nix-env -p /nix/var/nix/profiles/system --set $( printf " %q" " $NIXOS_SYSTEM " ) ; /nix/var/nix/profiles/system/bin/switch-to-configuration switch"
51+ if [[ $INSTALL_BOOTLOADER == " true" ]]; then
52+ extra_env=' NIXOS_INSTALL_BOOTLOADER=1'
53+ else
54+ extra_env=' '
55+ fi
56+
57+ switchCommand=" nix-env -p /nix/var/nix/profiles/system --set $( printf " %q" " $NIXOS_SYSTEM " ) ; $extra_env /nix/var/nix/profiles/system/bin/switch-to-configuration switch"
58+
5059if [[ $TARGET_USER != " root" ]]; then
5160 switchCommand=" sudo bash -c '$switchCommand '"
5261fi
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ resource "null_resource" "nixos-rebuild" {
66 environment = {
77 SSH_KEY = var.ssh_private_key
88 }
9- command = " ${ path . module } /deploy.sh ${ var . nixos_system } ${ var . target_user } ${ var . target_host } ${ var . target_port } ${ var . ignore_systemd_errors } "
9+ command = " ${ path . module } /deploy.sh ${ var . nixos_system } ${ var . target_user } ${ var . target_host } ${ var . target_port } ${ var . ignore_systemd_errors } ${ var . install_bootloader } "
1010 }
1111}
Original file line number Diff line number Diff line change @@ -31,3 +31,9 @@ variable "ignore_systemd_errors" {
3131 description = " Ignore systemd errors happening during deploy"
3232 default = false
3333}
34+
35+ variable "install_bootloader" {
36+ type = bool
37+ description = " Install/re-install the bootloader"
38+ default = false
39+ }
You can’t perform that action at this time.
0 commit comments