From d52102e1a190aa5d44e8ea908bd9b452ee273714 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Mon, 7 Nov 2022 22:48:59 +0100 Subject: nix: strip ghc dependencies from output --- default.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3