Merge pull request #127989 from ymatsiuk/appgate

appgate-sdp: minimize and improve derivation

authored by

Elis Hirwing and committed by
GitHub
536cb54f 4f3bc6aa

+47 -76
+5 -3
nixos/modules/programs/appgate-sdp.nix
··· 5 { 6 options = { 7 programs.appgate-sdp = { 8 - enable = mkEnableOption 9 - "AppGate SDP VPN client"; 10 }; 11 }; 12 ··· 17 systemd = { 18 packages = [ pkgs.appgate-sdp ]; 19 # https://github.com/NixOS/nixpkgs/issues/81138 20 - services.appgatedriver.wantedBy = [ "multi-user.target" ]; 21 }; 22 }; 23 }
··· 5 { 6 options = { 7 programs.appgate-sdp = { 8 + enable = mkEnableOption "AppGate SDP VPN client"; 9 }; 10 }; 11 ··· 16 systemd = { 17 packages = [ pkgs.appgate-sdp ]; 18 # https://github.com/NixOS/nixpkgs/issues/81138 19 + services.appgatedriver.wantedBy = [ "multi-user.target" ]; 20 + services.appgate-dumb-resolver.path = [ pkgs.e2fsprogs ]; 21 + services.appgate-resolver.path = [ pkgs.procps pkgs.e2fsprogs ]; 22 + services.appgatedriver.path = [ pkgs.e2fsprogs ]; 23 }; 24 }; 25 }
+42 -73
pkgs/applications/networking/appgate-sdp/default.nix
··· 2 , at-spi2-atk 3 , at-spi2-core 4 , atk 5 - , bash 6 , cairo 7 - , coreutils 8 , cups 9 , curl 10 , dbus 11 , dnsmasq 12 , dpkg 13 - , e2fsprogs 14 , expat 15 , fetchurl 16 , gdk-pixbuf ··· 20 , iproute2 21 , krb5 22 , lib 23 - , mesa 24 , libdrm 25 - , libX11 26 - , libXScrnSaver 27 - , libXcomposite 28 - , libXcursor 29 - , libXdamage 30 - , libXext 31 - , libXfixes 32 - , libXi 33 - , libXrandr 34 - , libXrender 35 - , libXtst 36 - , libxkbcommon 37 , libsecret 38 , libuuid 39 , libxcb 40 , lttng-ust 41 , makeWrapper 42 , networkmanager 43 , nspr 44 , nss ··· 50 , stdenv 51 , systemd 52 , xdg-utils 53 , zlib 54 }: 55 with lib; ··· 69 gtk3 70 icu 71 krb5 72 - mesa 73 libdrm 74 - libX11 75 - libXScrnSaver 76 - libXcomposite 77 - libXcursor 78 - libXdamage 79 - libXext 80 - libXfixes 81 - libXi 82 - libXrandr 83 - libXrender 84 - libXtst 85 - libxkbcommon 86 libsecret 87 libuuid 88 libxcb 89 lttng-ust 90 nspr 91 nss 92 openssl 93 pango 94 stdenv.cc.cc 95 systemd 96 zlib 97 ]; 98 - rpath = lib.makeLibraryPath deps; 99 in 100 stdenv.mkDerivation rec { 101 pname = "appgate-sdp"; 102 version = "5.4.2"; 103 104 src = fetchurl { 105 - url = "https://bin.appgate-sdp.com/${lib.versions.majorMinor version}/client/appgate-sdp_${version}_amd64.deb"; 106 sha256 = "sha256-wAhcTRO/Cd4MG1lfPNDq92yGcu3NOfymucddy92VaXo="; 107 }; 108 109 dontConfigure = true; 110 dontBuild = true; 111 - enableParallelBuilding = true; 112 113 buildInputs = [ 114 python37 ··· 116 ]; 117 118 nativeBuildInputs = [ 119 makeWrapper 120 dpkg 121 ]; ··· 125 ''; 126 127 installPhase = '' 128 - mkdir -p $out/bin 129 - ln -s "$out/opt/appgate/appgate" "$out/bin/appgate" 130 cp -r $out/usr/share $out/share 131 132 - for file in $out/opt/appgate/linux/appgate-resolver.pre \ 133 - $out/opt/appgate/linux/appgate-dumb-resolver.pre 134 - do 135 - substituteInPlace $file \ 136 - --replace "/bin/sh" "${bash}/bin/sh" \ 137 - --replace "cat" "${coreutils}/bin/cat" \ 138 - --replace "chattr" "${e2fsprogs}/bin/chattr" \ 139 - --replace "mv " "${coreutils}/bin/mv " \ 140 - --replace "pkill" "${procps}/bin/pkill" 141 - done 142 143 - for file in $out/lib/systemd/system/appgatedriver.service \ 144 - $out/lib/systemd/system/appgate-dumb-resolver.service \ 145 - $out/lib/systemd/system/appgate-resolver.service 146 - do 147 - substituteInPlace $file \ 148 - --replace "/bin/sh" "${bash}/bin/sh" \ 149 --replace "/opt/" "$out/opt/" \ 150 - --replace "chattr" "${e2fsprogs}/bin/chattr" \ 151 - --replace "mv " "${coreutils}/bin/mv " 152 - done 153 - 154 - substituteInPlace $out/lib/systemd/system/appgatedriver.service \ 155 --replace "InaccessiblePaths=/mnt /srv /boot /media" "InaccessiblePaths=-/mnt -/srv -/boot -/media" 156 157 substituteInPlace $out/lib/systemd/system/appgate-resolver.service \ 158 --replace "/usr/sbin/dnsmasq" "${dnsmasq}/bin/dnsmasq" 159 160 - substituteInPlace $out/opt/appgate/linux/nm.py --replace "/usr/sbin/dnsmasq" "${dnsmasq}/bin/dnsmasq" 161 - substituteInPlace $out/opt/appgate/linux/set_dns --replace "/etc/appgate.conf" "$out/etc/appgate.conf" 162 163 - ''; 164 165 - postFixup = '' 166 - find $out -type f -name "*.so" -exec patchelf --set-rpath '$ORIGIN:${rpath}' {} \; 167 - for binary in $out/opt/appgate/appgate-driver \ 168 - $out/opt/appgate/appgate \ 169 - $out/opt/appgate/service/createdump \ 170 - $out/opt/appgate/service/appgateservice.bin 171 - do 172 - patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "$ORIGIN:$out/opt/appgate/service/:$out/opt/appgate/:${rpath}" $binary 173 - done 174 175 - # fail if there are missing dependencies 176 - ldd $out/opt/appgate/appgate | grep -i 'not found' && exit 1 177 - ldd $out/opt/appgate/service/appgateservice.bin | grep -i 'not found' && exit 1 178 - ldd $out/opt/appgate/appgate-driver | grep -i 'not found' && exit 1 179 180 - wrapProgram $out/opt/appgate/appgate-driver --prefix PATH : ${lib.makeBinPath [ iproute2 networkmanager dnsmasq ]} 181 wrapProgram $out/opt/appgate/linux/set_dns --set PYTHONPATH $PYTHONPATH 182 - wrapProgram $out/bin/appgate --prefix PATH : ${lib.makeBinPath [ xdg-utils ]} 183 ''; 184 meta = with lib; { 185 description = "Appgate SDP (Software Defined Perimeter) desktop client"; 186 homepage = "https://www.appgate.com/support/software-defined-perimeter-support"; ··· 189 maintainers = with maintainers; [ ymatsiuk ]; 190 }; 191 }
··· 2 , at-spi2-atk 3 , at-spi2-core 4 , atk 5 + , autoPatchelfHook 6 , cairo 7 , cups 8 , curl 9 , dbus 10 , dnsmasq 11 , dpkg 12 , expat 13 , fetchurl 14 , gdk-pixbuf ··· 18 , iproute2 19 , krb5 20 , lib 21 , libdrm 22 , libsecret 23 , libuuid 24 , libxcb 25 + , libxkbcommon 26 , lttng-ust 27 , makeWrapper 28 + , mesa 29 , networkmanager 30 , nspr 31 , nss ··· 37 , stdenv 38 , systemd 39 , xdg-utils 40 + , xorg 41 , zlib 42 }: 43 with lib; ··· 57 gtk3 58 icu 59 krb5 60 libdrm 61 libsecret 62 libuuid 63 libxcb 64 + libxkbcommon 65 lttng-ust 66 + mesa 67 nspr 68 nss 69 openssl 70 pango 71 stdenv.cc.cc 72 systemd 73 + xorg.libX11 74 + xorg.libXScrnSaver 75 + xorg.libXcomposite 76 + xorg.libXcursor 77 + xorg.libXdamage 78 + xorg.libXext 79 + xorg.libXfixes 80 + xorg.libXi 81 + xorg.libXrandr 82 + xorg.libXrender 83 + xorg.libXtst 84 + xorg.libxkbfile 85 + xorg.libxshmfence 86 zlib 87 ]; 88 in 89 stdenv.mkDerivation rec { 90 pname = "appgate-sdp"; 91 version = "5.4.2"; 92 93 src = fetchurl { 94 + url = "https://bin.appgate-sdp.com/${versions.majorMinor version}/client/appgate-sdp_${version}_amd64.deb"; 95 sha256 = "sha256-wAhcTRO/Cd4MG1lfPNDq92yGcu3NOfymucddy92VaXo="; 96 }; 97 98 + # just patch interpreter 99 + autoPatchelfIgnoreMissingDeps = true; 100 dontConfigure = true; 101 dontBuild = true; 102 103 buildInputs = [ 104 python37 ··· 106 ]; 107 108 nativeBuildInputs = [ 109 + autoPatchelfHook 110 makeWrapper 111 dpkg 112 ]; ··· 116 ''; 117 118 installPhase = '' 119 cp -r $out/usr/share $out/share 120 121 + substituteInPlace $out/lib/systemd/system/appgate-dumb-resolver.service \ 122 + --replace "/opt/" "$out/opt/" 123 124 + substituteInPlace $out/lib/systemd/system/appgatedriver.service \ 125 --replace "/opt/" "$out/opt/" \ 126 --replace "InaccessiblePaths=/mnt /srv /boot /media" "InaccessiblePaths=-/mnt -/srv -/boot -/media" 127 128 substituteInPlace $out/lib/systemd/system/appgate-resolver.service \ 129 + --replace "/usr/sbin/dnsmasq" "${dnsmasq}/bin/dnsmasq" \ 130 + --replace "/opt/" "$out/opt/" 131 + 132 + substituteInPlace $out/opt/appgate/linux/nm.py \ 133 --replace "/usr/sbin/dnsmasq" "${dnsmasq}/bin/dnsmasq" 134 135 + substituteInPlace $out/opt/appgate/linux/set_dns \ 136 + --replace "/etc/appgate.conf" "$out/etc/appgate.conf" 137 138 + wrapProgram $out/opt/appgate/service/createdump \ 139 + --set LD_LIBRARY_PATH "${makeLibraryPath [ stdenv.cc.cc ]}" 140 141 + wrapProgram $out/opt/appgate/appgate-driver \ 142 + --prefix PATH : ${makeBinPath [ iproute2 networkmanager dnsmasq ]} \ 143 + --set LD_LIBRARY_PATH $out/opt/appgate/service 144 145 + makeWrapper $out/opt/appgate/Appgate $out/bin/appgate \ 146 + --prefix PATH : ${makeBinPath [ xdg-utils ]} \ 147 + --set LD_LIBRARY_PATH $out/opt/appgate:${makeLibraryPath deps} 148 149 wrapProgram $out/opt/appgate/linux/set_dns --set PYTHONPATH $PYTHONPATH 150 ''; 151 + 152 meta = with lib; { 153 description = "Appgate SDP (Software Defined Perimeter) desktop client"; 154 homepage = "https://www.appgate.com/support/software-defined-perimeter-support"; ··· 157 maintainers = with maintainers; [ ymatsiuk ]; 158 }; 159 } 160 +