published on Thursday, Oct 29, 2026 by sgomezsal
published on Thursday, Oct 29, 2026 by sgomezsal
Creates a fresh server, SSH key and firewall, then performs one initial NixOS installation. Routine updates use nixos-rebuild.
Create NixosServer Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NixosServer(name: string, args: NixosServerArgs, opts?: ComponentResourceOptions);@overload
def NixosServer(resource_name: str,
args: NixosServerArgs,
opts: Optional[ResourceOptions] = None)
@overload
def NixosServer(resource_name: str,
opts: Optional[ResourceOptions] = None,
installer: Optional[str] = None,
configuration: Optional[str] = None,
ssh_public_key_path: Optional[str] = None,
ssh_private_key_path: Optional[str] = None,
ssh_host_key_private_path: Optional[str] = None,
flake_directory: Optional[str] = None,
expected_disk_serial: Optional[str] = None,
labels: Optional[Mapping[str, str]] = None,
location: Optional[str] = None,
server_type: Optional[str] = None,
bootstrap_image: Optional[str] = None,
expected_disk: Optional[str] = None,
existing_ssh_key_ids: Optional[Sequence[str]] = None,
ssh_source_ips: Optional[Sequence[str]] = None,
ssh_timeout_seconds: Optional[int] = None,
tcp_ports: Optional[Sequence[int]] = None)func NewNixosServer(ctx *Context, name string, args NixosServerArgs, opts ...ResourceOption) (*NixosServer, error)public NixosServer(string name, NixosServerArgs args, ComponentResourceOptions? opts = null)
public NixosServer(String name, NixosServerArgs args)
public NixosServer(String name, NixosServerArgs args, ComponentResourceOptions options)
type: nixos-vps:hetzner:NixosServer
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "nixos-vps_hetzner_nixos_server" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args NixosServerArgs
- The arguments to resource properties.
- opts ComponentResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args NixosServerArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args NixosServerArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NixosServerArgs
- The arguments to resource properties.
- opts ComponentResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NixosServerArgs
- The arguments to resource properties.
- options ComponentResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var nixosServerResource = new NixosVps.Hetzner.NixosServer("nixosServerResource", new()
{
Installer = "string",
Configuration = "string",
SshPublicKeyPath = "string",
SshPrivateKeyPath = "string",
SshHostKeyPrivatePath = "string",
FlakeDirectory = "string",
ExpectedDiskSerial = "string",
Labels =
{
{ "string", "string" },
},
Location = "string",
ServerType = "string",
BootstrapImage = "string",
ExpectedDisk = "string",
ExistingSshKeyIds = new[]
{
"string",
},
SshSourceIps = new[]
{
"string",
},
SshTimeoutSeconds = 0,
TcpPorts = new()
{
0,
},
});
example, err := hetzner.NewNixosServer(ctx, "nixosServerResource", &hetzner.NixosServerArgs{
Installer: "string",
Configuration: "string",
SshPublicKeyPath: "string",
SshPrivateKeyPath: "string",
SshHostKeyPrivatePath: "string",
FlakeDirectory: "string",
ExpectedDiskSerial: "string",
Labels: pulumi.StringMap{
"string": pulumi.String("string"),
},
Location: pulumi.String("string"),
ServerType: pulumi.String("string"),
BootstrapImage: pulumi.String("string"),
ExpectedDisk: "string",
ExistingSshKeyIds: pulumi.StringArray{
pulumi.String("string"),
},
SshSourceIps: pulumi.StringArray{
pulumi.String("string"),
},
SshTimeoutSeconds: 0,
TcpPorts: []int{
0,
},
})
resource "nixos-vps_hetzner_nixos_server" "nixosServerResource" {
lifecycle {
create_before_destroy = true
}
installer = "string"
configuration = "string"
ssh_public_key_path = "string"
ssh_private_key_path = "string"
ssh_host_key_private_path = "string"
flake_directory = "string"
expected_disk_serial = "string"
labels = {
"string" = "string"
}
location = "string"
server_type = "string"
bootstrap_image = "string"
expected_disk = "string"
existing_ssh_key_ids = ["string"]
ssh_source_ips = ["string"]
ssh_timeout_seconds = 0
tcp_ports = [0]
}
var nixosServerResource = new NixosServer("nixosServerResource", NixosServerArgs.builder()
.installer("string")
.configuration("string")
.sshPublicKeyPath("string")
.sshPrivateKeyPath("string")
.sshHostKeyPrivatePath("string")
.flakeDirectory("string")
.expectedDiskSerial("string")
.labels(Map.of("string", "string"))
.location("string")
.serverType("string")
.bootstrapImage("string")
.expectedDisk("string")
.existingSshKeyIds("string")
.sshSourceIps("string")
.sshTimeoutSeconds(0)
.tcpPorts(0)
.build());
nixos_server_resource = nixos_vps.hetzner.NixosServer("nixosServerResource",
installer="string",
configuration="string",
ssh_public_key_path="string",
ssh_private_key_path="string",
ssh_host_key_private_path="string",
flake_directory="string",
expected_disk_serial="string",
labels={
"string": "string",
},
location="string",
server_type="string",
bootstrap_image="string",
expected_disk="string",
existing_ssh_key_ids=["string"],
ssh_source_ips=["string"],
ssh_timeout_seconds=0,
tcp_ports=[0])
const nixosServerResource = new nixos_vps.hetzner.NixosServer("nixosServerResource", {
installer: "string",
configuration: "string",
sshPublicKeyPath: "string",
sshPrivateKeyPath: "string",
sshHostKeyPrivatePath: "string",
flakeDirectory: "string",
expectedDiskSerial: "string",
labels: {
string: "string",
},
location: "string",
serverType: "string",
bootstrapImage: "string",
expectedDisk: "string",
existingSshKeyIds: ["string"],
sshSourceIps: ["string"],
sshTimeoutSeconds: 0,
tcpPorts: [0],
});
type: nixos-vps:hetzner:NixosServer
properties:
bootstrapImage: string
configuration: string
existingSshKeyIds:
- string
expectedDisk: string
expectedDiskSerial: string
flakeDirectory: string
installer: string
labels:
string: string
location: string
serverType: string
sshHostKeyPrivatePath: string
sshPrivateKeyPath: string
sshPublicKeyPath: string
sshSourceIps:
- string
sshTimeoutSeconds: 0
tcpPorts:
- 0
NixosServer Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The NixosServer resource accepts the following input properties:
- Configuration string
- Attribute under nixosConfigurations, for example web.
- Flake
Directory string - Absolute local directory containing the consumer flake and flake.lock.
- Installer string
- Absolute local flake package reference or explicit pinned installer flake URL.
- Ssh
Host stringKey Private Path - Absolute path to the separate Ed25519 server host private key.
- Ssh
Private stringKey Path - Absolute path to the deployment private key; keep it outside the flake.
- Ssh
Public stringKey Path - Absolute path to the deployment public key.
- Bootstrap
Image string - Ubuntu or Debian bootstrap image; defaults to ubuntu-24.04.
- Existing
Ssh List<string>Key Ids - Optional registered deployment SSH key IDs; omit to register a key.
- Expected
Disk string - Expected whole disk; defaults to /dev/sda.
- Expected
Disk stringSerial - Optional externally verified disk serial.
- Labels Dictionary<string, string>
- Public Hetzner server labels.
- Location string
- Hetzner location code; defaults to nbg1.
- Server
Type string - x86_64 CX, CPX or CCX plan; defaults to cpx22.
- Ssh
Source List<string>Ips - Allowed SSH sources; include the deployment runner. Defaults to public IPv4/IPv6.
- Ssh
Timeout intSeconds - SSH readiness timeout in seconds, between 1 and 3600; defaults to 600.
- Tcp
Ports List<int> - Additional inbound TCP ports. The NixOS firewall must also allow them.
- Configuration string
- Attribute under nixosConfigurations, for example web.
- Flake
Directory string - Absolute local directory containing the consumer flake and flake.lock.
- Installer string
- Absolute local flake package reference or explicit pinned installer flake URL.
- Ssh
Host stringKey Private Path - Absolute path to the separate Ed25519 server host private key.
- Ssh
Private stringKey Path - Absolute path to the deployment private key; keep it outside the flake.
- Ssh
Public stringKey Path - Absolute path to the deployment public key.
- Bootstrap
Image string - Ubuntu or Debian bootstrap image; defaults to ubuntu-24.04.
- Existing
Ssh []stringKey Ids - Optional registered deployment SSH key IDs; omit to register a key.
- Expected
Disk string - Expected whole disk; defaults to /dev/sda.
- Expected
Disk stringSerial - Optional externally verified disk serial.
- Labels map[string]string
- Public Hetzner server labels.
- Location string
- Hetzner location code; defaults to nbg1.
- Server
Type string - x86_64 CX, CPX or CCX plan; defaults to cpx22.
- Ssh
Source []stringIps - Allowed SSH sources; include the deployment runner. Defaults to public IPv4/IPv6.
- Ssh
Timeout intSeconds - SSH readiness timeout in seconds, between 1 and 3600; defaults to 600.
- Tcp
Ports []int - Additional inbound TCP ports. The NixOS firewall must also allow them.
- configuration string
- Attribute under nixosConfigurations, for example web.
- flake_
directory string - Absolute local directory containing the consumer flake and flake.lock.
- installer string
- Absolute local flake package reference or explicit pinned installer flake URL.
- ssh_
host_ stringkey_ private_ path - Absolute path to the separate Ed25519 server host private key.
- ssh_
private_ stringkey_ path - Absolute path to the deployment private key; keep it outside the flake.
- ssh_
public_ stringkey_ path - Absolute path to the deployment public key.
- bootstrap_
image string - Ubuntu or Debian bootstrap image; defaults to ubuntu-24.04.
- existing_
ssh_ list(string)key_ ids - Optional registered deployment SSH key IDs; omit to register a key.
- expected_
disk string - Expected whole disk; defaults to /dev/sda.
- expected_
disk_ stringserial - Optional externally verified disk serial.
- labels map(string)
- Public Hetzner server labels.
- location string
- Hetzner location code; defaults to nbg1.
- server_
type string - x86_64 CX, CPX or CCX plan; defaults to cpx22.
- ssh_
source_ list(string)ips - Allowed SSH sources; include the deployment runner. Defaults to public IPv4/IPv6.
- ssh_
timeout_ numberseconds - SSH readiness timeout in seconds, between 1 and 3600; defaults to 600.
- tcp_
ports list(number) - Additional inbound TCP ports. The NixOS firewall must also allow them.
- configuration String
- Attribute under nixosConfigurations, for example web.
- flake
Directory String - Absolute local directory containing the consumer flake and flake.lock.
- installer String
- Absolute local flake package reference or explicit pinned installer flake URL.
- ssh
Host StringKey Private Path - Absolute path to the separate Ed25519 server host private key.
- ssh
Private StringKey Path - Absolute path to the deployment private key; keep it outside the flake.
- ssh
Public StringKey Path - Absolute path to the deployment public key.
- bootstrap
Image String - Ubuntu or Debian bootstrap image; defaults to ubuntu-24.04.
- existing
Ssh List<String>Key Ids - Optional registered deployment SSH key IDs; omit to register a key.
- expected
Disk String - Expected whole disk; defaults to /dev/sda.
- expected
Disk StringSerial - Optional externally verified disk serial.
- labels Map<String,String>
- Public Hetzner server labels.
- location String
- Hetzner location code; defaults to nbg1.
- server
Type String - x86_64 CX, CPX or CCX plan; defaults to cpx22.
- ssh
Source List<String>Ips - Allowed SSH sources; include the deployment runner. Defaults to public IPv4/IPv6.
- ssh
Timeout IntegerSeconds - SSH readiness timeout in seconds, between 1 and 3600; defaults to 600.
- tcp
Ports List<Integer> - Additional inbound TCP ports. The NixOS firewall must also allow them.
- configuration string
- Attribute under nixosConfigurations, for example web.
- flake
Directory string - Absolute local directory containing the consumer flake and flake.lock.
- installer string
- Absolute local flake package reference or explicit pinned installer flake URL.
- ssh
Host stringKey Private Path - Absolute path to the separate Ed25519 server host private key.
- ssh
Private stringKey Path - Absolute path to the deployment private key; keep it outside the flake.
- ssh
Public stringKey Path - Absolute path to the deployment public key.
- bootstrap
Image string - Ubuntu or Debian bootstrap image; defaults to ubuntu-24.04.
- existing
Ssh string[]Key Ids - Optional registered deployment SSH key IDs; omit to register a key.
- expected
Disk string - Expected whole disk; defaults to /dev/sda.
- expected
Disk stringSerial - Optional externally verified disk serial.
- labels {[key: string]: string}
- Public Hetzner server labels.
- location string
- Hetzner location code; defaults to nbg1.
- server
Type string - x86_64 CX, CPX or CCX plan; defaults to cpx22.
- ssh
Source string[]Ips - Allowed SSH sources; include the deployment runner. Defaults to public IPv4/IPv6.
- ssh
Timeout numberSeconds - SSH readiness timeout in seconds, between 1 and 3600; defaults to 600.
- tcp
Ports number[] - Additional inbound TCP ports. The NixOS firewall must also allow them.
- configuration str
- Attribute under nixosConfigurations, for example web.
- flake_
directory str - Absolute local directory containing the consumer flake and flake.lock.
- installer str
- Absolute local flake package reference or explicit pinned installer flake URL.
- ssh_
host_ strkey_ private_ path - Absolute path to the separate Ed25519 server host private key.
- ssh_
private_ strkey_ path - Absolute path to the deployment private key; keep it outside the flake.
- ssh_
public_ strkey_ path - Absolute path to the deployment public key.
- bootstrap_
image str - Ubuntu or Debian bootstrap image; defaults to ubuntu-24.04.
- existing_
ssh_ Sequence[str]key_ ids - Optional registered deployment SSH key IDs; omit to register a key.
- expected_
disk str - Expected whole disk; defaults to /dev/sda.
- expected_
disk_ strserial - Optional externally verified disk serial.
- labels Mapping[str, str]
- Public Hetzner server labels.
- location str
- Hetzner location code; defaults to nbg1.
- server_
type str - x86_64 CX, CPX or CCX plan; defaults to cpx22.
- ssh_
source_ Sequence[str]ips - Allowed SSH sources; include the deployment runner. Defaults to public IPv4/IPv6.
- ssh_
timeout_ intseconds - SSH readiness timeout in seconds, between 1 and 3600; defaults to 600.
- tcp_
ports Sequence[int] - Additional inbound TCP ports. The NixOS firewall must also allow them.
- configuration String
- Attribute under nixosConfigurations, for example web.
- flake
Directory String - Absolute local directory containing the consumer flake and flake.lock.
- installer String
- Absolute local flake package reference or explicit pinned installer flake URL.
- ssh
Host StringKey Private Path - Absolute path to the separate Ed25519 server host private key.
- ssh
Private StringKey Path - Absolute path to the deployment private key; keep it outside the flake.
- ssh
Public StringKey Path - Absolute path to the deployment public key.
- bootstrap
Image String - Ubuntu or Debian bootstrap image; defaults to ubuntu-24.04.
- existing
Ssh List<String>Key Ids - Optional registered deployment SSH key IDs; omit to register a key.
- expected
Disk String - Expected whole disk; defaults to /dev/sda.
- expected
Disk StringSerial - Optional externally verified disk serial.
- labels Map<String>
- Public Hetzner server labels.
- location String
- Hetzner location code; defaults to nbg1.
- server
Type String - x86_64 CX, CPX or CCX plan; defaults to cpx22.
- ssh
Source List<String>Ips - Allowed SSH sources; include the deployment runner. Defaults to public IPv4/IPv6.
- ssh
Timeout NumberSeconds - SSH readiness timeout in seconds, between 1 and 3600; defaults to 600.
- tcp
Ports List<Number> - Additional inbound TCP ports. The NixOS firewall must also allow them.
Outputs
All input properties are implicitly available as output properties. Additionally, the NixosServer resource produces the following output properties:
Package Details
- Repository
- nixos-vps sgomezsal/nixos-vps
- License
- MIT
published on Thursday, Oct 29, 2026 by sgomezsal