@volth Thank you so much! Learning to use NixOS is a fun exercise (that I’m falling in love with).
I’m still stumped on overriding default makeopts like CFLAGS, CXXFLAGS, etc. With Gentoo it is so easy… I found this in the nixpkgs manual:
makeFlagsArray
A shell array containing additional arguments passed to make . You must use this instead of
makeFlags
if the arguments contain spaces, e.g.
preBuild =
'' makeFlagsArray+=(CFLAGS="-O0 -g" LDFLAGS="-lfoo -lbar")
'';
Note that shell arrays cannot be passed through environment variables, so you cannot set
makeFlagsArray
in a derivation attribute (because those are passed through environment variables): you have to define them in shell code.
So how exactly can I set these for every package? It feels like this should be as easy as changing gcc.arch
or gcc.tune
!
Edit: Could I do it like this (copied from a Nix cheatsheet site)?
stdenv.userHook = '' NIX_CFLAGS_COMPILE+=" -march=native" '';
Or is something like this required and an overridden stdenv?