From 054327729cfe043587f4a0cff86fb4f5f5f20ec5 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 15:14:57 +0000 Subject: [PATCH] Move stdenvDefault into its own file. --- pkgs/top-level/all-packages.nix | 38 ++++++--------------------------- pkgs/top-level/stdenv.nix | 31 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 32 deletions(-) create mode 100644 pkgs/top-level/stdenv.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a0bae697db2..f0bb6a7ee7b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -83,6 +83,11 @@ let platform = if platform_ != null then platform_ else config.platform or platformAuto; + topLevelArguments = { + inherit system bootStdenv noSysDirs gccWithCC gccWithProfiling config + crossSystem platform lib; + }; + # Allow packages to be overriden globally via the `packageOverrides' # configuration option, which must be a function that takes `pkgs' # as an argument and returns a set of new or overriden packages. @@ -130,38 +135,7 @@ let stdenvAdapters = import ../stdenv/adapters.nix pkgs; - stdenvDefault = with pkgs; with stdenvDefault; { - - - ### STANDARD ENVIRONMENT - - - allStdenvs = import ../stdenv { - inherit system platform config lib; - allPackages = args: import ./../.. ({ inherit config system; } // args); - }; - - defaultStdenv = allStdenvs.stdenv // { inherit platform; }; - - stdenv = - if bootStdenv != null then (bootStdenv // {inherit platform;}) else - if crossSystem != null then - stdenvCross - else - let - changer = config.replaceStdenv or null; - in if changer != null then - changer { - # We import again all-packages to avoid recursivities. - pkgs = import ./../.. { - # We remove packageOverrides to avoid recursivities - config = removeAttrs config [ "replaceStdenv" ]; - }; - } - else - defaultStdenv; - -}; + stdenvDefault = (import ./stdenv.nix topLevelArguments) {} pkgs; self = with pkgs; { diff --git a/pkgs/top-level/stdenv.nix b/pkgs/top-level/stdenv.nix new file mode 100644 index 00000000000..aeb36b8edc3 --- /dev/null +++ b/pkgs/top-level/stdenv.nix @@ -0,0 +1,31 @@ +{ system, bootStdenv, crossSystem, config, platform, lib, ... }: +self: super: + +with super; + +rec { + allStdenvs = import ../stdenv { + inherit system platform config lib; + allPackages = args: import ./../.. ({ inherit config system; } // args); + }; + + defaultStdenv = allStdenvs.stdenv // { inherit platform; }; + + stdenv = + if bootStdenv != null then (bootStdenv // {inherit platform;}) else + if crossSystem != null then + stdenvCross + else + let + changer = config.replaceStdenv or null; + in if changer != null then + changer { + # We import again all-packages to avoid recursivities. + pkgs = import ./../.. { + # We remove packageOverrides to avoid recursivities + config = removeAttrs config [ "replaceStdenv" ]; + }; + } + else + defaultStdenv; +}