From 29bf6c5ca536288b5692157199f28ddab9f4a352 Mon Sep 17 00:00:00 2001 From: Evils Date: Tue, 11 Jul 2023 10:01:16 +0200 Subject: [PATCH] kicad.libraries.packages3d: use stepreduce & stepZ this makes it buildable by hydra stepreduce brings down closure size from 5.4G to 3.3G zip brings it down from 3.3G to 1.6G (or 5.4G to 1.9G without reduce) xz compressed NAR sizes are: plain: 373M gzip: 712M zip: 712M stepreduce: 262M stepreduce & gzip: 465M stepreduce & zip: 468M --- .../science/electronics/kicad/libraries.nix | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/science/electronics/kicad/libraries.nix b/pkgs/applications/science/electronics/kicad/libraries.nix index 9591cbc31c39..327f77d1c42f 100644 --- a/pkgs/applications/science/electronics/kicad/libraries.nix +++ b/pkgs/applications/science/electronics/kicad/libraries.nix @@ -2,6 +2,9 @@ , cmake , gettext , libSrc +, stepreduce +, parallel +, zip }: let mkLib = name: @@ -11,14 +14,20 @@ let src = libSrc name; - nativeBuildInputs = [ cmake ]; + nativeBuildInputs = [ cmake ] + ++ lib.optionals (name == "packages3d") [ + stepreduce + parallel + zip + ]; + + postInstall = lib.optional (name == "packages3d") '' + find $out -type f -name '*.step' | parallel 'stepreduce {} {} && zip -9 {.}.stpZ {} && rm {}' + ''; meta = rec { license = lib.licenses.cc-by-sa-40; platforms = lib.platforms.all; - # the 3d models are a ~1 GiB download and occupy ~5 GiB in store. - # this would exceed the hydra output limit - hydraPlatforms = if (name == "packages3d") then [ ] else platforms; }; }; in