aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuebinm2022-11-07 22:48:59 +0100
committerstuebinm2022-11-07 22:48:59 +0100
commitd52102e1a190aa5d44e8ea908bd9b452ee273714 (patch)
tree107e834ca89a75ec369386f59a336c6fdc0685e0
parent48c42f93b040e0a27037c1a6728dd9dc2bd4f573 (diff)
nix: strip ghc dependencies from output
-rw-r--r--default.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/default.nix b/default.nix
index 73021ff..a8c75d8 100644
--- a/default.nix
+++ b/default.nix
@@ -53,4 +53,15 @@ let
drv = variant (haskellPackages.callPackage f {});
-in drv
+ # this removes the /lib directory from the built derivation, which depends on ghc.
+ # this dramatically reduces closure size
+ stripLib = drv: pkgs.stdenv.mkDerivation {
+ name = drv.name + "-without-lib";
+ src = drv.outPath;
+ buildPhase = ''
+ mkdir -p $out
+ cp -r $src/bin $out
+ '';
+ phases = [ "buildPhase" ];
+ };
+in stripLib drv