1/* 2 Impure default args for `pkgs/top-level/default.nix`. See that file 3 for the meaning of each argument. 4*/ 5 6let 7 8 homeDir = builtins.getEnv "HOME"; 9 10in 11 12{ 13 # We put legacy `system` into `localSystem`, if `localSystem` was not passed. 14 # If neither is passed, assume we are building packages on the current 15 # (build, in GNU Autotools parlance) platform. 16 localSystem ? { 17 system = args.system or builtins.currentSystem; 18 }, 19 20 # These are needed only because nix's `--arg` command-line logic doesn't work 21 # with unnamed parameters allowed by ... 22 system ? localSystem.system, 23 crossSystem ? localSystem, 24 25 # Fallback: The contents of the configuration file found at $NIXPKGS_CONFIG or 26 # $HOME/.config/nixpkgs/config.nix. 27 config ? 28 let 29 configFile = builtins.getEnv "NIXPKGS_CONFIG"; 30 configFile2 = homeDir + "/.config/nixpkgs/config.nix"; 31 configFile3 = homeDir + "/.nixpkgs/config.nix"; # obsolete 32 in 33 if configFile != "" && builtins.pathExists configFile then 34 import configFile 35 else if homeDir != "" && builtins.pathExists configFile2 then 36 import configFile2 37 else if homeDir != "" && builtins.pathExists configFile3 then 38 import configFile3 39 else 40 { }, 41 42 # Overlays are used to extend Nixpkgs collection with additional 43 # collections of packages. These collection of packages are part of the 44 # fix-point made by Nixpkgs. 45 overlays ? import ./impure-overlays.nix, 46 47 crossOverlays ? [ ], 48 49 ... 50}@args: 51 52# If `localSystem` was explicitly passed, legacy `system` should 53# not be passed, and vice-versa. 54assert args ? localSystem -> !(args ? system); 55assert args ? system -> !(args ? localSystem); 56 57import ./. ( 58 builtins.removeAttrs args [ "system" ] 59 // { 60 inherit config overlays localSystem; 61 } 62)