forked from mirrors/nixpkgs
Separate fix-point from config importing hacks and other impurities
This commit is contained in:
parent
18a91ddfb6
commit
4af2bf6663
|
@ -6,4 +6,4 @@ if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.
|
|||
|
||||
else
|
||||
|
||||
import ./pkgs/top-level
|
||||
import ./pkgs/top-level/impure.nix
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
|
||||
{ # The system (e.g., `i686-linux') for which to build the packages.
|
||||
system ? builtins.currentSystem
|
||||
system
|
||||
|
||||
, # The standard environment to use. Only used for bootstrapping. If
|
||||
# null, the default standard environment is used.
|
||||
|
@ -19,21 +19,8 @@
|
|||
&& system != "x86_64-solaris"
|
||||
&& system != "x86_64-kfreebsd-gnu")
|
||||
|
||||
, # Allow a configuration attribute set to be passed in as an
|
||||
# argument. Otherwise, it's read from $NIXPKGS_CONFIG or
|
||||
# ~/.nixpkgs/config.nix.
|
||||
#
|
||||
# [For NixOS (nixos-rebuild), use nixpkgs.config option to set.]
|
||||
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 {}
|
||||
, # Allow a configuration attribute set to be passed in as an argument.
|
||||
config ? {}
|
||||
|
||||
, crossSystem ? null
|
||||
, platform ? null
|
||||
|
|
24
pkgs/top-level/impure.nix
Normal file
24
pkgs/top-level/impure.nix
Normal file
|
@ -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; })
|
Loading…
Reference in a new issue