Separate fix-point from config importing hacks and other impurities

Changed files
+28 -17
pkgs
+1 -1
default.nix
··· 6 6 7 7 else 8 8 9 - import ./pkgs/top-level 9 + import ./pkgs/top-level/impure.nix
+3 -16
pkgs/top-level/default.nix
··· 6 6 7 7 8 8 { # The system (e.g., `i686-linux') for which to build the packages. 9 - system ? builtins.currentSystem 9 + system 10 10 11 11 , # The standard environment to use. Only used for bootstrapping. If 12 12 # null, the default standard environment is used. ··· 19 19 && system != "x86_64-solaris" 20 20 && system != "x86_64-kfreebsd-gnu") 21 21 22 - , # Allow a configuration attribute set to be passed in as an 23 - # argument. Otherwise, it's read from $NIXPKGS_CONFIG or 24 - # ~/.nixpkgs/config.nix. 25 - # 26 - # [For NixOS (nixos-rebuild), use nixpkgs.config option to set.] 27 - config ? let 28 - inherit (builtins) getEnv pathExists; 29 - 30 - configFile = getEnv "NIXPKGS_CONFIG"; 31 - homeDir = getEnv "HOME"; 32 - configFile2 = homeDir + "/.nixpkgs/config.nix"; 33 - in 34 - if configFile != "" && pathExists configFile then import configFile 35 - else if homeDir != "" && pathExists configFile2 then import configFile2 36 - else {} 22 + , # Allow a configuration attribute set to be passed in as an argument. 23 + config ? {} 37 24 38 25 , crossSystem ? null 39 26 , platform ? null
+24
pkgs/top-level/impure.nix
··· 1 + /* Impure default args for `pkgs/top-level/default.nix`. See that file 2 + for the meaning of each argument. */ 3 + 4 + { # Fallback: Assume we are building packages for the current (host, in GNU 5 + # Autotools parlance) system. 6 + system ? builtins.currentSystem 7 + 8 + , # Fallback: The contents of the configuration file found at $NIXPKGS_CONFIG or 9 + # $HOME/.nixpkgs/config.nix. 10 + config ? let 11 + inherit (builtins) getEnv pathExists; 12 + 13 + configFile = getEnv "NIXPKGS_CONFIG"; 14 + homeDir = getEnv "HOME"; 15 + configFile2 = homeDir + "/.nixpkgs/config.nix"; 16 + in 17 + if configFile != "" && pathExists configFile then import configFile 18 + else if homeDir != "" && pathExists configFile2 then import configFile2 19 + else {} 20 + 21 + , ... 22 + } @ args: 23 + 24 + import ./. (args // { inherit system config; })