diff options
Diffstat (limited to 'pkgs/top-level/impure.nix')
-rw-r--r-- | pkgs/top-level/impure.nix | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix new file mode 100644 index 00000000000..e9066815927 --- /dev/null +++ b/pkgs/top-level/impure.nix @@ -0,0 +1,24 @@ +/* Impure default args for `pkgs/top-level/default.nix`. See that file + for the meaning of each argument. */ + +{ # Fallback: Assume we are building packages for the current (host, in GNU + # Autotools parlance) system. + system ? builtins.currentSystem + +, # Fallback: The contents of the configuration file found at $NIXPKGS_CONFIG or + # $HOME/.nixpkgs/config.nix. + config ? let + inherit (builtins) getEnv pathExists; + + configFile = getEnv "NIXPKGS_CONFIG"; + homeDir = getEnv "HOME"; + configFile2 = homeDir + "/.nixpkgs/config.nix"; + in + if configFile != "" && pathExists configFile then import configFile + else if homeDir != "" && pathExists configFile2 then import configFile2 + else {} + +, ... +} @ args: + +import ./. (args // { inherit system config; }) |