Nixpkgs-23.11 + oxalica Rust overlay + cargo-SUBCOMMAND -> error relating to 'auditable'

Following on from a less focused description of the problem, I have a minimal flake

# See lines marked NECESSARY for conditions to reproduce error
{
  inputs = {
    nixpkgs     .url = "github:nixos/nixpkgs/nixos-23.11"; # NECESSARY: 23.11 (must be newer than 23.05)
    rust-overlay.url = "github:oxalica/rust-overlay";
  };

  outputs = { nixpkgs, rust-overlay, ... }:
    let
      name = "debugging";
      pkgs = import nixpkgs {
        system = "x86_64-linux";
        overlays = [
          rust-overlay.overlays.default (final: prev:
            let rust-stable = final.rust-bin.stable."1.75.0";
            in {
              cargo = rust-stable.default; # NECESSARY: remove this line to suppress the error
            })
        ];
      };

    in {
      devShell.x86_64-linux = pkgs.mkShell {
        buildInputs = [
          # pkgs.cargo   # IRRELEVANT: cargo itself, makes no difference

          pkgs.cargo-asm # NECESSARY: at least one cargo-SUBCOMMAND is required to produce the error

          # Any of the following also trigger the error
          # pkgs.cargo-nextest
          # pkgs.cargo-c
          # pkgs.cargo-ui
          # pkgs.cargo-rr
          # pkgs.cargo-web
          # pkgs.cargo-deb
          # etc.
        ];
      };
    };
}

which generates a

function 'anonymous lambda' called with unexpected argument 'auditable'

error.

Necessary conditions for the error to appear, include

  • nixpkgs 23.11
  • overriding cargo with oxalica/rust-overlay
  • using some cargo subcommand package from the former

What can be done to get around this problem?

If I’m reading this right, you only use cargo from the overlay, but the subcommands are not overlayed and come from nixpkgs as you only replace cargo in the overlay definition, but cargo-asm does probably not use that cargo version.

See https://nixos.org/manual/nixpkgs/unstable/#using-community-maintained-rust-toolchains#using-rust-nightly-in-a-derivation-with-buildrustpackage

Hmm, indeed, I think my brain was parsing cargo-SUB as something like cargo.SUB.

For practical purposes I don’t think I need cargo to be overridden: I just want to be able to use some overridden version of rustc, and not overriding cargo is enough to make the problem goes away. So I should probably stop there.

But if, for whatever reason, I wanted to use an overridden cargo with some subcommand, I would have to recompile the subcommand with makeRustPlatform { ... }.buildRustPackage along the lines of what is shown in what you linked?

Yes, you would simply do cargo-sub = cargo-sub.override { makeRustPlatform = myRustPlatform }.

1 Like