Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Nodes

Definition

{
  nodes.myMachine = {
    system = "x86_64-linux";
    base.enable = true;
    base.hostName = "my-machine";
  };
}

Fields

system (required)

Target system: "x86_64-linux", "aarch64-linux", "aarch64-darwin", "x86_64-darwin"

target

Override inferred target. Usually automatic:

  • *-darwin"darwin"
  • *-linux"nixos"

Set explicitly for Home Manager:

nodes."user@host" = {
  system = "x86_64-linux";
  target = "home";
  # ...
};

extraModules

Additional NixOS/Darwin/HM modules:

nodes.server = {
  # ...
  extraModules = [
    { services.openssh.enable = true; }
    ./hardware-configuration.nix
  ];
};

instantiate

Custom builder function:

nodes.stable-server = {
  system = "x86_64-linux";
  instantiate = { system, modules, specialArgs }:
    inputs.nixpkgs-stable.lib.nixosSystem {
      inherit system modules specialArgs;
    };
  # ...
};

Module Options

Enable modules and set options:

nodes.desktop = {
  system = "x86_64-linux";
  
  base.enable = true;
  base.hostName = "desktop";
  base.timeZone = "America/New_York";
  
  gui.enable = true;
  gui.driver = "nvidia";
};

Setting options without enable = true throws an error.