Packages in overlay arguments are different from regular package-set?

I noticed my system was attempting to build gnugrep and bash from source after I added some packages via overlays. This behavior was totally unexpected to me, so I started investigating, I ended up with the following:

# default.nix
let
  pkgs = import <nixpkgs> {
    overlays = [
      (final: prev: {
        bash-cached = final.bash;
        bash-not-cached = prev.bash;
      })
    ];
  };
in
pkgs.bash-not-cached

If you nix-build this, it should start building from source, why is that?

My understanding is that in this context prev should be the same as the result of import <nixpkgs> { } and final should be the same plus the new attributes.

Using nix-diff I found that one of them depends on bootstrap-tools and bootstrap-stage-4:

nix-diff
$ nix-diff /nix/store/ixn4ykv3vy783cpv605sgpbmf5gdlm17-bash-5.2p26.drv /nix/store/acg6rlmmgirs6x0ipfx001vhslxljz7c-bash-5.2p26.drv
- /nix/store/ixn4ykv3vy783cpv605sgpbmf5gdlm17-bash-5.2p26.drv:{out}
+ /nix/store/acg6rlmmgirs6x0ipfx001vhslxljz7c-bash-5.2p26.drv:{out}
• The builders do not match
    - /nix/store/wckka8fxv4h5hp74cbkhaw3fw7kbvcs1-bash-5.2p26/bin/bash
    + /nix/store/4w85zw8hd3j2y89fm1j40wgh4kpjgxy7-bootstrap-tools/bin/bash
• The set of input derivation names do not match:
    - bash-5.2p26
    - gcc-wrapper-13.2.0
    - stdenv-linux
    + bootstrap-stage4-gcc-wrapper-13.2.0
    + bootstrap-stage4-stdenv-linux
    + bootstrap-tools
• The input derivation named `bash-5.2.tar.gz` differs
  - /nix/store/6fb6xwhbjgfsgbjpmdypwxz7p3qgdxsv-bash-5.2.tar.gz.drv:{out}
  + /nix/store/5jrd75v747s76s16zxk59384xfcjqn58-bash-5.2.tar.gz.drv:{out}
  • The platforms do not match
      - x86_64-linux
      + builtin
  • The builders do not match
      - /nix/store/wckka8fxv4h5hp74cbkhaw3fw7kbvcs1-bash-5.2p26/bin/bash
      + builtin:fetchurl
  • The arguments do not match
      - -e
      - /nix/store/g0gn91m56b267ncx05w93kihyqia39cm-builder.sh
  • The set of input source names do not match:
      - builder.sh
  • The set of input derivation names do not match:
      - bash-5.2p26
      - curl-8.7.1
      - mirrors-list
      - stdenv-linux
  • The environments do not match:
      - SSL_CERT_FILE=/no-cert-file.crt
      - __structuredAttrs=
      - buildInputs=
      - cmakeFlags=
      - configureFlags=
      - curlOpts=
      - curlOptsList=
      - depsBuildBuild=
      - depsBuildBuildPropagated=
      - depsBuildTarget=
      - depsBuildTargetPropagated=
      - depsHostHost=
      - depsHostHostPropagated=
      - depsTargetTarget=
      - depsTargetTargetPropagated=
      - doCheck=
      - doInstallCheck=
      - downloadToTemp=
      - mesonFlags=
      - mirrorsFile=/nix/store/djgnvvf2h21hnsyn7gng2r76fj0mp9zi-mirrors-list
      - nativeBuildInputs=/nix/store/gml8ycawxwdc6cjcycvkbnzg4byivkg7-curl-8.7.1-dev
      - nixpkgsVersion=24.05
      - outputs=out
      - patches=
      - postFetch=
      - preferHashedMirrors=1
      - propagatedBuildInputs=
      - propagatedNativeBuildInputs=
      - showURLs=
      - stdenv=/nix/store/qz53frww4qnx7p38q90kszlr4bhq2nfj-stdenv-linux
      - strictDeps=
      + unpack=
      + url=https://ftpmirror.gnu.org/bash/bash-5.2.tar.gz
      impureEnvVars=''
      http_proxy https_proxy ftp_proxy all_proxy no_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY NIX_CURL_FLAGS NIX_HASHED_MIRRORS NIX_CONNECT_TIMEOUT NIX_MIRRORS_alsa NIX_MIRRORS_apache NIX_MIRRORS_bioc NIX_MIRRORS_bitlbee NIX_MIRRORS_centos NIX_MIRRORS_cpan NIX_MIRRORS_cran NIX_MIRRORS_debian NIX_MIRRORS_dub NIX_MIRRORS_fedora NIX_MIRRORS_gcc NIX_MIRRORS_gentoo NIX_MIRRORS_gnome NIX_MIRRORS_gnu NIX_MIRRORS_gnupg NIX_MIRRORS_hackage NIX_MIRRORS_hashedMirrors NIX_MIRRORS_ibiblioPubLinux NIX_MIRRORS_imagemagick NIX_MIRRORS_kde NIX_MIRRORS_kernel NIX_MIRRORS_luarocks NIX_MIRRORS_maven NIX_MIRRORS_mozilla NIX_MIRRORS_mysql NIX_MIRRORS_openbsd NIX_MIRRORS_opensuse NIX_MIRRORS_osdn NIX_MIRRORS_postgresql NIX_MIRRORS_pypi NIX_MIRRORS_qt NIX_MIRRORS_sageupstream NIX_MIRRORS_samba NIX_MIRRORS_savannah NIX_MIRRORS_sourceforge NIX_MIRRORS_steamrt NIX_MIRRORS_tcsh NIX_MIRRORS_testpypi NIX_MIRRORS_ubuntu NIX_MIRRORS_xfce NIX_MIRRORS_xorg        
  ''
      urls=''
      mirror://gnu/bash/bash-5.2.tar.gzhttps://ftpmirror.gnu.org/bash/bash-5.2.tar.gz
  ''
• The input derivation named `bash52-001` differs
  - /nix/store/syndqirj90n8mv25nbdhfmbk4gkhwix7-bash52-001.drv:{out}
  + /nix/store/nb8wd3xgfp34vic7xw7rkb186pq7hwfh-bash52-001.drv:{out}
  • The platforms do not match
      - x86_64-linux
      + builtin
  • The builders do not match
      - /nix/store/wckka8fxv4h5hp74cbkhaw3fw7kbvcs1-bash-5.2p26/bin/bash
      + builtin:fetchurl
  • The arguments do not match
      - -e
      - /nix/store/g0gn91m56b267ncx05w93kihyqia39cm-builder.sh
  • The set of input source names do not match:
      - builder.sh
  • The set of input derivation names do not match:
      - bash-5.2p26
      - curl-8.7.1
      - mirrors-list
      - stdenv-linux
  • The environments do not match:
      - SSL_CERT_FILE=/no-cert-file.crt
      - __structuredAttrs=
      - buildInputs=
      - cmakeFlags=
      - configureFlags=
      - curlOpts=
      - curlOptsList=
      - depsBuildBuild=
      - depsBuildBuildPropagated=
      - depsBuildTarget=
      - depsBuildTargetPropagated=
      - depsHostHost=
      - depsHostHostPropagated=
      - depsTargetTarget=
      - depsTargetTargetPropagated=
      - doCheck=
      - doInstallCheck=
      - downloadToTemp=
      - mesonFlags=
      - mirrorsFile=/nix/store/djgnvvf2h21hnsyn7gng2r76fj0mp9zi-mirrors-list
      - nativeBuildInputs=/nix/store/gml8ycawxwdc6cjcycvkbnzg4byivkg7-curl-8.7.1-dev
      - nixpkgsVersion=24.05
      - outputs=out
      - patches=
      - postFetch=
      - preferHashedMirrors=1
      - propagatedBuildInputs=
      - propagatedNativeBuildInputs=
      - showURLs=
      - stdenv=/nix/store/qz53frww4qnx7p38q90kszlr4bhq2nfj-stdenv-linux
      - strictDeps=
      + unpack=
      + url=https://ftpmirror.gnu.org/bash/bash-5.2-patches/bash52-001
      impureEnvVars=''
      http_proxy https_proxy ftp_proxy all_proxy no_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY NIX_CURL_FLAGS NIX_HASHED_MIRRORS NIX_CONNECT_TIMEOUT NIX_MIRRORS_alsa NIX_MIRRORS_apache NIX_MIRRORS_bioc NIX_MIRRORS_bitlbee NIX_MIRRORS_centos NIX_MIRRORS_cpan NIX_MIRRORS_cran NIX_MIRRORS_debian NIX_MIRRORS_dub NIX_MIRRORS_fedora NIX_MIRRORS_gcc NIX_MIRRORS_gentoo NIX_MIRRORS_gnome NIX_MIRRORS_gnu NIX_MIRRORS_gnupg NIX_MIRRORS_hackage NIX_MIRRORS_hashedMirrors NIX_MIRRORS_ibiblioPubLinux NIX_MIRRORS_imagemagick NIX_MIRRORS_kde NIX_MIRRORS_kernel NIX_MIRRORS_luarocks NIX_MIRRORS_maven NIX_MIRRORS_mozilla NIX_MIRRORS_mysql NIX_MIRRORS_openbsd NIX_MIRRORS_opensuse NIX_MIRRORS_osdn NIX_MIRRORS_postgresql NIX_MIRRORS_pypi NIX_MIRRORS_qt NIX_MIRRORS_sageupstream NIX_MIRRORS_samba NIX_MIRRORS_savannah NIX_MIRRORS_sourceforge NIX_MIRRORS_steamrt NIX_MIRRORS_tcsh NIX_MIRRORS_testpypi NIX_MIRRORS_ubuntu NIX_MIRRORS_xfce NIX_MIRRORS_xorg        
  ''
      urls=''
      mirror://gnu/bash/bash-5.2-patches/bash52-001https://ftpmirror.gnu.org/bash/bash-5.2-patches/bash52-001
  ''
