Created
March 14, 2018 19:15
-
-
Save matthiasbeyer/cba5559a0bed6058f469426687bf307d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs }: | |
rec { | |
optimizeWithFlag = pkg: flag: | |
pkg.overrideAttrs (attrs: { | |
NIX_CFLAGS_COMPILE = (attrs.NIX_CFLAGS_COMPILE or "") + " ${flag}"; | |
}); | |
optimizeWithFlags = pkg: flags: | |
pkgs.lib.foldl' (pkg: flag: optimizeWithFlag pkg flag) pkg flags; | |
optimizeForThisHost = pkg: | |
optimizeWithFlags pkg [ "-O3" "-march=native" "-fPIC" ]; | |
withDebuggingCompiled = pkg: | |
optimizeWithFlag pkg "-DDEBUG"; | |
applyOptimizations = opts: pkg: | |
pkgs.lib.foldl (pkg: optfun: optfun pkg) pkg opts; | |
withoutConfigureFlag = flag: pkg: | |
pkgs.lib.overrideDerivation pkg (old: { | |
configureFlags = pkgs.lib.filter (x: x != flag) old.configureFlags; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment