diff --git a/modules/environment/default.nix b/modules/environment/default.nix
index 3ab07564..6d77cd63 100644
--- a/modules/environment/default.nix
+++ b/modules/environment/default.nix
@@ -63,6 +63,19 @@ in {
description = "List of directories to be symlinked in /run/current-system/sw.";
};
+ 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 darwin-rebuild switch -I darwin-config=/path/to/configuration.nix
+ the first time to make darwin-rebuild aware of the custom location.
+ '';
+ };
+
environment.loginShell = mkOption {
type = types.str;
default = "$SHELL";
diff --git a/modules/nix/default.nix b/modules/nix/default.nix
index 082649dd..79ae41ab 100644
--- a/modules/nix/default.nix
+++ b/modules/nix/default.nix
@@ -314,7 +314,7 @@ in
type = types.listOf types.str;
default =
[ # Include default path .
- "darwin-config=$HOME/.nixpkgs/darwin-configuration.nix"
+ "darwin-config=${config.environment.darwinConfig}"
"/nix/var/nix/profiles/per-user/root/channels"
"$HOME/.nix-defexpr/channels"
];