• The input derivation named `bash52-002` differs
  - /nix/store/9rr3ii8k12mgvbks0vkls433c9ixsv54-bash52-002.drv:{out}
  + /nix/store/j2zlvksmwzs79zvsqmz45jn39zsyr31f-bash52-002.drv:{out}
  • The platforms do not match
      - x86_64-linux
      + builtin
  • The builders do not match
      - /nix/store/wckka8fxv4h5hp74cbkhaw3fw7kbvcs1-bash-5.2p26/bin/bash
      + builtin:fetchurl
  • The arguments do not match
      - -e
      - /nix/store/g0gn91m56b267ncx05w93kihyqia39cm-builder.sh
  • The set of input source names do not match:
      - builder.sh
  • The set of input derivation names do not match:
      - bash-5.2p26
      - curl-8.7.1
      - mirrors-list
      - stdenv-linux
  • The environments do not match:
      - SSL_CERT_FILE=/no-cert-file.crt
      - __structuredAttrs=
      - buildInputs=
      - cmakeFlags=
      - configureFlags=
      - curlOpts=
      - curlOptsList=
      - depsBuildBuild=
      - depsBuildBuildPropagated=
      - depsBuildTarget=
      - depsBuildTargetPropagated=
      - depsHostHost=
      - depsHostHostPropagated=
      - depsTargetTarget=
      - depsTargetTargetPropagated=
      - doCheck=
      - doInstallCheck=
      - downloadToTemp=
      - mesonFlags=
      - mirrorsFile=/nix/store/djgnvvf2h21hnsyn7gng2r76fj0mp9zi-mirrors-list
      - nativeBuildInputs=/nix/store/gml8ycawxwdc6cjcycvkbnzg4byivkg7-curl-8.7.1-dev
      - nixpkgsVersion=24.05
      - outputs=out
      - patches=
      - postFetch=
      - preferHashedMirrors=1
      - propagatedBuildInputs=
      - propagatedNativeBuildInputs=
      - showURLs=
      - stdenv=/nix/store/qz53frww4qnx7p38q90kszlr4bhq2nfj-stdenv-linux
      - strictDeps=
      + unpack=
      + url=https://ftpmirror.gnu.org/bash/bash-5.2-patches/bash52-002
      impureEnvVars=''
      http_proxy https_proxy ftp_proxy all_proxy no_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY NIX_CURL_FLAGS NIX_HASHED_MIRRORS NIX_CONNECT_TIMEOUT NIX_MIRRORS_alsa NIX_MIRRORS_apache NIX_MIRRORS_bioc NIX_MIRRORS_bitlbee NIX_MIRRORS_centos NIX_MIRRORS_cpan NIX_MIRRORS_cran NIX_MIRRORS_debian NIX_MIRRORS_dub NIX_MIRRORS_fedora NIX_MIRRORS_gcc NIX_MIRRORS_gentoo NIX_MIRRORS_gnome NIX_MIRRORS_gnu NIX_MIRRORS_gnupg NIX_MIRRORS_hackage NIX_MIRRORS_hashedMirrors NIX_MIRRORS_ibiblioPubLinux NIX_MIRRORS_imagemagick NIX_MIRRORS_kde NIX_MIRRORS_kernel NIX_MIRRORS_luarocks NIX_MIRRORS_maven NIX_MIRRORS_mozilla NIX_MIRRORS_mysql NIX_MIRRORS_openbsd NIX_MIRRORS_opensuse NIX_MIRRORS_osdn NIX_MIRRORS_postgresql NIX_MIRRORS_pypi NIX_MIRRORS_qt NIX_MIRRORS_sageupstream NIX_MIRRORS_samba NIX_MIRRORS_savannah NIX_MIRRORS_sourceforge NIX_MIRRORS_steamrt NIX_MIRRORS_tcsh NIX_MIRRORS_testpypi NIX_MIRRORS_ubuntu NIX_MIRRORS_xfce NIX_MIRRORS_xorg        
  ''
      urls=''
      mirror://gnu/bash/bash-5.2-patches/bash52-002https://ftpmirror.gnu.org/bash/bash-5.2-patches/bash52-002
  ''
