Add an option ‘stdenv.userHook’ to set a global stdenv setup hook

This allows various applications.  It allows users to set global
optimisation flags, e.g.

  stdenv.userHook = ''NIX_CFLAGS_COMPILE+=" -funroll-loops"'';

But the impetus is as an alternative to issue #229, allowing impure
stdenv setup for people who want to use distcc:

  stdenv.userHook = "source /my/impure/setup-script.sh";

This is probably a bad idea, but at least now it's a bad idea in
people's configuration and not in Nixpkgs. :-)
This commit is contained in:
Eelco Dolstra
2012-12-28 16:36:09 +01:00
parent 6fd4f63530
commit cf8daf6312
7 changed files with 21 additions and 11 deletions
+4 -3
View File
@@ -10,7 +10,7 @@
# system, e.g., cygwin and mingw builds on i686-cygwin. Most people
# can ignore it.
{system, stdenvType ? system, allPackages ? import ../.., platform}:
{ system, stdenvType ? system, allPackages ? import ../.., platform, config }:
assert system != "i686-cygwin" -> system == stdenvType;
@@ -24,7 +24,7 @@ rec {
# be used with care, since many Nix packages will not build properly
# with it (e.g., because they require GNU Make).
stdenvNative = (import ./native {
inherit system allPackages;
inherit system allPackages config;
}).stdenv;
stdenvNativePkgs = allPackages {
@@ -35,13 +35,14 @@ rec {
# The Nix build environment.
stdenvNix = import ./nix {
inherit config;
stdenv = stdenvNative;
pkgs = stdenvNativePkgs;
};
# Linux standard environment.
stdenvLinux = (import ./linux {inherit system allPackages platform;}).stdenvLinux;
stdenvLinux = (import ./linux { inherit system allPackages platform config;}).stdenvLinux;
# MinGW/MSYS standard environment.