Add an option ‘nix.nixPath’ for specifying $NIX_PATH

This commit is contained in:
Eelco Dolstra 2015-08-05 12:03:19 +02:00
parent 525c901ce9
commit 3f1354a3cd
2 changed files with 18 additions and 10 deletions

View File

@ -23,15 +23,6 @@ in
EDITOR = mkDefault "nano";
};
environment.sessionVariables =
{ NIX_PATH =
[ "/nix/var/nix/profiles/per-user/root/channels/nixos"
"nixpkgs=/etc/nixos/nixpkgs"
"nixos-config=/etc/nixos/configuration.nix"
"/nix/var/nix/profiles/per-user/root/channels"
];
};
environment.profiles =
[ "$HOME/.nix-profile"
"/nix/var/nix/profiles/default"

View File

@ -309,6 +309,21 @@ in
'';
};
nixPath = mkOption {
type = types.listOf types.str;
default =
[ "/nix/var/nix/profiles/per-user/root/channels/nixos"
"nixpkgs=/etc/nixos/nixpkgs"
"nixos-config=/etc/nixos/configuration.nix"
"/nix/var/nix/profiles/per-user/root/channels"
];
description = ''
The default Nix expression search path, used by the Nix
evaluator to look up paths enclosed in angle brackets
(e.g. <literal>&lt;nixpkgs&gt;</literal>).
'';
};
};
};
@ -378,7 +393,9 @@ in
};
# Set up the environment variables for running Nix.
environment.sessionVariables = cfg.envVars;
environment.sessionVariables = cfg.envVars //
{ NIX_PATH = concatStringsSep ":" cfg.nixPath;
};
environment.extraInit =
''