From 71a572c937b06e87a93b2c2f5fd8656bb4e46378 Mon Sep 17 00:00:00 2001 From: Shogo Takata Date: Wed, 9 Apr 2025 13:11:59 +0900 Subject: [PATCH] gitlab-ci-local: remove unused dependencies this reduces the closure size from 1.2GB to 220MB dependencies removed - python3 - nodejs source - gcc --- pkgs/by-name/gi/gitlab-ci-local/package.nix | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pkgs/by-name/gi/gitlab-ci-local/package.nix b/pkgs/by-name/gi/gitlab-ci-local/package.nix index 20f10ef517a4..0e1250e287f1 100644 --- a/pkgs/by-name/gi/gitlab-ci-local/package.nix +++ b/pkgs/by-name/gi/gitlab-ci-local/package.nix @@ -34,6 +34,29 @@ buildNpmPackage rec { ''; postInstall = '' + NODE_MODULES=$out/lib/node_modules/gitlab-ci-local/node_modules + + # Remove intermediate build files for re2 to reduce dependencies. + # + # This does not affect the behavior. On npm `re2` does not ship + # the build directory and downloads a prebuilt version of the + # `re2.node` binary. This method produces the same result. + find $NODE_MODULES/re2/build -type f ! -path "*/Release/re2.node" -delete + strip -x $NODE_MODULES/re2/build/Release/re2.node + + # Remove files that depend on python3 + # + # The node-gyp package is only used for building re2, so it is + # not needed at runtime. I did not remove the whole directory + # because of some dangling links to the node-gyp directory which + # is not required. It is possible to remove the directory and all + # the files that link to it, but I figured it was not worth + # tracking down the files. + # + # The re2/vendor directory is used for building the re2.node + # binary, so it is not needed at runtime. + rm -rf $NODE_MODULES/{node-gyp/gyp,re2/vendor} + wrapProgram $out/bin/gitlab-ci-local \ --prefix PATH : "${ lib.makeBinPath [