|
1 | | -{ buildGoModule |
2 | | -, fetchFromGitHub |
3 | | -, lib |
4 | | -, wirelesstools |
5 | | -, makeWrapper |
6 | | -, wireguard-tools |
7 | | -, openvpn |
8 | | -, obfs4 |
9 | | -, iproute2 |
10 | | -, dnscrypt-proxy |
11 | | -, iptables |
12 | | -, gawk |
13 | | -, util-linux |
| 1 | +{ |
| 2 | + buildGoModule, |
| 3 | + fetchFromGitHub, |
| 4 | + lib, |
| 5 | + wirelesstools, |
| 6 | + makeWrapper, |
| 7 | + wireguard-tools, |
| 8 | + openvpn, |
| 9 | + obfs4, |
| 10 | + iproute2, |
| 11 | + dnscrypt-proxy, |
| 12 | + iptables, |
| 13 | + gawk, |
| 14 | + util-linux, |
14 | 15 | }: |
15 | 16 |
|
16 | | -builtins.mapAttrs (pname: attrs: buildGoModule (attrs // rec { |
17 | | - inherit pname; |
18 | | - version = "3.10.15"; |
| 17 | +builtins.mapAttrs |
| 18 | + ( |
| 19 | + pname: attrs: |
| 20 | + buildGoModule ( |
| 21 | + attrs |
| 22 | + // rec { |
| 23 | + inherit pname; |
| 24 | + version = "3.14.29"; |
19 | 25 |
|
20 | | - src = fetchFromGitHub { |
21 | | - owner = "ivpn"; |
22 | | - repo = "desktop-app"; |
23 | | - rev = "v${version}"; |
24 | | - hash = "sha256-3yVRVM98tVjot3gIkUb/CDwmwKdOOBjBjzGL6htDtpk="; |
25 | | - }; |
| 26 | + buildInputs = [ |
| 27 | + wirelesstools |
| 28 | + ]; |
26 | 29 |
|
27 | | - ldflags = [ |
28 | | - "-s" |
29 | | - "-w" |
30 | | - "-X github.com/ivpn/desktop-app/daemon/version._version=${version}" |
31 | | - "-X github.com/ivpn/desktop-app/daemon/version._time=1970-01-01" |
32 | | - ]; |
| 30 | + src = fetchFromGitHub { |
| 31 | + owner = "ivpn"; |
| 32 | + repo = "desktop-app"; |
| 33 | + rev = "refs/tags/v${version}"; |
| 34 | + hash = "sha256-8JScty/sGyxzC2ojRpatHpCqEXZw9ksMortIhZnukoU="; |
| 35 | + }; |
33 | 36 |
|
34 | | - postInstall = '' |
35 | | - mv $out/bin/{${attrs.modRoot},${pname}} |
36 | | - ''; |
| 37 | + proxyVendor = true; # .c file |
37 | 38 |
|
38 | | - meta = with lib; { |
39 | | - description = "Official IVPN Desktop app"; |
40 | | - homepage = "https://www.ivpn.net/apps"; |
41 | | - changelog = "https://github.com/ivpn/desktop-app/releases/tag/v${version}"; |
42 | | - license = licenses.gpl3Only; |
43 | | - maintainers = with maintainers; [ urandom ataraxiasjel ]; |
44 | | - mainProgram = "ivpn"; |
45 | | - }; |
46 | | -})) { |
47 | | - ivpn = { |
48 | | - modRoot = "cli"; |
49 | | - vendorHash = "sha256-T49AE3SUmdP3Tu9Sp5C/QryKDto/NzEqRuUQ3+aJFL0="; |
50 | | - }; |
51 | | - ivpn-service = { |
52 | | - modRoot = "daemon"; |
53 | | - vendorHash = "sha256-9Rk6ruMpyWtQe+90kw4F8OLq7/JcDSrG6ufkfcrS4W8="; |
54 | | - nativeBuildInputs = [ makeWrapper ]; |
55 | | - buildInputs = [ wirelesstools ]; |
| 39 | + ldflags = [ |
| 40 | + "-s" |
| 41 | + "-w" |
| 42 | + "-X github.com/ivpn/desktop-app/daemon/version._version=${version}" |
| 43 | + "-X github.com/ivpn/desktop-app/daemon/version._time=1970-01-01" |
| 44 | + ]; |
56 | 45 |
|
57 | | - patches = [ ./permissions.patch ]; |
58 | | - postPatch = '' |
59 | | - substituteInPlace daemon/service/platform/platform_linux.go \ |
60 | | - --replace 'openVpnBinaryPath = "/usr/sbin/openvpn"' \ |
61 | | - 'openVpnBinaryPath = "${openvpn}/bin/openvpn"' \ |
62 | | - --replace 'routeCommand = "/sbin/ip route"' \ |
63 | | - 'routeCommand = "${iproute2}/bin/ip route"' |
| 46 | + postInstall = '' |
| 47 | + mv $out/bin/{${attrs.modRoot},${pname}} |
| 48 | + ''; |
64 | 49 |
|
65 | | - substituteInPlace daemon/netinfo/netinfo_linux.go \ |
66 | | - --replace 'retErr := shell.ExecAndProcessOutput(log, outParse, "", "/sbin/ip", "route")' \ |
67 | | - 'retErr := shell.ExecAndProcessOutput(log, outParse, "", "${iproute2}/bin/ip", "route")' |
| 50 | + meta = { |
| 51 | + description = "Official IVPN Desktop app"; |
| 52 | + homepage = "https://www.ivpn.net/apps"; |
| 53 | + changelog = "https://github.com/ivpn/desktop-app/releases/tag/v${version}"; |
| 54 | + license = lib.licenses.gpl3Only; |
| 55 | + maintainers = with lib.maintainers; [ |
| 56 | + urandom |
| 57 | + ataraxiasjel |
| 58 | + ]; |
| 59 | + mainProgram = "ivpn"; |
| 60 | + }; |
| 61 | + } |
| 62 | + ) |
| 63 | + ) |
| 64 | + { |
| 65 | + ivpn = { |
| 66 | + modRoot = "cli"; |
| 67 | + vendorHash = "sha256-STbkFchrmxwWnSgEJ7RGKN3jGaCC0npL80YjlwUcs1g="; |
| 68 | + }; |
| 69 | + ivpn-service = { |
| 70 | + modRoot = "daemon"; |
| 71 | + vendorHash = "sha256-REIY3XPyMA2Loxo1mKzJMJwZrf9dQMOtnQOUEgN5LP8="; |
| 72 | + nativeBuildInputs = [ makeWrapper ]; |
68 | 73 |
|
69 | | - substituteInPlace daemon/service/platform/platform_linux_release.go \ |
70 | | - --replace 'installDir := "/opt/ivpn"' "installDir := \"$out\"" \ |
71 | | - --replace 'obfsproxyStartScript = path.Join(installDir, "obfsproxy/obfs4proxy")' \ |
72 | | - 'obfsproxyStartScript = "${lib.getExe obfs4}"' \ |
73 | | - --replace 'wgBinaryPath = path.Join(installDir, "wireguard-tools/wg-quick")' \ |
74 | | - 'wgBinaryPath = "${wireguard-tools}/bin/wg-quick"' \ |
75 | | - --replace 'wgToolBinaryPath = path.Join(installDir, "wireguard-tools/wg")' \ |
76 | | - 'wgToolBinaryPath = "${wireguard-tools}/bin/wg"' \ |
77 | | - --replace 'dnscryptproxyBinPath = path.Join(installDir, "dnscrypt-proxy/dnscrypt-proxy")' \ |
78 | | - 'dnscryptproxyBinPath = "${dnscrypt-proxy}/bin/dnscrypt-proxy"' |
79 | | - ''; |
| 74 | + patches = [ ./permissions.patch ]; |
| 75 | + postPatch = '' |
| 76 | + substituteInPlace daemon/service/platform/platform_linux.go \ |
| 77 | + --replace 'openVpnBinaryPath = "/usr/sbin/openvpn"' \ |
| 78 | + 'openVpnBinaryPath = "${openvpn}/bin/openvpn"' \ |
| 79 | + --replace 'routeCommand = "/sbin/ip route"' \ |
| 80 | + 'routeCommand = "${iproute2}/bin/ip route"' |
80 | 81 |
|
81 | | - postFixup = '' |
82 | | - mkdir -p $out/etc |
83 | | - cp -r $src/daemon/References/Linux/etc/* $out/etc/ |
84 | | - cp -r $src/daemon/References/common/etc/* $out/etc/ |
| 82 | + substituteInPlace daemon/netinfo/netinfo_linux.go \ |
| 83 | + --replace 'retErr := shell.ExecAndProcessOutput(log, outParse, "", "/sbin/ip", "route")' \ |
| 84 | + 'retErr := shell.ExecAndProcessOutput(log, outParse, "", "${iproute2}/bin/ip", "route")' |
85 | 85 |
|
86 | | - patchShebangs --build $out/etc/firewall.sh $out/etc/splittun.sh $out/etc/client.down $out/etc/client.up |
| 86 | + substituteInPlace daemon/service/platform/platform_linux_release.go \ |
| 87 | + --replace 'installDir := "/opt/ivpn"' "installDir := \"$out\"" \ |
| 88 | + --replace 'obfsproxyStartScript = path.Join(installDir, "obfsproxy/obfs4proxy")' \ |
| 89 | + 'obfsproxyStartScript = "${lib.getExe obfs4}"' \ |
| 90 | + --replace 'wgBinaryPath = path.Join(installDir, "wireguard-tools/wg-quick")' \ |
| 91 | + 'wgBinaryPath = "${wireguard-tools}/bin/wg-quick"' \ |
| 92 | + --replace 'wgToolBinaryPath = path.Join(installDir, "wireguard-tools/wg")' \ |
| 93 | + 'wgToolBinaryPath = "${wireguard-tools}/bin/wg"' \ |
| 94 | + --replace 'dnscryptproxyBinPath = path.Join(installDir, "dnscrypt-proxy/dnscrypt-proxy")' \ |
| 95 | + 'dnscryptproxyBinPath = "${dnscrypt-proxy}/bin/dnscrypt-proxy"' |
| 96 | + ''; |
87 | 97 |
|
88 | | - wrapProgram "$out/bin/ivpn-service" \ |
89 | | - --suffix PATH : ${lib.makeBinPath [ iptables gawk util-linux ]} |
90 | | - ''; |
91 | | - }; |
92 | | -} |
| 98 | + postFixup = '' |
| 99 | + mkdir -p $out/etc |
| 100 | + cp -r $src/daemon/References/Linux/etc/* $out/etc/ |
| 101 | + cp -r $src/daemon/References/common/etc/* $out/etc/ |
| 102 | +
|
| 103 | + patchShebangs --build $out/etc/firewall.sh $out/etc/splittun.sh $out/etc/client.down $out/etc/client.up |
| 104 | +
|
| 105 | + wrapProgram "$out/bin/ivpn-service" \ |
| 106 | + --suffix PATH : ${ |
| 107 | + lib.makeBinPath [ |
| 108 | + iptables |
| 109 | + gawk |
| 110 | + util-linux |
| 111 | + ] |
| 112 | + } |
| 113 | + ''; |
| 114 | + }; |
| 115 | + } |
0 commit comments