19 version = "1.3.3785.81";
20 src = fetchFromGitHub {
22 repo = "pritunl-client-electron";
24 sha256 = "sha256-0tlWX9vHiFHewiisI8lwsQdHyEhntu+x415hfbymhIo=";
28 pname = "pritunl-cli";
32 vendorHash = "sha256-1sAJbEZHagG6hnZBkb6EbQpSdNmTyTWfKpbektXSWYU=";
35 mv $out/bin/cli $out/bin/pritunl-client
39 service = buildGoModule {
40 pname = "pritunl-client-service";
44 vendorHash = "sha256-QvuEQX1+sJOGB1AJNhnM3pVPxGmizDu8EN1yRspXjhU=";
46 nativeBuildInputs = [ makeWrapper ];
49 sed -Ei service/profile/scripts.go \
50 -e 's|#!\s*(/usr)?/bin/(env )?bash\b|#! ${runtimeShell}|g'
51 '' + lib.optionalString stdenv.isLinux ''
52 sed -Ei service/profile/scripts.go \
53 -e 's|(/usr)?/s?bin/busctl\b|busctl|g' \
54 -e 's|(/usr)?/s?bin/resolvectl\b|resolvectl|g' \
55 -e 's|(/usr)?/s?bin/ip\b|ip|g'
59 mv $out/bin/service $out/bin/pritunl-client-service
60 '' + lib.optionalString stdenv.isLinux ''
61 mkdir -p $out/lib/systemd/system/
62 cp $src/resources_linux/pritunl-client.service $out/lib/systemd/system/
63 substituteInPlace $out/lib/systemd/system/pritunl-client.service \
64 --replace "/usr" "$out"
73 ] ++ lib.optionals stdenv.isLinux [
78 openvpn-wrapped = runCommand "openvpn-wrapped" {
79 nativeBuildInputs = [ makeWrapper ];
82 makeWrapper ${openvpn}/bin/openvpn $out/bin/openvpn \
83 --prefix PATH : ${lib.makeBinPath hookScriptsDeps} \
84 --add-flags "--setenv PATH \$PATH"
86 in lib.optionalString stdenv.isLinux ''
87 wrapProgram $out/bin/pritunl-client-service \
88 --prefix PATH : "${lib.makeBinPath ([ openvpn-wrapped ])}"
91 in stdenv.mkDerivation {
92 pname = "pritunl-client";
107 ln -s ${cli}/bin/pritunl-client $out/bin/
108 ln -s ${service}/bin/pritunl-client-service $out/bin/
111 cp -r client $out/lib/pritunl_client_electron
113 makeWrapper ${electron}/bin/electron $out/bin/pritunl-client-electron \
114 --add-flags $out/lib/pritunl_client_electron
116 '' + lib.optionalString stdenv.isLinux ''
117 mkdir -p $out/lib/systemd/system/
118 ln -s ${service}/lib/systemd/system/pritunl-client.service $out/lib/systemd/system/
120 mkdir -p $out/share/icons/
121 cp -r resources_linux/icons $out/share/icons/hicolor
123 mkdir -p $out/share/applications/
124 cp resources_linux/pritunl-client-electron.desktop $out/share/applications/
125 substituteInPlace $out/share/applications/pritunl-client-electron.desktop \
126 --replace "/usr/lib/pritunl_client_electron/Pritunl" "$out/bin/pritunl-client-electron"
128 # install shell completions for pritunl-client
129 installShellCompletion --cmd pritunl-client \
130 --bash <($out/bin/pritunl-client completion bash) \
131 --fish <($out/bin/pritunl-client completion fish) \
132 --zsh <($out/bin/pritunl-client completion zsh)
138 description = "Pritunl OpenVPN client";
139 homepage = "https://client.pritunl.com/";
140 license = licenses.unfree;
141 maintainers = with maintainers; [ minizilla andrevmatos ];