Building the whole system with gccarch-skylake optimisations - exclude packages

Hi there,
I want to build my whole system with gccarch-skylake build optimisations.
So I added the following lines to my configuation.nix:

nixpkgs.localSystem = {
    gcc.arch = "skylake";
    gcc.tune = "skylake";
};

That worked for me. But I got errors in specific packages and want to exclude them.
How can I do that? I am not very experienced in using nixos and the nix language. Im just testing out things in a VM and want to switch too nixos later after trying such things.

One option would be to eval another nixpkgs without optimization and then override the stdenv of the problematic packages.

I will try that. Can take a while because I am new to the nix language.
Thank you.
Can you give me some advice how I can do that?
I don’t know how to start.
I have some problems how to test things out in nix.

I am investigation since hours. But I am not able to find a solution.
I thing the problem is that I am not really understanding the nix language. But I don’t know where to begin and how to begin.
I thought it should be possible to override the package and set the nixpkgs.localSystem only for that overlay. The package I try to overlay is libxcrypt.
Can someone give me a example for my nixos-confriguration file please?
I found ways to override package versions in that way but I wasn’t able to use this information properly.

May I suggest you use nixos as is for a while to familiarize yourself before worrying about tuning for micro optimizations?

  nixpkgs.overlays = lib.mkIf config.simd.enable [
    (final: prev: {
      ninja = prev.ninja.overrideAttrs (oldAttrs: {
        patches = oldAttrs.patches or [ ] ++ [
          ./overlays/ninja-proc-loadavg.diff
        ];
      });
    })
  ];

Thank you :slight_smile:
I think my my problem is now solved. Here is the code I used in my configuration.nix. The build passed after applying it.

    nixpkgs.overlays = [
    (
         self: super: {
            libxcrypt = super.libxcrypt.overrideAttrs (
                                oldAttrs: {
                                  NIX_CFLAGS_COMPILE = " -march=nehalem -mtune=skylake";
                                }
                );
         }
    )
    ];