Merge pull request #37600 from abbradar/impureusenative

impureUseNativeOptimizations: add stdenv adapter
This commit is contained in:
Yegor Timoshenko 2018-10-13 14:09:55 +00:00 committed by GitHub
commit cd0c8739d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,4 +171,19 @@ rec {
NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + " -fuse-ld=gold";
});
};
/* Modify a stdenv so that it builds binaries optimized specifically
for the machine they are built on.
WARNING: this breaks purity! */
impureUseNativeOptimizations = stdenv: stdenv //
{ mkDerivation = args: stdenv.mkDerivation (args // {
NIX_CFLAGS_COMPILE = toString (args.NIX_CFLAGS_COMPILE or "") + " -march=native";
NIX_ENFORCE_NO_NATIVE = false;
preferLocalBuild = true;
allowSubstitutes = false;
});
};
}