From 7c873ca7514d185850e369d79f1757b9297efa54 Mon Sep 17 00:00:00 2001 From: mangoiv Date: Sat, 15 Jun 2024 19:29:26 +0200 Subject: [PATCH] [feat] add compression --- nix/static.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/nix/static.nix b/nix/static.nix index c0e2d14..ea00fd7 100644 --- a/nix/static.nix +++ b/nix/static.nix @@ -3,7 +3,8 @@ hlib = pkgsStatic.haskell.lib.compose; hspkgs = pkgsStatic.haskellPackages.override { overrides = - pkgs.lib.composeExtensions (import ./haskell-overlay.nix {inherit hlib;}) + pkgs.lib.composeExtensions + (import ./haskell-overlay.nix {inherit hlib;}) (_hself: hsuper: { cabal-install = hlib.overrideCabal { @@ -25,4 +26,15 @@ }); }; in - hlib.justStaticExecutables hspkgs.cabal-audit + (hlib.justStaticExecutables hspkgs.cabal-audit).overrideAttrs (old: { + postPhases = ["compressionPhase"]; + nativeBuildInputs = + old.nativeBuildInputs + ++ [ + pkgsStatic.upx + ]; + compressionPhase = '' + echo "this might take a while.." + upx --quiet --best $out/bin/cabal-audit + ''; + })