OverrideAttrs question

I am trying to override rustc with a version that has support for compiling to ESP32 (https://github.com/esp-rs/rust).

This is what my flake looks currently looks like.

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs";
    esp-rust-src = {
      url = "github:esp-rs/rust";
      flake = false;
    };
  };

  outputs = { self, nixpkgs, esp-rust-src, }:
    let
      system = "x86_64-linux";
      myOverlay = (final: prev: {
        rustc = prev.rustc.overrideAttrs (finalAttrs: old: (lib.trace (builtins.attrNames old) {
          src = prev.lib.cleanSource esp-rust-src.outPath;
          postConfigure =  ''
            ./configure --experimental-targets=Xtensa --release-channel=nightly --enable-extended --tools=clippy,cargo,rustfmt --enable-lld
          '';
        }));
      });
      overlays = [ (myOverlay) ];
      pkgs = import nixpkgs {
        inherit system overlays;
      };
      lib = pkgs.lib;
    in
    {
      devShells.x86_64-linux.default = pkgs.mkShell {
        packages = with pkgs; [
          nil
          nixpkgs-fmt
          rustc
          cargo
        ];
      };
    };
}

To my current question. As I understand it, the old function parameter that is provided from overrideAttrs should be the attrset which is passed to the stdenv.mkDerivation function. Then why does it appear like not all attributes are traced out?

trace: [ "buildCommand" "enableParallelBuilding" "env" "meta" "name" "outputs" "passAsFile" "passthru" "preferLocalBuild" "strictDeps" ]

If I compare this to GitHub master https://github.com/NixOS/nixpkgs/blob/d02d818f22c777aa4e854efc3242ec451e5d462a/pkgs/development/compilers/rust/rustc.nix#L284, multiple attributes are missing like postPatch, stripDebugList, __darwinAllowLocalNetworking and many more.

And yes, I just ran nix flake update.

The rust compiler is wrapped:

What you’re looking at is the wrapper’s args.

1 Like