withCFlags
pkgs.withCFlags
Docs pulled from | This Revision | 10 minutes 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.
Inputs
compilerFlags
-
1. Function argument
stdenv
-
2. Function argument
Examples
withCFlags
usage 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}";
};
});
});