|
OK, well technically that is possible,
with something like this:
extra_cflags = import (pkgs.runCommand "cflags" {} '' mkdir $out echo "" | gcc -O3 -march=native -mtune=native -v -E - 2>&1 |grep cc1 |sed -r 's/.*? - -(.*)$/-\1/' > $out/flags echo "builtins.readFile ./flags" > $out/default.nix ''); Basically, what that does is build a derivation which creates a nix _expression_, then imports that nix _expression_. One problem with this is that the result is saved in the nix store, meaning if you share nix stores between machines it won't work (because it will run once on one machine and the same result will be used on different machines). To get around this, you can make the derivation depend on the current time, which will force it to calculate the cflags every time you build something. Also, it's possible that in the future builds run in chroot will be inside namespaces that block how gcc detects the host system, so we should make this not run in chroot: extra_cflags = import (pkgs.runCommand "cflags" {time = builtins.currentTime; __noChroot = true;} '' mkdir $out echo "" | gcc -O3 -march=native -mtune=native -v -E - 2>&1 |grep cc1 |sed -r 's/.*? - -(.*)$/-\1/' > $out/flags echo "builtins.readFile ./flags" > $out/default.nix ''); I'm not sure of your level of understanding of nix, so please let me know if this needs more explanation. Thanks, Shea On 02/07/2013 09:53 AM, Danny Wilson wrote: Well in this case I am the user. And I don't want to fill this in for every different server I might have. |
_______________________________________________ nix-dev mailing list [email protected] http://lists.science.uu.nl/mailman/listinfo/nix-dev


