summary refs log tree commit diff
path: root/pkgs/stdenv/generic/default.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-04 23:31:08 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-05 00:06:10 +0100
commita2cbc77e4f1cf55a9c142d07377f67b0f83985ec (patch)
tree81934d578f6fd86d09443bdc9b3ce2c0cd42aeef /pkgs/stdenv/generic/default.nix
parent8867304b5e8bab1741b5b32d7a503d58fccf055e (diff)
downloadnixpkgs-a2cbc77e4f1cf55a9c142d07377f67b0f83985ec.tar
nixpkgs-a2cbc77e4f1cf55a9c142d07377f67b0f83985ec.tar.gz
nixpkgs-a2cbc77e4f1cf55a9c142d07377f67b0f83985ec.tar.bz2
nixpkgs-a2cbc77e4f1cf55a9c142d07377f67b0f83985ec.tar.lz
nixpkgs-a2cbc77e4f1cf55a9c142d07377f67b0f83985ec.tar.xz
nixpkgs-a2cbc77e4f1cf55a9c142d07377f67b0f83985ec.tar.zst
nixpkgs-a2cbc77e4f1cf55a9c142d07377f67b0f83985ec.zip
Only show/build a package on the platforms listed in meta.platforms
The function ‘mkDerivation’ now checks whether the current platform
type is included in a package's meta.platform field.  If not, it
throws an exception:

  $ nix-build -A linux --argstr system x86_64-darwin
  error: user-thrown exception: the package ‘linux-3.10.15’ is not supported on ‘x86_64-darwin’

These packages also no longer show up in ‘nix-env -qa’ output.  This
means, for instance, that the number of packages shown on
x86_64-freebsd has dropped from 9268 to 4764.

Since meta.platforms was also used to prevent Hydra from building some
packages, there now is a new attribute meta.hydraPlatforms listing the
platforms on which Hydra should build the package (which defaults to
meta.platforms).
Diffstat (limited to 'pkgs/stdenv/generic/default.nix')
-rw-r--r--pkgs/stdenv/generic/default.nix2
1 files changed, 2 insertions, 0 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index 083a71548b9..fcd7439e97e 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -55,6 +55,8 @@ let
             throw "package ‘${attrs.name}’ has an unfree license, refusing to evaluate"
           else if !allowBroken && attrs.meta.broken or false then
             throw "you can't use package ‘${attrs.name}’ 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}’ is not supported on ‘${result.system}’"
           else
             lib.addPassthru (derivation (
               (removeAttrs attrs ["meta" "passthru" "crossAttrs"])