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

nix.package

The nix package to use.

Type: null or package

Default:

null

Declared by:

nix.assumeXdg

Whether Home Manager should assume that Nix is configured to use XDG base directories. Note that this doesn’t change the behavior of Nix. To do that, set nix.settings.use-xdg-base-directories instead. This option is intended for settings in which use-xdg-base-directories is set globally or nix.conf is unmanaged by Home Manager.

Type: boolean

Default:

false

Declared by:

nix.buildMachines

This option lists the machines to be used if distributed builds are enabled (see nix.distributedBuilds). Nix will perform derivations on those machines via SSH by copying the inputs to the Nix store on the remote machine, starting the build, then copying the output back to the local Nix store.

Type: list of (submodule)

Default:

[ ]

Declared by:

nix.buildMachines.*.hostName

The hostname of the build machine.

Type: string

Example:

"nixbuilder.example.org"

Declared by:

nix.buildMachines.*.mandatoryFeatures

A list of features mandatory for this builder. The builder will be ignored for derivations that don’t require all features in this list. All mandatory features are automatically included in supportedFeatures.

Type: list of string

Default:

[ ]

Example:

[
  "big-parallel"
]

Declared by:

nix.buildMachines.*.maxJobs

The number of concurrent jobs the build machine supports. The build machine will enforce its own limits, but this allows hydra to schedule better since there is no work-stealing between build machines.

Type: signed integer

Default:

1

Declared by:

nix.buildMachines.*.protocol

The protocol used for communicating with the build machine. Use ssh-ng if your remote builder and your local Nix version support that improved protocol.

Use null when trying to change the special localhost builder without a protocol which is for example used by hydra.

Type: one of <null>, “ssh”, “ssh-ng”

Default:

"ssh"

Example:

"ssh-ng"

Declared by:

nix.buildMachines.*.publicHostKey

The (base64-encoded) public host key of this builder. The field is calculated via base64 -w0 /etc/ssh/ssh_host_type_key.pub. If null, SSH will use its regular known-hosts file when connecting.

Type: null or string

Default:

null

Declared by:

nix.buildMachines.*.speedFactor

The relative speed of this builder. This is an arbitrary integer that indicates the speed of this builder, relative to other builders. Higher is faster.

Type: signed integer

Default:

1

Declared by:

nix.buildMachines.*.sshKey

The path to the SSH private key with which to authenticate on the build machine. The private key must not have a passphrase. If null, the building user (root on NixOS machines) must have an appropriate ssh configuration to log in non-interactively.

Note that for security reasons, this path must point to a file in the local filesystem, not to the nix store.

Type: null or string

Default:

null

Example:

"/root/.ssh/id_buildhost_builduser"

Declared by:

nix.buildMachines.*.sshUser

The username to log in as on the remote host. This user must be able to log in and run nix commands non-interactively. It must also be privileged to build derivations, so must be included in nix.settings.trusted-users.

Type: null or string

Default:

null

Example:

"builder"

Declared by:

nix.buildMachines.*.supportedFeatures

A list of features supported by this builder. The builder will be ignored for derivations that require features not in this list.

Type: list of string

Default:

[ ]

Example:

[
  "kvm"
  "big-parallel"
]

Declared by:

nix.buildMachines.*.systems

The system types the build machine can execute derivations on.

Type: list of string

Default:

[ ]

Example:

[
  "x86_64-linux"
  "aarch64-linux"
]

Declared by:

nix.channels

A declarative alternative to Nix channels. Whereas with stock channels, you would register URLs and fetch them into the Nix store with nix-channel(1), this option allows you to register the store path directly. One particularly useful example is registering flake inputs as channels.

This option can coexist with stock Nix channels. If the same channel is defined in both, this option takes precedence.

Type: attribute set of package

Default:

{ }

Example:

{ inherit nixpkgs; }

Declared by:

nix.checkConfig

If enabled (the default), checks for data type mismatches and that Nix can parse the generated nix.conf.

Type: boolean

Default:

true

Declared by:

nix.distributedBuilds

Whether to distribute builds to the machines listed in nix.buildMachines.

Type: boolean

Default:

false

Declared by:

nix.extraOptions

Additional text appended to nix.conf.

Type: strings concatenated with “\n”

Default:

""

Example:

''
  keep-outputs = true
  keep-derivations = true
''

Declared by:

nix.gc.automatic

Automatically run the garbage collector at a specific time.

Note: This will only garbage collect the current user’s profiles.

Type: boolean

Default:

false

Declared by:

nix.gc.dates

When to run the Nix garbage collector.

On Linux this is a string as defined by systemd.time(7).

On Darwin, it must be one of: hourly, daily, weekly, monthly, semiannually, annually, which are implemented as defined in systemd.time(7).

Type: (optionally newline-terminated) single-line string or list of string

Default:

"weekly"

Example:

"03:15"

Declared by:

nix.gc.options

Options given to nix-collect-garbage when the garbage collector is run automatically.

Type: null or string

Default:

null

Example:

"--max-freed $((64 * 1024**3))"

Declared by:

nix.gc.persistent

If true, the time when the service unit was last triggered is stored on disk. When the timer is activated, the service unit is triggered immediately if it would have been triggered at least once during the time when the timer was inactive.

Type: boolean

Default:

true

Example:

false

Declared by:

nix.gc.randomizedDelaySec

Add a randomized delay before each garbage collection. The delay will be chosen between zero and this value. This value must be a time span in the format specified by systemd.time(7)

Type: (optionally newline-terminated) single-line string

Default:

"0"

Example:

"45min"

Declared by:

nix.keepOldNixPath

Whether nix.nixPath should keep the previously set values in NIX_PATH.

Type: boolean

Default:

true

Example:

false

Declared by:

nix.nixPath

Adds new directories to the Nix expression search path.

Used by Nix when looking up paths in angular brackets (e.g. <nixpkgs>).

Type: list of string

Default:

[ ]

Example:

[
  "$HOME/.nix-defexpr/channels"
  "darwin-config=$HOME/.config/nixpkgs/darwin-configuration.nix"
]

Declared by:

nix.registry

User level flake registry.

Type: attribute set of (submodule)

Default:

{ }

Declared by:

nix.registry.<name>.exact

Whether the from reference needs to match exactly. If set, a from reference like nixpkgs does not match with a reference like nixpkgs/nixos-20.03.

Type: boolean

Default:

true

Declared by:

nix.registry.<name>.flake

The flake input to which from> is to be rewritten.

Type: null or (attribute set)

Default:

null

Example:

nixpkgs

Declared by:

nix.registry.<name>.from

The flake reference to be rewritten.

Type: attribute set of (string or signed integer or boolean or package)

Default:

{ }

Example:

{
  id = "nixpkgs";
  type = "indirect";
}

Declared by:

nix.registry.<name>.to

The flake reference to which from> is to be rewritten.

Type: attribute set of (string or signed integer or boolean or package)

Default:

{ }

Example:

{
  owner = "my-org";
  repo = "my-nixpkgs";
  type = "github";
}

Declared by:

nix.settings

Configuration for Nix; see nix.conf(5) for available options. The value declared here will be translated directly to the key-value pairs Nix expects.

Configuration specified in will be appended verbatim to the resulting config file.

Type: open submodule of attribute set of (Nix config atom (null, bool, int, float, str, path or package) or list of (Nix config atom (null, bool, int, float, str, path or package)))

Default:

{ }

Example:

{
  sandbox = true;
  show-trace = true;
  system-features = [
    "big-parallel"
    "kvm"
    "recursive-nix"
  ];
}

Declared by: