Skip to content

Commit

Permalink
feat: expose --generate-hardware-config nixos-facter thru TF
Browse files Browse the repository at this point in the history
add `var.nixos_facter_path` to TF modules `install` / `all-in-one`.

c.f. #407, which handled `--generate-hardware-config
nixos-generate-config`.
  • Loading branch information
KiaraGrouwstra committed Oct 20, 2024
1 parent 2d57031 commit 44212ac
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 0 deletions.
15 changes: 15 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions terraform/all-in-one.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ No resources.
| <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 |
| <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 |
| <a name="input_nixos_generate_config_path"></a> [nixos\_generate\_config\_path](#input_nixos_generate_config_path) | Path to which to write a `hardware-configuration.nix` generated by `nixos-generate-config`. | `string` | `""` | no |
| <a name="input_nixos_facter_path"></a> [nixos\_facter\_path](#input_nixos_facter_path) | Path to which to write a `hardware-configuration.nix` generated by `nixos-facter`. | `string` | `""` | no |

## Outputs

Expand Down
1 change: 1 addition & 0 deletions terraform/all-in-one/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module "install" {
instance_id = var.instance_id
phases = var.phases
nixos_generate_config_path = var.nixos_generate_config_path
nixos_facter_path = var.nixos_facter_path
# deprecated attributes
stop_after_disko = var.stop_after_disko
no_reboot = var.no_reboot
Expand Down
6 changes: 6 additions & 0 deletions terraform/all-in-one/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,9 @@ variable "nixos_generate_config_path" {
description = "Path to which to write a `hardware-configuration.nix` generated by `nixos-generate-config`."
default = ""
}

variable "nixos_facter_path" {
type = string
description = "Path to which to write a `facter.json` generated by `nixos-facter`."
default = ""
}
1 change: 1 addition & 0 deletions terraform/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ No modules.
| <a name="input_target_port"></a> [target\_port](#input_target_port) | SSH port used to connect to the target\_host | `number` | `22` | no |
| <a name="input_target_user"></a> [target\_user](#input_target_user) | SSH user used to connect to the target\_host | `string` | `"root"` | no |
| <a name="input_nixos_generate_config_path"></a> [nixos\_generate\_config\_path](#input_nixos_generate_config_path) | Path to which to write a `hardware-configuration.nix` generated by `nixos-generate-config`. | `string` | `""` | no |
| <a name="input_nixos_facter_path"></a> [nixos\_facter\_path](#input_nixos_facter_path) | Path to which to write a `hardware-configuration.nix` generated by `nixos-facter`. | `string` | `""` | no |

## Outputs

Expand Down
1 change: 1 addition & 0 deletions terraform/install/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ locals {
flake = var.flake
phases = join(",", local.phases)
nixos_generate_config_path = var.nixos_generate_config_path
nixos_facter_path = var.nixos_facter_path
})
}

Expand Down
2 changes: 2 additions & 0 deletions terraform/install/run-nixos-anywhere.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ else
fi
if [[ -n ${input[nixos_generate_config_path]} ]]; then
args+=("--generate-hardware-config" "nixos-generate-config" "${input[nixos_generate_config_path]}")
elif [[ -n ${input[nixos_facter_path]} ]]; then
args+=("--generate-hardware-config" "nixos-facter" "${input[nixos_facter_path]}")
fi
args+=(--phases "${input[phases]}")
if [[ ${input[ssh_private_key]} != null ]]; then
Expand Down
6 changes: 6 additions & 0 deletions terraform/install/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,9 @@ variable "nixos_generate_config_path" {
description = "Path to which to write a `hardware-configuration.nix` generated by `nixos-generate-config`."
default = ""
}

variable "nixos_facter_path" {
type = string
description = "Path to which to write a `facter.json` generated by `nixos-facter`."
default = ""
}

0 comments on commit 44212ac

Please sign in to comment.