• The input derivation named `bash52-003` differs
  - /nix/store/zf3azjgd10rds1lbzpx02kq1rak63mhr-bash52-003.drv:{out}
  + /nix/store/6k05dfl68y2m382xd5hanfvj7j8c73p1-bash52-003.drv:{out}
  • The platforms do not match
      - x86_64-linux
      + builtin
  • The builders do not match
      - /nix/store/wckka8fxv4h5hp74cbkhaw3fw7kbvcs1-bash-5.2p26/bin/bash
      + builtin:fetchurl
  • The arguments do not match
      - -e
      - /nix/store/g0gn91m56b267ncx05w93kihyqia39cm-builder.sh
  • The set of input source names do not match:
      - builder.sh
  • The set of input derivation names do not match:
      - bash-5.2p26
      - curl-8.7.1
      - mirrors-list
      - stdenv-linux
  • The environments do not match:
      - SSL_CERT_FILE=/no-cert-file.crt
      - __structuredAttrs=
      - buildInputs=
      - cmakeFlags=
      - configureFlags=
      - curlOpts=
      - curlOptsList=
      - depsBuildBuild=
      - depsBuildBuildPropagated=
      - depsBuildTarget=
      - depsBuildTargetPropagated=
      - depsHostHost=
      - depsHostHostPropagated=
      - depsTargetTarget=
      - depsTargetTargetPropagated=
      - doCheck=
      - doInstallCheck=
      - downloadToTemp=
      - mesonFlags=
      - mirrorsFile=/nix/store/djgnvvf2h21hnsyn7gng2r76fj0mp9zi-mirrors-list
      - nativeBuildInputs=/nix/store/gml8ycawxwdc6cjcycvkbnzg4byivkg7-curl-8.7.1-dev
      - nixpkgsVersion=24.05
      - outputs=out
      - patches=
      - postFetch=
      - preferHashedMirrors=1
      - propagatedBuildInputs=
      - propagatedNativeBuildInputs=
      - showURLs=
      - stdenv=/nix/store/qz53frww4qnx7p38q90kszlr4bhq2nfj-stdenv-linux
      - strictDeps=
      + unpack=
      + url=https://ftpmirror.gnu.org/bash/bash-5.2-patches/bash52-003
      impureEnvVars=''
      http_proxy https_proxy ftp_proxy all_proxy no_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY NIX_CURL_FLAGS NIX_HASHED_MIRRORS NIX_CONNECT_TIMEOUT NIX_MIRRORS_alsa NIX_MIRRORS_apache NIX_MIRRORS_bioc NIX_MIRRORS_bitlbee NIX_MIRRORS_centos NIX_MIRRORS_cpan NIX_MIRRORS_cran NIX_MIRRORS_debian NIX_MIRRORS_dub NIX_MIRRORS_fedora NIX_MIRRORS_gcc NIX_MIRRORS_gentoo NIX_MIRRORS_gnome NIX_MIRRORS_gnu NIX_MIRRORS_gnupg NIX_MIRRORS_hackage NIX_MIRRORS_hashedMirrors NIX_MIRRORS_ibiblioPubLinux NIX_MIRRORS_imagemagick NIX_MIRRORS_kde NIX_MIRRORS_kernel NIX_MIRRORS_luarocks NIX_MIRRORS_maven NIX_MIRRORS_mozilla NIX_MIRRORS_mysql NIX_MIRRORS_openbsd NIX_MIRRORS_opensuse NIX_MIRRORS_osdn NIX_MIRRORS_postgresql NIX_MIRRORS_pypi NIX_MIRRORS_qt NIX_MIRRORS_sageupstream NIX_MIRRORS_samba NIX_MIRRORS_savannah NIX_MIRRORS_sourceforge NIX_MIRRORS_steamrt NIX_MIRRORS_tcsh NIX_MIRRORS_testpypi NIX_MIRRORS_ubuntu NIX_MIRRORS_xfce NIX_MIRRORS_xorg        
  ''
      urls=''
      mirror://gnu/bash/bash-5.2-patches/bash52-003https://ftpmirror.gnu.org/bash/bash-5.2-patches/bash52-003
  ''
