replaceDependency in .config/nixpkgs/config.nix results in error

Hi,

Recently I have solved #167785 by

system.replaceRuntimeDependencies = [
    {
      original = pkgs.glibc;
      replacement = pkgs.glibc.overrideAttrs (old: {
        patches = old.patches ++ [
          (pkgs.fetchpatch {
            url = "https://patchwork.sourceware.org/project/glibc/patch/20220314175316.3239120-2-sam@gentoo.org/raw/";
            hash = "sha256-YNqBMiNQW78cPu740P01iefAM4EQU9YwRAAmfh9Mfp0=";
          })
        ];
      });
    }
];

This is not applied to user’s environment. So I put the following code to ~/.config/nixpkgs/config.nix:

{
  packageOverrides = pkgs: with pkgs; {
    myFirefox = replaceDependency {
      drv = firefox;
      oldDependency = glibc;
      newDependency = lib.overrideDerivation glibc (old: {
        patches = old.patches ++ [
          (fetchpatch {
            url = "https://patchwork.sourceware.org/project/glibc/patch/20220314175316.3239120-2-sam@gentoo.org/raw/";
            hash = "sha256-YNqBMiNQW78cPu740P01iefAM4EQU9YwRAAmfh9Mfp0=";
          })
        ];
      });
    };
  };
}

But nix-env -iA nixos.myFirefox results in

error: path '/nix/store/gpsdyyhkj4bk13pk5lf6ivjrnvg38v4c-glibc-2.34-115' does not exist and cannot be created

What is wrong? And how can I replaceDependency for the all installed packages in user environment?