···1/* This function composes the Nix Packages collection. It:
23- 1. Applies the final stage to the given `config` if it is a function
45- 2. Infers an appropriate `platform` based on the `system` if none is
6- provided
78 3. Defaults to no non-standard config and no cross-compilation target
9···50in let
51 lib = import ../../lib;
520000000053 # Allow both:
54 # { /* the config */ } and
55 # { pkgs, ... } : { /* the config */ }
···57 if lib.isFunction config0
58 then config0 { inherit pkgs; }
59 else config0;
60-61- # From a minimum of `system` or `config` (actually a target triple, *not*
62- # nixpkgs configuration), infer the other one and platform as needed.
63- localSystem = lib.systems.elaborate (if builtins.isAttrs args.localSystem then (
64- # Allow setting the platform in the config file. This take precedence over
65- # the inferred platform, but not over an explicitly passed-in one.
66- builtins.intersectAttrs { platform = null; } config1
67- // args.localSystem) else args.localSystem);
68-69- crossSystem = if crossSystem0 == null then localSystem
70- else lib.systems.elaborate crossSystem0;
7172 configEval = lib.evalModules {
73 modules = [
···1/* This function composes the Nix Packages collection. It:
23+ 1. Elaborates `localSystem` and `crossSystem` with defaults as needed.
45+ 2. Applies the final stage to the given `config` if it is a function
067 3. Defaults to no non-standard config and no cross-compilation target
8···49in let
50 lib = import ../../lib;
5152+ localSystem = lib.systems.elaborate args.localSystem;
53+54+ # Condition preserves sharing which in turn affects equality.
55+ crossSystem =
56+ if crossSystem0 == null || crossSystem0 == args.localSystem
57+ then localSystem
58+ else lib.systems.elaborate crossSystem0;
59+60 # Allow both:
61 # { /* the config */ } and
62 # { pkgs, ... } : { /* the config */ }
···64 if lib.isFunction config0
65 then config0 { inherit pkgs; }
66 else config0;
000000000006768 configEval = lib.evalModules {
69 modules = [
+14-20
pkgs/top-level/impure.nix
···1213in
1415-{ # We combine legacy `system` and `platform` into `localSystem`, if
16- # `localSystem` was not passed. Strictly speaking, this is pure desugar, but
17- # it is most convient to do so before the impure `localSystem.system` default,
18- # so we do it now.
19- localSystem ? builtins.intersectAttrs { system = null; platform = null; } args
2021-, # These are needed only because nix's `--arg` command-line logic doesn't work
22- # with unnamed parameters allowed by ...
23- system ? localSystem.system
24-, platform ? localSystem.platform
25-, crossSystem ? null
2627, # Fallback: The contents of the configuration file found at $NIXPKGS_CONFIG or
28 # $HOME/.config/nixpkgs/config.nix.
···77, ...
78} @ args:
7980-# If `localSystem` was explicitly passed, legacy `system` and `platform` should
81-# not be passed.
82-assert args ? localSystem -> !(args ? system || args ? platform);
08384-import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
85- inherit config overlays crossSystem crossOverlays;
86- # Fallback: Assume we are building packages on the current (build, in GNU
87- # Autotools parlance) system.
88- localSystem = if builtins.isString localSystem then localSystem
89- else (if args ? localSystem then {}
90- else { system = builtins.currentSystem; }) // localSystem;
91})
···1213in
1415+{ # We put legacy `system` into `localSystem`, if `localSystem` was not passed.
16+ # If neither is passed, assume we are building packages on the current
17+ # (build, in GNU Autotools parlance) platform.
18+ localSystem ? { system = args.system or builtins.currentSystem; }
01920+# 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
02425, # Fallback: The contents of the configuration file found at $NIXPKGS_CONFIG or
26 # $HOME/.config/nixpkgs/config.nix.
···75, ...
76} @ args:
7778+# If `localSystem` was explicitly passed, legacy `system` should
79+# not be passed, and vice-versa.
80+assert args ? localSystem -> !(args ? system);
81+assert args ? system -> !(args ? localSystem);
8283+import ./. (builtins.removeAttrs args [ "system" ] // {
84+ inherit config overlays localSystem;
0000085})