Well in this case I am the user. And I don't want to fill this in for every different server I might have.

My suggestion was to make -march=native pure, by expanding it on the system configuring itself at nix _expression_ evaluation time:

$ echo "" | gcc -O3 -march=native -mtune=native -v -E - 2>&1 |grep cc1 |sed -r 's/.*? - -(.*)$/-\1/'
-march=corei7 -mcx16 -msahf -mno-movbe -maes -mno-pclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-tbm -mno-avx -msse4.2 -msse4.1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=generic -O3


So if I'd say:

nixpkgs.config.servers.http.nginx.optimize_cflags = true;

The server building the package would run above command and add these to CFLAGS, which in turn become part of the hash.

7 februari 2013 15:33
Hi Danny,

Unfortunately, there's not a good answer to this because -march=native is inherently impure. Is there any reason you can't tell users "Find out what -march=native means on your system and then fill in nixpkgs.config.extra_cflags with the result?" or some such (Note that config.extra_cflags doesn't currently exist AFAIK, but could)?

~Shea

On 02/07/2013 07:36 AM, Danny Wilson wrote:

7 februari 2013 13:36
With help of the gentoo wiki ( http://en.gentoo-wiki.com/wiki/Hardware_CFLAGS )
I found this produces a nice GCC option list:

echo "" | gcc -O3 -march=native -mtune=native -v -E - 2>&1 |grep cc1 |sed -r 's/.*? - -(.*)$/-\1/'




_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev
7 februari 2013 12:37
I'd like some packages to be optimized for my server CPU. GCC has
-march=native for this, but that would not generate a cpu specific nixos
hash.

Is there a nix _expression_ available which adds something like this:
gcc -march=native -Q --help=target |grep enabled

to CFLAGS and correctly hashing it?



_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev


_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to