diff options
author | Peter Simons <simons@cryp.to> | 2013-12-04 18:33:45 +0100 |
---|---|---|
committer | Peter Simons <simons@cryp.to> | 2013-12-04 18:33:52 +0100 |
commit | c32bf83301bc4063df924ee442d8e35c1b96d912 (patch) | |
tree | 5a0821f9960cfa2508fc6b451fbaf8bfa6326367 /pkgs/stdenv | |
parent | 88c7b4c7fee42c1ae5167fd1e7806d600e4451e4 (diff) | |
parent | 41f0e6ad9203a1859996e53323321a758c1fc7c4 (diff) | |
download | nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar.gz nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar.bz2 nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar.lz nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar.xz nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar.zst nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.zip |
Merge remote-tracking branch 'origin/master' into stdenv-updates.
Conflicts: pkgs/development/interpreters/perl/5.16/default.nix pkgs/tools/networking/curl/default.nix pkgs/top-level/all-packages.nix pkgs/top-level/release-python.nix pkgs/top-level/release-small.nix pkgs/top-level/release.nix
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/default.nix | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 638602920118..4a36327810b0 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -18,6 +18,10 @@ let allowUnfree = config.allowUnfree or true && builtins.getEnv "HYDRA_DISALLOW_UNFREE" != "1"; + allowBroken = builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1"; + + unsafeGetAttrPos = builtins.unsafeGetAttrPos or (n: as: null); + stdenvGenerator = setupScript: rec { # The stdenv that we are producing. @@ -49,8 +53,20 @@ let # Add a utility function to produce derivations that use this # stdenv and its shell. mkDerivation = attrs: + let + pos = + if attrs.meta.description or null != null then + unsafeGetAttrPos "description" attrs.meta + else + unsafeGetAttrPos "name" attrs; + pos' = if pos != null then "‘" + pos.file + ":" + toString pos.line + "’" else "«unknown-file»"; + in if !allowUnfree && (let l = lib.lists.toList attrs.meta.license or []; in lib.lists.elem "unfree" l || lib.lists.elem "unfree-redistributable" l) then - throw "package ‘${attrs.name}’ has an unfree license, refusing to evaluate" + throw "package ‘${attrs.name}’ in ${pos'} has an unfree license, refusing to evaluate" + else if !allowBroken && attrs.meta.broken or false then + throw "you can't use package ‘${attrs.name}’ in ${pos'} because it has been marked as broken" + else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem result.system attrs.meta.platforms then + throw "the package ‘${attrs.name}’ in ${pos'} is not supported on ‘${result.system}’" else lib.addPassthru (derivation ( (removeAttrs attrs ["meta" "passthru" "crossAttrs"]) @@ -83,8 +99,11 @@ let # but it's not part of the actual derivation, i.e., it's not # passed to the builder and is not a dependency. But since we # include it in the result, it *is* available to nix-env for - # queries. - meta = attrs.meta or {}; + # queries. We also a meta.position attribute here to + # identify the source location of the package. + meta = attrs.meta or {} // (if pos != null then { + position = pos.file + ":" + (toString pos.line); + } else {}); passthru = attrs.passthru or {}; } // # Pass through extra attributes that are not inputs, but |