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.
Examples:
In a flake, or other code that calls darwin.lib.darwinSystem
,
hci-effects.runNixDarwin {
ssh.destination = "jane.local";
config = self.darwinConfigurations."Janes-MacBook";
}
or without explicitly using the nix-darwin library,
hci-effects.runNixDarwin {
ssh.destination = "jane.local";
configuration = ./configuration.nix;
system = "x86_64-darwin";
nix-darwin = sources.nix-darwin;
nixpkgs = sources.nixpkgs;
}
Parameters
config
An evaluated configuration to deploy, such as returned by darwin.lib.darwinSystem
.
Unlike a module, such as can be passed to configuration
, a configuration contains all required option values, so that other parameters such as configuration
, nix-darwin
, nixpkgs
and system
can be omitted.
If needed, it is sufficient to only pass the config
attribute returned by darwin.lib.darwinSystem
.
This parameter is optional and mutually exclusive with configuration
and aforementioned other parameters.
configuration
Optional, mutually exclusive with config
.
The main configuration module; file path or module expression.
You can start out by copying ~/.nixpkgs/darwin-configuration.nix
into your
repo.
nixpkgs
Optional, mutually exclusive with config
.
Path of the Nixpkgs sources to use.
Default: pkgs.path
, where pkgs
is the Nixpkgs invocation that included the effects overlay.
This should match pkgs.path if both are set explicitly.
|
system
Optional, mutually exclusive with config
.
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.