I have struggled with something similar. I wanted to do a build optimized for the x86-64-v3
feature level. Here is what didn’t work for me.
I started with just this:
nixpkgs.localSystem = {
gcc.arch = "x86-64-v3";
gcc.tune = "generic";
system = "x86_64-linux";
};
This complained about nix system features, and so I had to add gccarch
feature:
nix.settings.system-features = [ "nixos-test" "benchmark" "big-parallel" "kvm" "gccarch-x86-64-v3" ];
This then complained about the architecture not being valid, so I tried again targeting skylake
instead:
nix.settings.system-features = [ "nixos-test" "benchmark" "big-parallel" "kvm" "gccarch-skylake" ];
nixpkgs.localSystem = {
gcc.arch = "skylake";
gcc.tune = "skylake";
system = "x86_64-linux";
};
With these flags the build did start to run, but from what I could see with ps
none of the invocations of gcc
actually had the march
or mtune
flags set as I’d expect. I interrupted the build and have given up on this for the time being.
I would be very interested to hear if you figure out a solution to this, especially if you get the micro-architecture feature level build working.