about summary refs log tree commit diff
path: root/pkgs/top-level/impure.nix
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2019-11-03 17:40:43 +0000
committerGitHub <noreply@github.com>2019-11-03 17:40:43 +0000
commit71184f8e157672789602d3f28bdd3c8079800687 (patch)
treee5edbe7780c58167826c3ab0e6406ef145ba7111 /pkgs/top-level/impure.nix
parent59edabf8ca74bc8a86f03cabad79bf5a6e272d0a (diff)
stdenv/check-meta: getEnv if the attribute is unset (#72376)
There were two issues:

* builtins.getEnv was called deep into the nixpkgs tree making it hard
  to discover. This is solved by moving the call into
  pkgs/top-level/impure.nix
* when the config was explicitly set by the user to false, it would
  still try and load the environment variable. This meant that it was
  not possible to guarantee the same outcome on two different systems.
Diffstat (limited to 'pkgs/top-level/impure.nix')
-rw-r--r--pkgs/top-level/impure.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix
index 3ba6c08a140b2..9ed31077172a5 100644
--- a/pkgs/top-level/impure.nix
+++ b/pkgs/top-level/impure.nix
@@ -10,6 +10,14 @@ let
   # Return ‘x’ if it evaluates, or ‘def’ if it throws an exception.
   try = x: def: let res = tryEval x; in if res.success then res.value else def;
 
+  defaultConfig = {
+    # These attributes are used in pkgs/stdenv/generic/check-meta.nix
+    allowBroken = builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
+    allowInsecure = builtins.getEnv "NIXPKGS_ALLOW_INSECURE" == "1";
+    allowUnfree = builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1";
+    allowUnsupportedSystem = builtins.getEnv "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM" == "1";
+  };
+
 in
 
 { # We combine legacy `system` and `platform` into `localSystem`, if
@@ -82,7 +90,10 @@ in
 assert args ? localSystem -> !(args ? system || args ? platform);
 
 import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
-  inherit config overlays crossSystem crossOverlays;
+  inherit overlays crossSystem crossOverlays;
+
+  config = defaultConfig // config;
+
   # Fallback: Assume we are building packages on the current (build, in GNU
   # Autotools parlance) system.
   localSystem = if builtins.isString localSystem then localSystem