mkShell overrides diffutils overrides?

Hi,

Due to the age of my base system (CentOS 7), diffutils failed to build. I manually disabled check and moved on (yes, it IS a bad practice, but it’s better than nothing).

Today I tried to define a minimal dev shell, but when running nix develop, nix tried to recompile diffutils, and failed at doing so, because some check failed.

This is weird. I then manually defined a package.default = pkgs.diffutils attribute and used nix build to make sure that my overlay is working as there was no compiling involved.

So, somehow, mkShell forced a non-overriden version of diffutils?

Here’s my flake.nix:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
  };

  outputs =
    {
      self,
      nixpkgs,
    }:
    let
      overlay = import ./overlay;

      supportedSystems = [ "x86_64-linux" ];
      forEachSupportedSystem =
        f:
        nixpkgs.lib.genAttrs supportedSystems (
          system:
          f {
            pkgs = import nixpkgs {
              inherit system;
              overlays = [ overlay ];
              config = { allowUnfree = true; };
            };
          }
        );
    in
    {
      packages = forEachSupportedSystem (
        { pkgs }:
        {
          default = pkgs.diffutils;
        }
      );

      devShells = forEachSupportedSystem (
        { pkgs }:
        {
          default = pkgs.mkShell {
            buildInputs = with pkgs; [
              libiconv
            ];
          };
        }
      );
    };
}

…and my overlay:

final: prev: {
  diffutils = prev.diffutils.overrideAttrs (oldAttrs: {
    doCheck = false;
  });
  # ./init.sh: line 692: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

  bison = prev.bison.overrideAttrs (oldAttrs: {
    doInstallCheck = false;
  });
  # Tabulations and multibyte characters            FAILED (diagnostics.at:282)

  git = prev.git.overrideAttrs (oldAttrs: {
    doInstallCheck = false;
  });
  # t0200-gettext-basic.sh                           (Wstat: 256 (exited 1) Tests: 16 Failed: 8)
  #   Failed tests:  8, 10-16
  #   Non-zero exit status: 1
  # t0204-gettext-reencode-sanity.sh                 (Wstat: 256 (exited 1) Tests: 8 Failed: 5)
  #   Failed tests:  1-3, 5-6
  #   Non-zero exit status: 1

  nix = prev.nix.overrideAttrs (oldAttrs: {
    doCheck = false;
    buildInputs =
      oldAttrs.buildInputs
      ++ (with final; [
        rapidcheck
        gtest
      ]);
    # FIXME: disabling check removes deps above, making nix configurePhase fail.
  });
  # 1 test suite failed

If your shell has the problem, but ypur packages.$system.default doesn’t, can you please share your shell definition?

I’m not sure if I understood your question. My devShell is defined as follows (a minimal devShell):

After asking in the matrix channel, I got 2 workarounds:

  1. nix shell .#devShells.x86-64-linux.default
  2. bash --rcfile <(nix print-dev-env .)

There is likely some problem in the nix develop command. I’ve filed a bug report at `nix develop` doesn't respect overrides in overlays, uses hard-coded `bashInteractive` instead · Issue #13434 · NixOS/nix · GitHub