aboutsummaryrefslogtreecommitdiff
path: root/default.nix
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2019-06-04 18:53:09 +1000
committerJustin Bedo <cu@cua0.org>2019-06-04 18:53:09 +1000
commita7b06b941b30feaf8b3b0e0ad1bc986d58d9f9ac (patch)
treebe27b68d6a2f233baf03e5d4cad024648ec67a71 /default.nix
parentb714521422af63a910ff660dcc019cbaeb6a5d17 (diff)
strip: handle non-buildCommand based stages
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix11
1 files changed, 8 insertions, 3 deletions
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 {