@@ -0,0 +1,20 @@
1+diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py
2+index 77ac03d66..d12f77592 100644
3+--- a/mesonbuild/scripts/depfixer.py
4++++ b/mesonbuild/scripts/depfixer.py
5+@@ -337,6 +337,15 @@ class Elf(DataSizes):
6+ if not new_rpath:
7+ self.remove_rpath_entry(entrynum)
8+ else:
9++ # Clear old rpath to avoid stale references,
10++ # not heeding the warning above about de-duplication
11++ # since it does not seem to cause issues for us
12++ # and not doing so trips up Nix’s reference checker.
13++ # See https://github.com/NixOS/nixpkgs/pull/46020
14++ # and https://github.com/NixOS/nixpkgs/issues/95163
15++ self.bf.seek(rp_off)
16++ self.bf.write(b'\0'*len(old_rpath))
17++
18+ self.bf.seek(rp_off)
19+ self.bf.write(new_rpath)
20+ self.bf.write(b'\0')