summaryrefslogtreecommitdiffstats
path: root/pkgs/top-level/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/top-level/default.nix')
-rw-r--r--pkgs/top-level/default.nix24
1 files changed, 10 insertions, 14 deletions
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix
index dfa68ba31b84..10cf36d4d13e 100644
--- a/pkgs/top-level/default.nix
+++ b/pkgs/top-level/default.nix
@@ -1,9 +1,8 @@
/* This function composes the Nix Packages collection. It:
- 1. Applies the final stage to the given `config` if it is a function
+ 1. Elaborates `localSystem` and `crossSystem` with defaults as needed.
- 2. Infers an appropriate `platform` based on the `system` if none is
- provided
+ 2. Applies the final stage to the given `config` if it is a function
3. Defaults to no non-standard config and no cross-compilation target
@@ -50,6 +49,14 @@ let # Rename the function arguments
in let
lib = import ../../lib;
+ localSystem = lib.systems.elaborate args.localSystem;
+
+ # Condition preserves sharing which in turn affects equality.
+ crossSystem =
+ if crossSystem0 == null || crossSystem0 == args.localSystem
+ then localSystem
+ else lib.systems.elaborate crossSystem0;
+
# Allow both:
# { /* the config */ } and
# { pkgs, ... } : { /* the config */ }
@@ -58,17 +65,6 @@ in let
then config0 { inherit pkgs; }
else config0;
- # From a minimum of `system` or `config` (actually a target triple, *not*
- # nixpkgs configuration), infer the other one and platform as needed.
- localSystem = lib.systems.elaborate (if builtins.isAttrs args.localSystem then (
- # Allow setting the platform in the config file. This take precedence over
- # the inferred platform, but not over an explicitly passed-in one.
- builtins.intersectAttrs { platform = null; } config1
- // args.localSystem) else args.localSystem);
-
- crossSystem = if crossSystem0 == null then localSystem
- else lib.systems.elaborate crossSystem0;
-
configEval = lib.evalModules {
modules = [
./config.nix