From 09a6d41fdc5f666d33d3e49790953a93d34d86c0 Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Fri, 8 Nov 2024 16:38:54 +0800 Subject: [PATCH 1/2] ivpn: nixfmt --- pkgs/tools/networking/ivpn/default.nix | 178 ++++++++++++++----------- 1 file changed, 98 insertions(+), 80 deletions(-) diff --git a/pkgs/tools/networking/ivpn/default.nix b/pkgs/tools/networking/ivpn/default.nix index cdc3035e57a6..818f66ae02db 100644 --- a/pkgs/tools/networking/ivpn/default.nix +++ b/pkgs/tools/networking/ivpn/default.nix @@ -1,92 +1,110 @@ -{ buildGoModule -, fetchFromGitHub -, lib -, wirelesstools -, makeWrapper -, wireguard-tools -, openvpn -, obfs4 -, iproute2 -, dnscrypt-proxy -, iptables -, gawk -, util-linux +{ + buildGoModule, + fetchFromGitHub, + lib, + wirelesstools, + makeWrapper, + wireguard-tools, + openvpn, + obfs4, + iproute2, + dnscrypt-proxy, + iptables, + gawk, + util-linux, }: -builtins.mapAttrs (pname: attrs: buildGoModule (attrs // rec { - inherit pname; - version = "3.10.15"; +builtins.mapAttrs + ( + pname: attrs: + buildGoModule ( + attrs + // rec { + inherit pname; + version = "3.10.15"; - src = fetchFromGitHub { - owner = "ivpn"; - repo = "desktop-app"; - rev = "v${version}"; - hash = "sha256-3yVRVM98tVjot3gIkUb/CDwmwKdOOBjBjzGL6htDtpk="; - }; + src = fetchFromGitHub { + owner = "ivpn"; + repo = "desktop-app"; + rev = "v${version}"; + hash = "sha256-3yVRVM98tVjot3gIkUb/CDwmwKdOOBjBjzGL6htDtpk="; + }; - ldflags = [ - "-s" - "-w" - "-X github.com/ivpn/desktop-app/daemon/version._version=${version}" - "-X github.com/ivpn/desktop-app/daemon/version._time=1970-01-01" - ]; + ldflags = [ + "-s" + "-w" + "-X github.com/ivpn/desktop-app/daemon/version._version=${version}" + "-X github.com/ivpn/desktop-app/daemon/version._time=1970-01-01" + ]; - postInstall = '' - mv $out/bin/{${attrs.modRoot},${pname}} - ''; + postInstall = '' + mv $out/bin/{${attrs.modRoot},${pname}} + ''; - meta = with lib; { - description = "Official IVPN Desktop app"; - homepage = "https://www.ivpn.net/apps"; - changelog = "https://github.com/ivpn/desktop-app/releases/tag/v${version}"; - license = licenses.gpl3Only; - maintainers = with maintainers; [ urandom ataraxiasjel ]; - mainProgram = "ivpn"; - }; -})) { - ivpn = { - modRoot = "cli"; - vendorHash = "sha256-T49AE3SUmdP3Tu9Sp5C/QryKDto/NzEqRuUQ3+aJFL0="; - }; - ivpn-service = { - modRoot = "daemon"; - vendorHash = "sha256-9Rk6ruMpyWtQe+90kw4F8OLq7/JcDSrG6ufkfcrS4W8="; - nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ wirelesstools ]; + meta = with lib; { + description = "Official IVPN Desktop app"; + homepage = "https://www.ivpn.net/apps"; + changelog = "https://github.com/ivpn/desktop-app/releases/tag/v${version}"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ + urandom + ataraxiasjel + ]; + mainProgram = "ivpn"; + }; + } + ) + ) + { + ivpn = { + modRoot = "cli"; + vendorHash = "sha256-T49AE3SUmdP3Tu9Sp5C/QryKDto/NzEqRuUQ3+aJFL0="; + }; + ivpn-service = { + modRoot = "daemon"; + vendorHash = "sha256-9Rk6ruMpyWtQe+90kw4F8OLq7/JcDSrG6ufkfcrS4W8="; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ wirelesstools ]; - patches = [ ./permissions.patch ]; - postPatch = '' - substituteInPlace daemon/service/platform/platform_linux.go \ - --replace 'openVpnBinaryPath = "/usr/sbin/openvpn"' \ - 'openVpnBinaryPath = "${openvpn}/bin/openvpn"' \ - --replace 'routeCommand = "/sbin/ip route"' \ - 'routeCommand = "${iproute2}/bin/ip route"' + patches = [ ./permissions.patch ]; + postPatch = '' + substituteInPlace daemon/service/platform/platform_linux.go \ + --replace 'openVpnBinaryPath = "/usr/sbin/openvpn"' \ + 'openVpnBinaryPath = "${openvpn}/bin/openvpn"' \ + --replace 'routeCommand = "/sbin/ip route"' \ + 'routeCommand = "${iproute2}/bin/ip route"' - substituteInPlace daemon/netinfo/netinfo_linux.go \ - --replace 'retErr := shell.ExecAndProcessOutput(log, outParse, "", "/sbin/ip", "route")' \ - 'retErr := shell.ExecAndProcessOutput(log, outParse, "", "${iproute2}/bin/ip", "route")' + substituteInPlace daemon/netinfo/netinfo_linux.go \ + --replace 'retErr := shell.ExecAndProcessOutput(log, outParse, "", "/sbin/ip", "route")' \ + 'retErr := shell.ExecAndProcessOutput(log, outParse, "", "${iproute2}/bin/ip", "route")' - substituteInPlace daemon/service/platform/platform_linux_release.go \ - --replace 'installDir := "/opt/ivpn"' "installDir := \"$out\"" \ - --replace 'obfsproxyStartScript = path.Join(installDir, "obfsproxy/obfs4proxy")' \ - 'obfsproxyStartScript = "${lib.getExe obfs4}"' \ - --replace 'wgBinaryPath = path.Join(installDir, "wireguard-tools/wg-quick")' \ - 'wgBinaryPath = "${wireguard-tools}/bin/wg-quick"' \ - --replace 'wgToolBinaryPath = path.Join(installDir, "wireguard-tools/wg")' \ - 'wgToolBinaryPath = "${wireguard-tools}/bin/wg"' \ - --replace 'dnscryptproxyBinPath = path.Join(installDir, "dnscrypt-proxy/dnscrypt-proxy")' \ - 'dnscryptproxyBinPath = "${dnscrypt-proxy}/bin/dnscrypt-proxy"' - ''; + substituteInPlace daemon/service/platform/platform_linux_release.go \ + --replace 'installDir := "/opt/ivpn"' "installDir := \"$out\"" \ + --replace 'obfsproxyStartScript = path.Join(installDir, "obfsproxy/obfs4proxy")' \ + 'obfsproxyStartScript = "${lib.getExe obfs4}"' \ + --replace 'wgBinaryPath = path.Join(installDir, "wireguard-tools/wg-quick")' \ + 'wgBinaryPath = "${wireguard-tools}/bin/wg-quick"' \ + --replace 'wgToolBinaryPath = path.Join(installDir, "wireguard-tools/wg")' \ + 'wgToolBinaryPath = "${wireguard-tools}/bin/wg"' \ + --replace 'dnscryptproxyBinPath = path.Join(installDir, "dnscrypt-proxy/dnscrypt-proxy")' \ + 'dnscryptproxyBinPath = "${dnscrypt-proxy}/bin/dnscrypt-proxy"' + ''; - postFixup = '' - mkdir -p $out/etc - cp -r $src/daemon/References/Linux/etc/* $out/etc/ - cp -r $src/daemon/References/common/etc/* $out/etc/ + postFixup = '' + mkdir -p $out/etc + cp -r $src/daemon/References/Linux/etc/* $out/etc/ + cp -r $src/daemon/References/common/etc/* $out/etc/ - patchShebangs --build $out/etc/firewall.sh $out/etc/splittun.sh $out/etc/client.down $out/etc/client.up + patchShebangs --build $out/etc/firewall.sh $out/etc/splittun.sh $out/etc/client.down $out/etc/client.up - wrapProgram "$out/bin/ivpn-service" \ - --suffix PATH : ${lib.makeBinPath [ iptables gawk util-linux ]} - ''; - }; -} + wrapProgram "$out/bin/ivpn-service" \ + --suffix PATH : ${ + lib.makeBinPath [ + iptables + gawk + util-linux + ] + } + ''; + }; + } From 1cd27faa565d7d890d67e8e04922063c939d1c2f Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Fri, 8 Nov 2024 16:53:39 +0800 Subject: [PATCH 2/2] ivpn: 3.10.15 -> 3.14.29 --- pkgs/tools/networking/ivpn/default.nix | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/pkgs/tools/networking/ivpn/default.nix b/pkgs/tools/networking/ivpn/default.nix index 818f66ae02db..f505ae838a9b 100644 --- a/pkgs/tools/networking/ivpn/default.nix +++ b/pkgs/tools/networking/ivpn/default.nix @@ -21,15 +21,21 @@ builtins.mapAttrs attrs // rec { inherit pname; - version = "3.10.15"; + version = "3.14.29"; + + buildInputs = [ + wirelesstools + ]; src = fetchFromGitHub { owner = "ivpn"; repo = "desktop-app"; - rev = "v${version}"; - hash = "sha256-3yVRVM98tVjot3gIkUb/CDwmwKdOOBjBjzGL6htDtpk="; + rev = "refs/tags/v${version}"; + hash = "sha256-8JScty/sGyxzC2ojRpatHpCqEXZw9ksMortIhZnukoU="; }; + proxyVendor = true; # .c file + ldflags = [ "-s" "-w" @@ -41,12 +47,12 @@ builtins.mapAttrs mv $out/bin/{${attrs.modRoot},${pname}} ''; - meta = with lib; { + meta = { description = "Official IVPN Desktop app"; homepage = "https://www.ivpn.net/apps"; changelog = "https://github.com/ivpn/desktop-app/releases/tag/v${version}"; - license = licenses.gpl3Only; - maintainers = with maintainers; [ + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ urandom ataraxiasjel ]; @@ -58,13 +64,12 @@ builtins.mapAttrs { ivpn = { modRoot = "cli"; - vendorHash = "sha256-T49AE3SUmdP3Tu9Sp5C/QryKDto/NzEqRuUQ3+aJFL0="; + vendorHash = "sha256-STbkFchrmxwWnSgEJ7RGKN3jGaCC0npL80YjlwUcs1g="; }; ivpn-service = { modRoot = "daemon"; - vendorHash = "sha256-9Rk6ruMpyWtQe+90kw4F8OLq7/JcDSrG6ufkfcrS4W8="; + vendorHash = "sha256-REIY3XPyMA2Loxo1mKzJMJwZrf9dQMOtnQOUEgN5LP8="; nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ wirelesstools ]; patches = [ ./permissions.patch ]; postPatch = ''