about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2022-06-01 10:25:14 +0100
committerSergei Trofimovich <slyich@gmail.com>2022-06-01 10:28:06 +0100
commit3773e35a21f55c7c97e5a44ff7f65ed899d9e3ad (patch)
treec4be8a66d45307e964576f53fd0f0f5749124ebc
parent13785fcc8fe1fa281979c3e378ae3923bb3170e6 (diff)
downloadnixlib-3773e35a21f55c7c97e5a44ff7f65ed899d9e3ad.tar
nixlib-3773e35a21f55c7c97e5a44ff7f65ed899d9e3ad.tar.gz
nixlib-3773e35a21f55c7c97e5a44ff7f65ed899d9e3ad.tar.bz2
nixlib-3773e35a21f55c7c97e5a44ff7f65ed899d9e3ad.tar.lz
nixlib-3773e35a21f55c7c97e5a44ff7f65ed899d9e3ad.tar.xz
nixlib-3773e35a21f55c7c97e5a44ff7f65ed899d9e3ad.tar.zst
nixlib-3773e35a21f55c7c97e5a44ff7f65ed899d9e3ad.zip
netdata: do not persist ./configure flags to decrease closure size
Before:

    $ nix path-info -r ./result | wc -l
    76
    $ nix path-info -Sh ./result
    ...-netdata-1.34.1       366.8M

After:

    $ nix path-info -r ./result | wc -l
    30
    $ nix path-info -Sh ./result
    ...-netdata-1.34.1       205.7M
-rw-r--r--pkgs/tools/system/netdata/default.nix4
-rw-r--r--pkgs/tools/system/netdata/skip-CONFIGURE_COMMAND.patch16
2 files changed, 20 insertions, 0 deletions
diff --git a/pkgs/tools/system/netdata/default.nix b/pkgs/tools/system/netdata/default.nix
index b194b2f2a4b2..dd50e48f0735 100644
--- a/pkgs/tools/system/netdata/default.nix
+++ b/pkgs/tools/system/netdata/default.nix
@@ -49,6 +49,10 @@ in stdenv.mkDerivation rec {
     # Therefore we put it into `/run/netdata`, which is owned
     # by netdata only.
     ./ipc-socket-in-run.patch
+
+    # Avoid build-only inputs in closure leaked by configure command:
+    #   https://github.com/NixOS/nixpkgs/issues/175693#issuecomment-1143344162
+    ./skip-CONFIGURE_COMMAND.patch
   ];
 
   NIX_CFLAGS_COMPILE = optionalString withDebug "-O1 -ggdb -DNETDATA_INTERNAL_CHECKS=1";
diff --git a/pkgs/tools/system/netdata/skip-CONFIGURE_COMMAND.patch b/pkgs/tools/system/netdata/skip-CONFIGURE_COMMAND.patch
new file mode 100644
index 000000000000..fa7a0e7ad9c2
--- /dev/null
+++ b/pkgs/tools/system/netdata/skip-CONFIGURE_COMMAND.patch
@@ -0,0 +1,16 @@
+Shrink closure size by avoiding paths embedded from configure call.
+
+https://github.com/NixOS/nixpkgs/issues/175693
+--- a/daemon/buildinfo.c
++++ b/daemon/buildinfo.c
+@@ -248,7 +248,9 @@ void print_build_info(void) {
+     char *prebuilt_distro = NULL;
+     get_install_type(&install_type, &prebuilt_arch, &prebuilt_distro);
+ 
+-    printf("Configure options: %s\n", CONFIGURE_COMMAND);
++    // To minimize closure size do not persist configure options
++    // with build-time inputs.
++    printf("Configure options: REMOVED\n");
+ 
+     if (install_type == NULL) {
+         printf("Install type: unknown\n");