1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

environment: add darwinConfig option to set darwin-config in NIX_PATH

This simplifies using a non default configuration.nix without requiring
a symlink or redefining NIX_PATH.

The nix.nixPath option only defines a default which means defining a value
will drop all of the defaults. This is because correct merge behaviour
isn't very clear for named entries.
This commit is contained in:
Daiderd Jordan 2018-08-26 14:09:01 +02:00
parent 483a906c90
commit f473b21c9f
No known key found for this signature in database
GPG key ID: D02435D05B810C96
2 changed files with 14 additions and 1 deletions

View file

@ -63,6 +63,19 @@ in {
description = "List of directories to be symlinked in <filename>/run/current-system/sw</filename>.";
};
environment.darwinConfig = mkOption {
type = types.either types.path types.str;
default = "$HOME/.nixpkgs/darwin-configuration.nix";
description = ''
The path of the darwin configuration.nix used to configure the system,
this updates the default darwin-config entry in NIX_PATH. Since this
changes an environment variable it will only apply to new shells.
NOTE: Changing this requires running <command>darwin-rebuild switch -I darwin-config=/path/to/configuration.nix</command>
the first time to make darwin-rebuild aware of the custom location.
'';
};
environment.loginShell = mkOption {
type = types.str;
default = "$SHELL";

View file

@ -314,7 +314,7 @@ in
type = types.listOf types.str;
default =
[ # Include default path <darwin-config>.
"darwin-config=$HOME/.nixpkgs/darwin-configuration.nix"
"darwin-config=${config.environment.darwinConfig}"
"/nix/var/nix/profiles/per-user/root/channels"
"$HOME/.nix-defexpr/channels"
];