diff options
author | Justin Bedo <cu@cua0.org> | 2021-12-20 14:38:24 +1100 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2021-12-20 14:38:24 +1100 |
commit | eebc44e609cc2f901c7ea694d62e36f63cbeae24 (patch) | |
tree | 4c7c07991a64c2480dd02490110ae62885c7bc2d /default.nix | |
parent | 6979eda7260b804099a39b27e417d942feb722b9 (diff) |
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.
Diffstat (limited to 'default.nix')
-rw-r--r-- | default.nix | 20 |
1 files changed, 10 insertions, 10 deletions
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: |