From a7b06b941b30feaf8b3b0e0ad1bc986d58d9f9ac Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Tue, 4 Jun 2019 18:53:09 +1000 Subject: strip: handle non-buildCommand based stages --- default.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index 15b8d87..450118d 100644 --- a/default.nix +++ b/default.nix @@ -77,8 +77,8 @@ let lib = nixpkgs.lib // { types = types; shard = callBionix ./lib/shard.nix {};}; stage = x@{ name, stripStorePaths ? true, multicore ? false, ... }: (if stripStorePaths then strip else x: x) (nixpkgs.stdenvNoCC.mkDerivation (x // {name = "bionix-" + name; inherit multicore;})); - strip = drv: drv.overrideAttrs (attrs: { - buildCommand = attrs.buildCommand + '' + strip = drv: let + stripCommand = '' function rewrite { sed -i 's|/nix/store/[^-]*|/nix/store/00000000000000000000000000000000|g' $1 @@ -96,7 +96,12 @@ let rewriteOutput $o done ''; - }); + in drv.overrideAttrs (attrs: + if attrs ? buildCommand then + {buildCommand = attrs.buildCommand + stripCommand;} + else + { fixupPhase = (if attrs ? fixupPhase then attrs.fixupPhase else "") + stripCommand; } + ); # splitting/joining splitFile = file: drv: stage { -- cgit v1.2.3