withCFlags
pkgs.withCFlags
Docs pulled from | This Revision | about 1 hour ago
Modify a stdenv so that it builds binaries with the specified list of compilerFlags appended and passed to the compiler.
This example would recompile every derivation on the system with -funroll-loops and -O3 passed to each gcc invocation.
Example: nixpkgs.overlays = [ (self: super: { stdenv = super.withCFlags [ "-funroll-loops" "-O3" ] super.stdenv; }) ];
Noogle detected
Implementation
The following is the current implementation of this function.
withCFlags =
compilerFlags: stdenv:
stdenv.override (old: {
mkDerivationFromStdenv = extendMkDerivationArgs old (args: {
env = (args.env or { }) // {
NIX_CFLAGS_COMPILE = toString (args.env.NIX_CFLAGS_COMPILE or "") + " ${toString compilerFlags}";
};
});
});