Looking to confirm my understanding from looking through nixpkgs. It seems that a particular
-On flag is not imposed on all packages, but they are in general determined by the package being compiled.
For example if I do
nix log on the hello package I can see
-O2 in the build logs, which appears to be set in
./configure. There’s no flag set in the corresponding
Presumably I could globally (attempt to) set an optimization level with
$NIX_COMPILE_CFLAGS set somewhere in
In general as a C++ developer I’m a bit worried that if I compile half a dozen libraries with different -O settings, then build my project against that, the linker might end up selecting a non-optimised instantiation of a particular template function.