# Problem evaluating \`gcc\` with \`langRust = true\`

**URL:** https://discourse.nixos.org/t/problem-evaluating-gcc-with-langrust-true/76877
**Category:** Nixpkgs Architecture
**Created:** [April 6, 2026, 11:21pm UTC](https://discourse.nixos.org/t/problem-evaluating-gcc-with-langrust-true/76877 "2026-04-06T23:21:43Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sempiternal-aurora](https://discourse.nixos.org/user_avatar/discourse.nixos.org/sempiternal-aurora/32/38481_2.png) [@sempiternal-aurora](https://discourse.nixos.org/u/sempiternal-aurora)
#### Post date: [April 6, 2026, 11:21pm UTC](https://discourse.nixos.org/t/problem-evaluating-gcc-with-langrust-true/76877/1 "2026-04-06T23:21:43Z")

</div>

Hey, I’m working on packaging `gccrs` and `gcobol` for nixos, like how `gccgo` is already packaged. You can see my work in [gccrs, gcobol: improve support and package by sempiternal-aurora · Pull Request #507407 · NixOS/nixpkgs · GitHub](https://github.com/NixOS/nixpkgs/pull/507407) . However, I’m running into evaluation issues with `gccrs`. When I override `gcc.cc` with `withRust = true`, I get an evaluation error, but overriding `gcc15` has no similar problems, even though they are the same package? Can someone help me look at this, I’m extremely confused.

The problem seems to inherantly come from the `optionals langRust [cargo]` in pkgs/development/compilers/gcc/common/dependencies.nix, added in [gcc: provide build support for gccrs by nagy · Pull Request #332738 · NixOS/nixpkgs · GitHub](https://github.com/NixOS/nixpkgs/pull/332738) . Removing this fixes the evaluation, but breaks the `gccrs` build as it needs cargo for some rust in the code. Is there some problem with how the dependencies are specified, is there a circular import problem where we’re overriding the `gcc` that is used to build the rust system somehow? The full trace just doesn’t give me a lot to go on from what I can see. Any help is highly appreciated.

```auto
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37| strict = derivationStrict drvAttrs;
             | ^
           38|

       … while evaluating derivation 'gccrs-wrapper-15.2.0'
         whose name attribute is located at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:536:13

       … while evaluating attribute 'cc' of derivation 'gccrs-wrapper-15.2.0'

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:50:17:
           49| value = commonAttrs // {
           50| outPath = builtins.getAttr outputName strict;
             | ^
           51| drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37| strict = derivationStrict drvAttrs;
             | ^
           38|

       … while evaluating derivation 'gccrs-15.2.0'
         whose name attribute is located at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:536:13

       … while evaluating attribute 'nativeBuildInputs' of derivation 'gccrs-15.2.0'
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:585:13:
          584| depsBuildBuild = elemAt (elemAt dependencies 0) 0;
          585| nativeBuildInputs = elemAt (elemAt dependencies 0) 1;
             | ^
          586| depsBuildTarget = elemAt (elemAt dependencies 0) 2;

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:50:17:
           49| value = commonAttrs // {
           50| outPath = builtins.getAttr outputName strict;
             | ^
           51| drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37| strict = derivationStrict drvAttrs;
             | ^
           38|

       … while evaluating derivation 'cargo-1.94.0'
         whose name attribute is located at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:536:13

       … while evaluating attribute 'buildInputs' of derivation 'cargo-1.94.0'
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:588:13:
          587| depsHostHost = elemAt (elemAt dependencies 1) 0;
          588| buildInputs = elemAt (elemAt dependencies 1) 1;
             | ^
          589| depsTargetTarget = elemAt (elemAt dependencies 2) 0;

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:50:17:
           49| value = commonAttrs // {
           50| outPath = builtins.getAttr outputName strict;
             | ^
           51| drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37| strict = derivationStrict drvAttrs;
             | ^
           38|

       … while evaluating derivation 'curl-8.18.0'
         whose name attribute is located at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:536:13

       … while evaluating attribute 'configureFlags' of derivation 'curl-8.18.0'
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:599:13:
          598| # This parameter is sometimes a string, sometimes null, and sometimes a list, yuck
          599| configureFlags =
             | ^
          600| configureFlags

       … from call site
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/by-name/cu/curlMinimal/package.nix:190:6:
          189| (lib.withFeature pslSupport "libpsl")
          190| (lib.withFeatureAs brotliSupport "brotli" (lib.getDev brotli))
             | ^
          191| (lib.withFeatureAs gnutlsSupport "gnutls" (lib.getDev gnutls))

       … while calling 'withFeatureAs'
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/lib/strings.nix:2485:20:
         2484| withFeatureAs =
         2485| flag: feature: value:
             | ^
         2486| withFeature flag feature + optionalString flag "=${value}";

       … from call site
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/lib/strings.nix:2486:32:
         2485| flag: feature: value:
         2486| withFeature flag feature + optionalString flag "=${value}";
             | ^
         2487|

       … while calling 'optionalString'
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/lib/strings.nix:767:26:
          766| */
          767| optionalString = cond: string: if cond then string else "";
             | ^
          768|

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:50:17:
           49| value = commonAttrs // {
           50| outPath = builtins.getAttr outputName strict;
             | ^
           51| drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37| strict = derivationStrict drvAttrs;
             | ^
           38|

       … while evaluating derivation 'brotli-1.2.0'
         whose name attribute is located at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:536:13

       … while evaluating attribute 'nativeBuildInputs' of derivation 'brotli-1.2.0'
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:585:13:
          584| depsBuildBuild = elemAt (elemAt dependencies 0) 0;
          585| nativeBuildInputs = elemAt (elemAt dependencies 0) 1;
             | ^
          586| depsBuildTarget = elemAt (elemAt dependencies 0) 2;

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:50:17:
           49| value = commonAttrs // {
           50| outPath = builtins.getAttr outputName strict;
             | ^
           51| drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37| strict = derivationStrict drvAttrs;
             | ^
           38|

       … while evaluating derivation 'cmake-4.1.2'
         whose name attribute is located at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:536:13

       … while evaluating attribute 'buildInputs' of derivation 'cmake-4.1.2'
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:588:13:
          587| depsHostHost = elemAt (elemAt dependencies 1) 0;
          588| buildInputs = elemAt (elemAt dependencies 1) 1;
             | ^
          589| depsTargetTarget = elemAt (elemAt dependencies 2) 0;

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:50:17:
           49| value = commonAttrs // {
           50| outPath = builtins.getAttr outputName strict;
             | ^
           51| drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37| strict = derivationStrict drvAttrs;
             | ^
           38|

       … while evaluating derivation 'curl-8.18.0'
         whose name attribute is located at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:536:13

       … while evaluating attribute 'propagatedBuildInputs' of derivation 'curl-8.18.0'
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:595:13:
          594| depsHostHostPropagated = elemAt (elemAt propagatedDependencies 1) 0;
          595| propagatedBuildInputs = elemAt (elemAt propagatedDependencies 1) 1;
             | ^
          596| depsTargetTargetPropagated = elemAt (elemAt propagatedDependencies 2) 0;

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:50:17:
           49| value = commonAttrs // {
           50| outPath = builtins.getAttr outputName strict;
             | ^
           51| drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37| strict = derivationStrict drvAttrs;
             | ^
           38|

       … while evaluating derivation 'nghttp2-1.67.1'
         whose name attribute is located at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:536:13

       … while evaluating attribute 'buildInputs' of derivation 'nghttp2-1.67.1'
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:588:13:
          587| depsHostHost = elemAt (elemAt dependencies 1) 0;
          588| buildInputs = elemAt (elemAt dependencies 1) 1;
             | ^
          589| depsTargetTarget = elemAt (elemAt dependencies 2) 0;

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:50:17:
           49| value = commonAttrs // {
           50| outPath = builtins.getAttr outputName strict;
             | ^
           51| drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37| strict = derivationStrict drvAttrs;
             | ^
           38|

       … while evaluating derivation 'libev-4.33'
         whose name attribute is located at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:536:13

       … while evaluating attribute 'patches' of derivation 'libev-4.33'
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/stdenv/generic/make-derivation.nix:610:21:
          609|
          610| inherit patches;
             | ^
          611|

       … while calling a functor (an attribute set with a '__functor' attribute)
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/by-name/li/libev/package.nix:26:6:
           25| patches = [
           26| (fetchpatch {
             | ^
           27| url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/21a6f0f5829384117dfc1ed11ad67954562ef7d6/devel/libev/files/patch-ev.c";

       … from call site
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/lib/trivial.nix:1081:5:
         1080| # TODO: Should we add call-time "type" checking like built in?
         1081| __functor = self: f;
             | ^
         1082| __functionArgs = args;

       … while calling anonymous lambda
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/build-support/fetchpatch/default.nix:13:1:
           12|
           13| {
             | ^
           14| relative ? null,

       … from call site
         at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/build-support/fetchpatch/default.nix:41:1:
           40| in
           41| lib.throwIfNot (excludes == [] || includes == [])
             | ^
           42| "fetchpatch: cannot use excludes and includes simultaneously"

       error: function 'anonymous lambda' called with unexpected argument 'nativeBuildInputs'
       at /nix/store/dkz5lh7c0m6rpj93cd3nc8j65zvar1m1-source/pkgs/build-support/fetchurl/boot.nix:10:1:
            9|
           10| {
             | ^
           11| url ? builtins.head urls,

```

---

<div class="post-metadata">

### Author: ![sternenseemann](https://discourse.nixos.org/user_avatar/discourse.nixos.org/sternenseemann/32/3809_2.png) [@sternenseemann](https://discourse.nixos.org/u/sternenseemann)
#### Post date: [April 7, 2026, 2:09pm UTC](https://discourse.nixos.org/t/problem-evaluating-gcc-with-langrust-true/76877/2 "2026-04-07T14:09:35Z")

</div>

The problem you’re running into is that `gcc.cc != gcc15.cc`, at least not exactly. `gcc` points to previous bootstrapping stage of `gcc` (it is the same as `stdenv.cc` which is used to build every regular package in Nixpkgs, more or less, including `gcc15`). (I’m currently unable to explain why this is exactly because it’s not quite apparent from the `gcc` definition site, will have to think about it.) This bootstrapping stage still uses the more limited builtin `fetchurl` implementation of Nix which doesn’t support certain features, hence the error message.

The error then occurs because `gcc.cc.override { }` recomputes the `gcc` derivation with the same inputs/scope (which is the previous bootstrapping stage), so only the limited `fetchurl` implementation remains available. `cargo` seems to depend on a fully featured version of `curl` which in turn depends on `libev` which uses `fetchpatch` (since [https://github.com/NixOS/nixpkgs/pull/468563](https://github.com/NixOS/nixpkgs/pull/468563), I’m not sure whether it actually _should_). This then breaks with the bootstrap fetchurl `implementation`.

You may have better luck with overriding `pkgs."gcc${toString default-gcc-version}"`.

---

<div class="post-metadata">

### Author: ![sempiternal-aurora](https://discourse.nixos.org/user_avatar/discourse.nixos.org/sempiternal-aurora/32/38481_2.png) [@sempiternal-aurora](https://discourse.nixos.org/u/sempiternal-aurora)
#### Post date: [April 7, 2026, 9:04pm UTC](https://discourse.nixos.org/t/problem-evaluating-gcc-with-langrust-true/76877/3 "2026-04-07T21:04:46Z")

</div>

Thanks for the explanation. The only thing I’m confused about is why gcc is the stdenv gcc in the first place, isn’t it set just a few lines above in `all-packages.nix` to be `pkgs.”gcc${toString default-gcc-version}”`?

---

<div class="post-metadata">

### Author: ![vcunat](https://discourse.nixos.org/user_avatar/discourse.nixos.org/vcunat/32/11_2.png) [@vcunat](https://discourse.nixos.org/u/vcunat)
#### Post date: [April 8, 2026, 4:48am UTC](https://discourse.nixos.org/t/problem-evaluating-gcc-with-langrust-true/76877/4 "2026-04-08T04:48:43Z")

</div>

and the `stdenv` definition uses that definition (with additional override machinery)

---

<div class="post-metadata">

### Author: ![sternenseemann](https://discourse.nixos.org/user_avatar/discourse.nixos.org/sternenseemann/32/3809_2.png) [@sternenseemann](https://discourse.nixos.org/u/sternenseemann)
#### Post date: [April 8, 2026, 12:07pm UTC](https://discourse.nixos.org/t/problem-evaluating-gcc-with-langrust-true/76877/5 "2026-04-08T12:07:08Z")

</div>

Right, the linux stdenv bootstrapper uses gcc as the main attribute that is redefined in the different stages, hence we are left with the deps from the previous stage in the end.
