Hello NixOS!

2024-11-12

NixOS templates are now available for new compute instances.

Hello NixOS!

NixOS is a Linux-based operating system based on the immutable package manager Nix. It allows for a declarative approach to system configuration and easy system reproducibility. There’s also built-in rollback capability for switching between configurations.

Configure your new instance by editing /etc/nixos/configuration.nix, such as adding a new package or configuring the hostname:

$ cat /etc/nixos/configuration.nix
{ config, lib, pkgs, ... }:

{
imports = [
./hardware-configuration.nix
];

boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";

services.openssh.enable = true;

system.stateVersion = "24.05";
}

Perform the upgrade:

$ nixos-rebuild switch
building Nix...
building the system configuration...
updating GRUB 2 menu...
activating the configuration...
[...]

Firstboot scripts aren’t available yet for NixOS templates–instead, we’d like provide a way for users to supply an initial configuration.nix themselves to be applied on first boot. Truly immutable infrastructure. We are testing this approach now. Stay tuned.

Try it out, and let us know what you think.

Go back to the list of blog entries. RSS feed.