• The input derivation named `bash52-004` differs
  - /nix/store/6gixhx5y7pm92ygpm5d50bm5wyncvf86-bash52-004.drv:{out}
  + /nix/store/pk6bdyws4n421ak7mwvk5nkg0li7cvq2-bash52-004.drv:{out}
  • The platforms do not match
      - x86_64-linux
      + builtin
  • The builders do not match
      - /nix/store/wckka8fxv4h5hp74cbkhaw3fw7kbvcs1-bash-5.2p26/bin/bash
      + builtin:fetchurl
  • The arguments do not match
      - -e
      - /nix/store/g0gn91m56b267ncx05w93kihyqia39cm-builder.sh
  • The set of input source names do not match:
      - builder.sh
  • The set of input derivation names do not match:
      - bash-5.2p26
      - curl-8.7.1
      - mirrors-list
      - stdenv-linux
  • The environments do not match:
      - SSL_CERT_FILE=/no-cert-file.crt
      - __structuredAttrs=
      - buildInputs=
      - cmakeFlags=
      - configureFlags=
      - curlOpts=
      - curlOptsList=
      - depsBuildBuild=
      - depsBuildBuildPropagated=
      - depsBuildTarget=
      - depsBuildTargetPropagated=
      - depsHostHost=
      - depsHostHostPropagated=
      - depsTargetTarget=
      - depsTargetTargetPropagated=
      - doCheck=
      - doInstallCheck=
      - downloadToTemp=
      - mesonFlags=
      - mirrorsFile=/nix/store/djgnvvf2h21hnsyn7gng2r76fj0mp9zi-mirrors-list
      - nativeBuildInputs=/nix/store/gml8ycawxwdc6cjcycvkbnzg4byivkg7-curl-8.7.1-dev
      - nixpkgsVersion=24.05
      - outputs=out
      - patches=
      - postFetch=
      - preferHashedMirrors=1
      - propagatedBuildInputs=
      - propagatedNativeBuildInputs=
      - showURLs=
      - stdenv=/nix/store/qz53frww4qnx7p38q90kszlr4bhq2nfj-stdenv-linux
      - strictDeps=
      + unpack=
      + url=https://ftpmirror.gnu.org/bash/bash-5.2-patches/bash52-004
      impureEnvVars=''
      http_proxy https_proxy ftp_proxy all_proxy no_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY NIX_CURL_FLAGS NIX_HASHED_MIRRORS NIX_CONNECT_TIMEOUT NIX_MIRRORS_alsa NIX_MIRRORS_apache NIX_MIRRORS_bioc NIX_MIRRORS_bitlbee NIX_MIRRORS_centos NIX_MIRRORS_cpan NIX_MIRRORS_cran NIX_MIRRORS_debian NIX_MIRRORS_dub NIX_MIRRORS_fedora NIX_MIRRORS_gcc NIX_MIRRORS_gentoo NIX_MIRRORS_gnome NIX_MIRRORS_gnu NIX_MIRRORS_gnupg NIX_MIRRORS_hackage NIX_MIRRORS_hashedMirrors NIX_MIRRORS_ibiblioPubLinux NIX_MIRRORS_imagemagick NIX_MIRRORS_kde NIX_MIRRORS_kernel NIX_MIRRORS_luarocks NIX_MIRRORS_maven NIX_MIRRORS_mozilla NIX_MIRRORS_mysql NIX_MIRRORS_openbsd NIX_MIRRORS_opensuse NIX_MIRRORS_osdn NIX_MIRRORS_postgresql NIX_MIRRORS_pypi NIX_MIRRORS_qt NIX_MIRRORS_sageupstream NIX_MIRRORS_samba NIX_MIRRORS_savannah NIX_MIRRORS_sourceforge NIX_MIRRORS_steamrt NIX_MIRRORS_tcsh NIX_MIRRORS_testpypi NIX_MIRRORS_ubuntu NIX_MIRRORS_xfce NIX_MIRRORS_xorg        
  ''
      urls=''
      mirror://gnu/bash/bash-5.2-patches/bash52-004https://ftpmirror.gnu.org/bash/bash-5.2-patches/bash52-004
  ''
