Skip to content

Commit 21059cd

Browse files
authored
Merge branch 'main' into fix/build-on-remote
2 parents f71fbd1 + 0174074 commit 21059cd

File tree

8 files changed

+58
-27
lines changed

8 files changed

+58
-27
lines changed

src/get-facts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ set -efu "${enable_debug:-}"
33
has() {
44
command -v "$1" >/dev/null && echo "y" || echo "n"
55
}
6-
is_nixos=$(if test -f /etc/os-release && grep -q ID=nixos /etc/os-release; then echo "y"; else echo "n"; fi)
6+
is_nixos=$(if test -f /etc/os-release && grep -Eq 'ID(_LIKE)?="?nixos"?' /etc/os-release; then echo "y"; else echo "n"; fi)
77
cat <<FACTS
88
is_os=$(uname)
99
is_arch=$(uname -m)
1010
is_kexec=$(if test -f /etc/is_kexec; then echo "y"; else echo "n"; fi)
1111
is_nixos=$is_nixos
12-
is_installer=$(if [ "$is_nixos" = "y" ] && grep -q VARIANT_ID=installer /etc/os-release; then echo "y"; else echo "n"; fi)
12+
is_installer=$(if [ "$is_nixos" = "y" ] && grep -Eq 'VARIANT_ID="?installer"?' /etc/os-release; then echo "y"; else echo "n"; fi)
1313
is_container=$(if [ "$(has systemd-detect-virt)" = "y" ]; then systemd-detect-virt --container; else echo "none"; fi)
1414
has_ipv6_only=$(if [ "$(has ip)" = "n" ] || ip r g 1 >/dev/null 2>/dev/null || ! ip -6 r g :: >/dev/null 2>/dev/null; then echo "n"; else echo "y"; fi)
1515
has_tar=$(has tar)

