nixos-anywhere/terraform/nixos-rebuild.md
2023-11-23 09:09:02 +00:00

3.6 KiB

Nixos-rebuild

Update NixOS machine with nixos-rebuild on a remote machine

Example

locals {
  ipv4 = "192.0.2.1"
}

module "system-build" {
  source              = "github.com/nix-community/nixos-anywhere//terraform/nix-build"
  # with flakes
  attribute           = ".#nixosConfigurations.mymachine.config.system.build.toplevel"
  # without flakes
  # file can use (pkgs.nixos []) function from nixpkgs
  #file                = "${path.module}/../.."
  #attribute           = "config.system.build.toplevel"
}

module "deploy" {
  source       = "github.com/nix-community/nixos-anywhere//terraform/nixos-rebuild"
  nixos_system = module.system-build.result.out
  target_host  = local.ipv4
}

Requirements

No requirements.

Providers

Name Version
null n/a

Modules

No modules.

Resources

Name Type
null_resource.nixos-rebuild resource

Inputs

Name Description Type Default Required
ignore_systemd_errors Ignore systemd errors happening during deploy bool false no
nixos_system The nixos system to deploy string n/a yes
ssh_private_key Content of private key used to connect to the target_host. If set to - no key is passed to openssh and ssh will back to its own configuration string "-" no
target_host DNS host to deploy to string n/a yes
target_port SSH port used to connect to the target_host number 22 no
target_user User to deploy as string "root" no

Outputs

No outputs.