• The input derivation named `bash52-005` differs
  - /nix/store/xwxd5pi940874slspa82yxhw8ybp4y8q-bash52-005.drv:{out}
  + /nix/store/a68j9bys24cr3m1bixy4bz92q27bmx7k-bash52-005.drv:{out}
  • The platforms do not match
      - x86_64-linux
      + builtin
  • The builders do not match
      - /nix/store/wckka8fxv4h5hp74cbkhaw3fw7kbvcs1-bash-5.2p26/bin/bash
      + builtin:fetchurl
  • The arguments do not match
      - -e
      - /nix/store/g0gn91m56b267ncx05w93kihyqia39cm-builder.sh
  • The set of input source names do not match:
      - builder.sh
  • The set of input derivation names do not match:
      - bash-5.2p26
      - curl-8.7.1
      - mirrors-list
      - stdenv-linux
  • The environments do not match:
      - SSL_CERT_FILE=/no-cert-file.crt
      - __structuredAttrs=
      - buildInputs=
      - cmakeFlags=
      - configureFlags=
      - curlOpts=
      - curlOptsList=
      - depsBuildBuild=
      - depsBuildBuildPropagated=
      - depsBuildTarget=
      - depsBuildTargetPropagated=
      - depsHostHost=
      - depsHostHostPropagated=
      - depsTargetTarget=
      - depsTargetTargetPropagated=
      - doCheck=
      - doInstallCheck=
      - downloadToTemp=
      - mesonFlags=
      - mirrorsFile=/nix/store/djgnvvf2h21hnsyn7gng2r76fj0mp9zi-mirrors-list
      - nativeBuildInputs=/nix/store/gml8ycawxwdc6cjcycvkbnzg4byivkg7-curl-8.7.1-dev
      - nixpkgsVersion=24.05
      - outputs=out
      - patches=
      - postFetch=
      - preferHashedMirrors=1
      - propagatedBuildInputs=
      - propagatedNativeBuildInputs=
      - showURLs=
      - stdenv=/nix/store/qz53frww4qnx7p38q90kszlr4bhq2nfj-stdenv-linux
      - strictDeps=
      + unpack=
      + url=https://ftpmirror.gnu.org/bash/bash-5.2-patches/bash52-005
      impureEnvVars=''
      http_proxy https_proxy ftp_proxy all_proxy no_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY NIX_CURL_FLAGS NIX_HASHED_MIRRORS NIX_CONNECT_TIMEOUT NIX_MIRRORS_alsa NIX_MIRRORS_apache NIX_MIRRORS_bioc NIX_MIRRORS_bitlbee NIX_MIRRORS_centos NIX_MIRRORS_cpan NIX_MIRRORS_cran NIX_MIRRORS_debian NIX_MIRRORS_dub NIX_MIRRORS_fedora NIX_MIRRORS_gcc NIX_MIRRORS_gentoo NIX_MIRRORS_gnome NIX_MIRRORS_gnu NIX_MIRRORS_gnupg NIX_MIRRORS_hackage NIX_MIRRORS_hashedMirrors NIX_MIRRORS_ibiblioPubLinux NIX_MIRRORS_imagemagick NIX_MIRRORS_kde NIX_MIRRORS_kernel NIX_MIRRORS_luarocks NIX_MIRRORS_maven NIX_MIRRORS_mozilla NIX_MIRRORS_mysql NIX_MIRRORS_openbsd NIX_MIRRORS_opensuse NIX_MIRRORS_osdn NIX_MIRRORS_postgresql NIX_MIRRORS_pypi NIX_MIRRORS_qt NIX_MIRRORS_sageupstream NIX_MIRRORS_samba NIX_MIRRORS_savannah NIX_MIRRORS_sourceforge NIX_MIRRORS_steamrt NIX_MIRRORS_tcsh NIX_MIRRORS_testpypi NIX_MIRRORS_ubuntu NIX_MIRRORS_xfce NIX_MIRRORS_xorg        
  ''
      urls=''
      mirror://gnu/bash/bash-5.2-patches/bash52-005https://ftpmirror.gnu.org/bash/bash-5.2-patches/bash52-005
  ''

