3

I would like to override stdenv.cc to a specific GCC version (not necessarily in nixpkgs) globally using an overlay (i.e. without changing nixpkgs). Is there a way to do that?

An overlay like this causes an infinite recursion (since package gcc49 has stdenv as input):

self: super:
{
  stdenv = super.overrideCC super.stdenv super.gcc49;
}

What is the correct way to change the stdenv.cc globally?

Setting manually stdenv = ... in import nixpkgs is not feasible, since I would like to replace the cc not only when building/using nix expressions but also in e.g. nix-shell -p package.

Can someone help me with this?

afarkas
  • 31
  • 1

1 Answers1

1
(import <nixpkgs> { overlays = [(self: super: { gcc = self.gcc10; })]; }).stdenv.cc

This returns a derivation for gcc-10.1.0, so it could work.

luc65r
  • 11
  • 1