net-snmp: drop build-only references from the closure

Before the change `net-snmp` embedded it's `./configure` options as is
and retained unneeded dependencies:

$ nix path-info -rSh $(nix-build -A net-snmp.lib) | nl |& unnix
1 /<<NIX>>/libunistring-1.1 1.8M
2 /<<NIX>>/xgcc-12.3.0-libgcc 139.1K
3 /<<NIX>>/libidn2-2.3.4 2.1M
4 /<<NIX>>/glibc-2.38-23 31.1M
5 /<<NIX>>/net-snmp-5.9.4 1.7M
6 /<<NIX>>/bash-5.2-p15 32.6M
7 /<<NIX>>/openssl-3.0.11 37.3M
8 /<<NIX>>/openssl-3.0.11-bin 39.8M
9 /<<NIX>>/openssl-3.0.11-dev 41.7M
10 /<<NIX>>/net-snmp-5.9.4-lib 46.2M

After the change the closure skips `openssl.dev` input and gets rid of
5MB of closure:

$ nix path-info -rSh $(nix-build -A net-snmp.lib) | nl |& unnix
1 /<<NIX>>/libunistring-1.1 1.8M
2 /<<NIX>>/xgcc-12.3.0-libgcc 139.1K
3 /<<NIX>>/libidn2-2.3.4 2.1M
4 /<<NIX>>/glibc-2.38-23 31.1M
5 /<<NIX>>/net-snmp-5.9.4 1.7M
6 /<<NIX>>/openssl-3.0.11 37.3M
7 /<<NIX>>/net-snmp-5.9.4-lib 41.8M

+9 -5
+9 -5
pkgs/servers/monitoring/net-snmp/default.nix
··· 1 - { lib, stdenv, fetchurl, fetchpatch, removeReferencesTo 2 , file, openssl, perl, perlPackages, nettools 3 , withPerlTools ? false }: let 4 ··· 45 substituteInPlace testing/fulltests/support/simple_TESTCONF.sh --replace "/bin/netstat" "${nettools}/bin/netstat" 46 ''; 47 48 - nativeBuildInputs = [ nettools removeReferencesTo file ]; 49 buildInputs = [ openssl ] 50 ++ lib.optional withPerlTools perlWithPkgs; 51 ··· 61 done 62 mkdir $dev/bin 63 mv $bin/bin/net-snmp-config $dev/bin 64 - # libraries contain configure options 65 - find $lib/lib -type f -exec remove-references-to -t $bin '{}' + 66 - find $lib/lib -type f -exec remove-references-to -t $dev '{}' + 67 ''; 68 69 meta = with lib; {
··· 1 + { lib, stdenv, fetchurl, fetchpatch 2 , file, openssl, perl, perlPackages, nettools 3 , withPerlTools ? false }: let 4 ··· 45 substituteInPlace testing/fulltests/support/simple_TESTCONF.sh --replace "/bin/netstat" "${nettools}/bin/netstat" 46 ''; 47 48 + postConfigure = '' 49 + # libraries contain configure options. Mangle store paths out from 50 + # ./configure-generated file. 51 + sed -i include/net-snmp/net-snmp-config.h \ 52 + -e "/NETSNMP_CONFIGURE_OPTIONS/ s|$NIX_STORE/[a-z0-9]\{32\}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" 53 + ''; 54 + 55 + nativeBuildInputs = [ nettools file ]; 56 buildInputs = [ openssl ] 57 ++ lib.optional withPerlTools perlWithPkgs; 58 ··· 68 done 69 mkdir $dev/bin 70 mv $bin/bin/net-snmp-config $dev/bin 71 ''; 72 73 meta = with lib; {