[character limit....]


Full diff: nix-diff-overlay-strange-behaviour · GitHub

1 Like

What one would require in order to look into this is a reproducible config.

What prev’s value is depends on the other overlays, and, as you noticed, the bootstrapping elements.
In general always use final in overlays, unless you can’t avoid it due to infrec.

I recently discovered that overlays are applied in the same function where the bootstrap is finalised; are you implying that prev therefore refers to the package set before bootstrap is done?

As @danielsidhion demonstrated to me before, overlays are applied on every bootstrap stage for some reason? So I assume that it’s possible yes. (I don’t really know much about boostrapping myself though.)

It certainly looks like it :confused:, but only some packages are affected by this:

let
  nixpkgs = builtins.fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/4a92571f9207810b559c9eac203d1f4d79830073.tar.gz";
    sha256 = "0sp7qjbb7dvrh4zvd40i6y7jwsd1v1qj44f0c95q88g7fikda8gq";
  };

  pkgs = import nixpkgs {
    overlays = [
      (final: prev: {
        bash-cached = final.bash;
        bash-not-cached = prev.bash;

        firefox-cached = final.firefox;
        firefox-also-cached = prev.firefox;
      })
    ];
  };
in
{
  inherit (pkgs)
    bash-cached # /nix/store/acg6rlmmgirs6x0ipfx001vhslxljz7c-bash-5.2p26.drv
    bash-not-cached # /nix/store/ixn4ykv3vy783cpv605sgpbmf5gdlm17-bash-5.2p26.drv
    firefox-cached # /nix/store/w6gh84569fqb5lwfrrpzsqniz7ymy5kn-firefox-129.0.drv
    firefox-also-cached # /nix/store/w6gh84569fqb5lwfrrpzsqniz7ymy5kn-firefox-129.0.drv
    ;
}

Notice how the derivation for firefox does not change if obtained from either prev or final.

In the same file linked by @waffle8946 we see this:

and this:

Both mention bash and gnugrep which where being recompiled when I tried using the value from prev, because they had references to bootstrap stage4

1 Like