From fca769846a4ba4f517f7c60bb1e4cec31c7e38dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sat, 27 Feb 2010 17:35:42 +0000 Subject: [PATCH] Adding a new special attribute for mkDerivation: crossAttrs. It sits next to "meta" and "passthru", and these attributes will be appended to the usual mkDerivation attributes only if the package is cross built. This allows putting some of the cross-building logic in the mkDerivation nix parameters, and not only in the final builder script, as it was until now. svn path=/nixpkgs/trunk/; revision=20272 --- pkgs/development/tools/misc/texinfo/default.nix | 9 +++++++++ pkgs/stdenv/adapters.nix | 2 +- pkgs/stdenv/generic/default.nix | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/misc/texinfo/default.nix b/pkgs/development/tools/misc/texinfo/default.nix index c9bf4eea4053..09fe6ed029c3 100644 --- a/pkgs/development/tools/misc/texinfo/default.nix +++ b/pkgs/development/tools/misc/texinfo/default.nix @@ -10,6 +10,15 @@ stdenv.mkDerivation rec { buildInputs = [ ncurses lzma ]; + # !!! This should be set as usual attributes - we set them as + # crossAttrs only not to change the usual stdenv hash + # (in the normal stdenv, these get mapped all to buildNativeInputs, + # but unfortunately in the opposite order, thus getting a new hash) + crossAttrs = { + buildNativeInputs = [ lzma ]; + buildInputs = [ ncurses ]; + }; + # Disabled because we don't have zdiff in the stdenv bootstrap. #doCheck = true; diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 33e1f8505d27..f1babf2dfb28 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -170,7 +170,7 @@ rec { propagatedBuildNativeInputs = propagatedBuildNativeInputsDrvs; crossConfig = cross.config; - }); + } // (if args ? crossAttrs then args.crossAttrs else {})); in buildDrv // { inherit hostDrv buildDrv; }; diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 191dd54c6aea..fa9c18b2c374 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -44,7 +44,7 @@ let # stdenv and its shell. mkDerivation = attrs: (derivation ( - (removeAttrs attrs ["meta" "passthru"]) + (removeAttrs attrs ["meta" "passthru" "crossAttrs"]) // (let buildInputs = if attrs ? buildInputs then attrs.buildInputs else [];