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";
configuration = 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
buildOnDestination
Default: value of ssh.buildOnDestination
, which defaults to false
.
Overrides ssh.buildOnDestination
. Defer builds to the destination host instead of pre-building in CI.
config
Legacy parameter. Use configuration
instead.
configuration
Either
- An evaluated configuration to deploy, such as returned by darwin.lib.darwinSystem
.
- A module (path or module expression) assuming you also pass nix-darwin
and nixpkgs
or pkgs
.
nixpkgs
Optional. Pass only when configuration
is a module (path or module expression).
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.
|
pkgs
Optional. Pass only when configuration
is a module (path or module expression).
An evaluated Nixpkgs invocation to use.
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 --file ci.nix
nix-repl> my-host.prebuilt.config.services.postgresql.enable
false
prebuilt
A derivation representing the built system configuration.