The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(nix): patch patchelf so pm's Linux binaries survive autoPatchelf
ethernet5a5aa9a3a8d3
diff --git a/nix/pm-packages.nix b/nix/pm-packages.nixindex 7ba9b577f21..a19d779ec7a 100644--- a/nix/pm-packages.nix+++ b/nix/pm-packages.nix@@ -5,6 +5,7 @@unzip,autoPatchelfHook,patchelf,+ fetchpatch,}:# The thin translation layer: pm/lock.json -> one fetched, unpacked# derivation per package for this nix system. Nothing here knows versions,@@ -51,6 +52,22 @@ letoriginRpath = name: stdenv.hostPlatform.isLinux && name == "python";patchElf = name: stdenv.hostPlatform.isLinux && name != "python";+ # patchelf 0.19.2 corrupts executables whose headers it must move: running+ # --set-interpreter before --set-rpath (autoPatchelf's order) leaves a+ # read-only LOAD overlapping the RW one, so ld.so faults on .dynamic and+ # node segfaults on start (NixOS/patchelf#674). Fixed upstream by #672, not+ # yet released; drop this once nixpkgs ships a patchelf that contains it.+ patchelfFixed = patchelf.overrideAttrs (old: {+ patches = (old.patches or [ ]) ++ [+ (fetchpatch {+ name = "patchelf-fix-executable-header-load-overlap.patch";+ url = "https://github.com/NixOS/patchelf/commit/59acc3d98b4961cfddf02090d9426ac735603218.patch";+ includes = [ "src/*" ];+ hash = "sha256-rQWWZlCa4IRrcPcxMD2xrTTD4nLOsWfdZLOk9UoIOIs=";+ })+ ];+ });+derive = name: pin: artifacts:stdenv.mkDerivation {pname = name;@@ -66,7 +83,8 @@ let# pm merges them into one store entry.sourceRoot = ".";nativeBuildInputs =- lib.optionals (originRpath name) [ patchelf ]+ # patchelfFixed precedes the hook so its `patchelf` wins on PATH.+ lib.optionals (originRpath name || patchElf name) [ patchelfFixed ]++ lib.optional (patchElf name) autoPatchelfHook++ lib.optional (lib.any (a: lib.hasSuffix ".zip" a.url) artifacts) unzip;# The upstream tarballs are glibc-linked (interpreter