runNixDarwin

runNixDarwin :: AttrSet → Effect

Deploys a nix-darwin configuration, to maintain a macOS machine.

Use the nix-darwin installer first, then base the configuration off the generated ~/.nixpkgs/darwin-configuration.nix.

Parameters

configuration

The main configuration module; file path or module expression.

You can start out by copying ~/.nixpkgs/darwin-configuration.nix into your repo.

nix-darwin

Path of the nix-darwin sources to use.

nixpkgs

Path of the Nixpkgs sources to use.

Default: pkgs.path, where pkgs is the Nixpkgs invocation that included the effects overlay.

secretsMap

Example:

    secretsMap.ssh = "myuser-ssh";

ssh

See the named arguments in ssh. Example:

  ssh.destination = "root@example.com";

system

The Nix system of the machine to deploy.

Example: x86_64-darwin

Example: aarch64-darwin

userSetupScript

Example:

    userSetupScript = ''
      writeSSHKey
      cat >>~/.ssh/known_hosts <<EOF
      203.0.113.2 ecdsa-sha2-nistp256 AA.....pw=
      EOF
    '';

See:

…​ — remaining arguments

Other attributes are passed to mkEffect, which passes its remaining arguments to mkDerivation.

Return value

An effect that switches the nix-darwin system as configured.

The effect has the following attributes in addition to the attributes returned by mkEffect.

config

The config parameter of the module system. This can be used to inspect the system configuration before committing it. For example:

nix repl ci.nix
nix-repl> my-host.prebuilt.config.services.postgresql.enable
false

prebuilt

A derivation representing the built system configuration.

prebuilt.config

Same as config.

See also