From eebc44e609cc2f901c7ea694d62e36f63cbeae24 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Mon, 20 Dec 2021 14:38:24 +1100 Subject: rewrite strip store paths Old version used sed, which is not inplace and causes issues when garbage collection triggers during a build. This patch adds a small rewriter that works in place. --- default.nix | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index 8d262f7..04fd62c 100644 --- a/default.nix +++ b/default.nix @@ -147,17 +147,15 @@ let })); strip = drv: let + strip-store-paths = nixpkgs.callPackage ./strip-store-paths { }; stripCommand = '' - function rewrite { - sed -i 's|[A-Za-z0-9+/]\{32\}-bionix|00000000000000000000000000000000-bionix|g' $1 - } function rewriteOutput { if [ -f ''${!1} ] ; then - rewrite ''${!1} + strip-store-paths ''${!1} else for f in $(find ''${!1} -type f) ; do - rewrite $f + strip-store-paths $f done fi } @@ -167,12 +165,14 @@ let ''; in drv.overrideAttrs (attrs: - if attrs ? buildCommand then { - buildCommand = attrs.buildCommand + stripCommand; - } else { - fixupPhase = (if attrs ? fixupPhase then attrs.fixupPhase else "") + { nativeBuildInputs = attrs.nativeBuildInputs or [ ] ++ [ strip-store-paths ]; } // ( + if attrs ? buildCommand then { + buildCommand = attrs.buildCommand + stripCommand; + } else { + fixupPhase = (if attrs ? fixupPhase then attrs.fixupPhase else "") + stripCommand; - }); + } + )); # splitting/joining splitFile = file: drv: -- cgit v1.2.3