terraform/all-in-one.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,11 @@ No resources.
109109
| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | -------- | :------: |
110110
| <a name="input_debug_logging"></a> [debug\_logging](#input_debug_logging) | Enable debug logging | `bool` | `false` | no |
111111
| <a name="input_deployment_ssh_key"></a> [deployment\_ssh\_key](#input_deployment_ssh_key) | Content of private key used to deploy to the target\_host after initial installation. To ensure maximum security, it is advisable to connect to your host using ssh-agent instead of relying on this variable | `string` | `null` | no |
112-
| <a name="input_disk_encryption_key_scripts"></a> [disk\_encryption\_key\_scripts](#input_disk_encryption_key_scripts) | Each of these script files will be executed locally and the output of each of them will be made present at the given path to disko during installation. The keys will be not copied to the final system | <pre>list(object({<br> path = string<br> script = string<br> }))</pre> | `[]` | no |
112+
| <a name="input_disk_encryption_key_scripts"></a> [disk\_encryption\_key\_scripts](#input_disk_encryption_key_scripts) | Each script will be executed locally. Output of each will be created at the given path to disko during installation. The keys will be not copied to the final system | <pre>list(object({<br> path = string<br> script = string<br> }))</pre> | `[]` | no |
113113
| <a name="input_extra_environment"></a> [extra\_environment](#input_extra_environment) | Extra environment variables to be set during installation. This can be useful to set extra variables for the extra\_files\_script or disk\_encryption\_key\_scripts | `map(string)` | `{}` | no |
114-
| <a name="input_extra_files_script"></a> [extra\_files\_script](#input_extra_files_script) | A script file that prepares extra files to be copied to the target host during installation. The script expected to write all its files to the current directory. This directory is copied to the target host during installation to the / directory. | `string` | `null` | no |
114+
| <a name="input_extra_files_script"></a> [extra\_files\_script](#input_extra_files_script) | A script that should place files in the current directory that will be copied to the targets / directory | `string` | `null` | no |
115115
| <a name="input_file"></a> [file](#input_file) | Nix file containing the nixos\_system\_attr and nixos\_partitioner\_attr. Use this if you are not using flake | `string` | `null` | no |
116+
| <a name="input_install_port"></a> [install\_port](#input_install_port) | SSH port used to connect to the target\_host, before installing NixOS. If null than the value of `target_port` is used | `string` | `null` | no |
116117
| <a name="input_install_ssh_key"></a> [install\_ssh\_key](#input_install_ssh_key) | Content of private key used to connect to the target\_host during initial installation | `string` | `null` | no |
117118
| <a name="input_install_user"></a> [install\_user](#input_install_user) | SSH user used to connect to the target\_host, before installing NixOS. If null than the value of `target_host` is used | `string` | `null` | no |
118119
| <a name="input_instance_id"></a> [instance\_id](#input_instance_id) | The instance id of the target\_host, used to track when to reinstall the machine | `string` | `null` | no |
@@ -123,7 +124,7 @@ No resources.
123124
| <a name="input_no_reboot"></a> [no\_reboot](#input_no_reboot) | Do not reboot after installation | `bool` | `false` | no |
124125
| <a name="input_stop_after_disko"></a> [stop\_after\_disko](#input_stop_after_disko) | Exit after disko formatting | `bool` | `false` | no |
125126
| <a name="input_target_host"></a> [target\_host](#input_target_host) | DNS host to deploy to | `string` | n/a | yes |
126-
| <a name="input_target_port"></a> [target\_port](#input_target_port) | SSH port used to connect to the target\_host, before installing NixOS | `number` | `22` | no |
127+
| <a name="input_target_port"></a> [target\_port](#input_target_port) | SSH port used to connect to the target\_host after installing NixOS. If install\_port is not set than this port is also used before installing. | `number` | `22` | no |
127128
| <a name="input_target_user"></a> [target\_user](#input_target_user) | SSH user used to connect to the target\_host after installing NixOS. If install\_user is not set than this user is also used before installing. | `string` | `"root"` | no |
128129

129130
## Outputs

terraform/all-in-one/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ module "partitioner-build" {
1414

1515
locals {
1616
install_user = var.install_user == null ? var.target_user : var.install_user
17+
install_port = var.install_port == null ? var.target_port : var.install_port
1718
}
1819

1920
module "install" {
2021
source = "../install"
2122
kexec_tarball_url = var.kexec_tarball_url
2223
target_user = local.install_user
2324
target_host = var.target_host
24-
target_port = var.target_port
25+
target_port = local.install_port
2526
nixos_partitioner = module.partitioner-build.result.out
2627
nixos_system = module.system-build.result.out
2728
ssh_private_key = var.install_ssh_key

terraform/all-in-one/variables.tf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ variable "install_user" {
3333
default = null
3434
}
3535

36+
variable "install_port" {
37+
type = string
38+
description = "SSH port used to connect to the target_host, before installing NixOS. If null than the value of `target_port` is used"
39+
default = null
40+
}
41+
3642
variable "target_user" {
3743
type = string
3844
description = "SSH user used to connect to the target_host after installing NixOS. If install_user is not set than this user is also used before installing."
@@ -41,7 +47,7 @@ variable "target_user" {
4147

4248
variable "target_port" {
4349
type = number
44-
description = "SSH port used to connect to the target_host, before installing NixOS"
50+
description = "SSH port used to connect to the target_host after installing NixOS. If install_port is not set than this port is also used before installing."
4551
default = 22
4652
}
4753

@@ -77,7 +83,7 @@ variable "stop_after_disko" {
7783

7884
variable "extra_files_script" {
7985
type = string
80-
description = "A script file that prepares extra files to be copied to the target host during installation. The script expected to write all its files to the current directory. This directory is copied to the target host during installation to the / directory."
86+
description = "A script that should place files in the current directory that will be copied to the targets / directory"
8187
default = null
8288
}
8389

@@ -86,7 +92,7 @@ variable "disk_encryption_key_scripts" {
8692
path = string
8793
script = string
8894
}))
89-
description = "Each of these script files will be executed locally and the output of each of them will be made present at the given path to disko during installation. The keys will be not copied to the final system"
95+
description = "Each script will be executed locally. Output of each will be created at the given path to disko during installation. The keys will be not copied to the final system"
9096
default = []
9197
}
9298

0 commit comments

Comments
 (0)