2023-02-02 18:25:31 +00:00
|
|
|
{ buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, lib
|
|
|
|
, wirelesstools
|
2023-04-29 16:46:19 +00:00
|
|
|
, makeWrapper
|
|
|
|
, wireguard-tools
|
|
|
|
, openvpn
|
|
|
|
, obfs4
|
|
|
|
, iproute2
|
2023-10-09 19:29:22 +00:00
|
|
|
, dnscrypt-proxy
|
2023-04-29 16:46:19 +00:00
|
|
|
, iptables
|
|
|
|
, gawk
|
|
|
|
, util-linux
|
2023-02-02 18:25:31 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
builtins.mapAttrs (pname: attrs: buildGoModule (attrs // rec {
|
|
|
|
inherit pname;
|
2023-04-29 16:46:19 +00:00
|
|
|
version = "3.10.15";
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ivpn";
|
|
|
|
repo = "desktop-app";
|
|
|
|
rev = "v${version}";
|
2023-04-29 16:46:19 +00:00
|
|
|
hash = "sha256-3yVRVM98tVjot3gIkUb/CDwmwKdOOBjBjzGL6htDtpk=";
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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}}
|
|
|
|
'';
|
|
|
|
|
|
|
|
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;
|
2023-04-29 16:46:19 +00:00
|
|
|
maintainers = with maintainers; [ urandom ataraxiasjel ];
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
|
|
|
})) {
|
|
|
|
ivpn = {
|
|
|
|
modRoot = "cli";
|
2023-04-29 16:46:19 +00:00
|
|
|
vendorHash = "sha256-T49AE3SUmdP3Tu9Sp5C/QryKDto/NzEqRuUQ3+aJFL0=";
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
|
|
|
ivpn-service = {
|
|
|
|
modRoot = "daemon";
|
|
|
|
vendorHash = "sha256-9Rk6ruMpyWtQe+90kw4F8OLq7/JcDSrG6ufkfcrS4W8=";
|
2023-04-29 16:46:19 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2023-02-02 18:25:31 +00:00
|
|
|
buildInputs = [ wirelesstools ];
|
2023-04-29 16:46:19 +00:00
|
|
|
|
|
|
|
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/service/platform/platform_linux_release.go \
|
|
|
|
--replace 'installDir := "/opt/ivpn"' "installDir := \"$out\"" \
|
|
|
|
--replace 'obfsproxyStartScript = path.Join(installDir, "obfsproxy/obfs4proxy")' \
|
|
|
|
'obfsproxyStartScript = "${obfs4}/bin/obfs4proxy"' \
|
|
|
|
--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")' \
|
2023-10-09 19:29:22 +00:00
|
|
|
'dnscryptproxyBinPath = "${dnscrypt-proxy}/bin/dnscrypt-proxy"'
|
2023-04-29 16:46:19 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
wrapProgram "$out/bin/ivpn-service" \
|
|
|
|
--suffix PATH : ${lib.makeBinPath [ iptables gawk util-linux ]}
|
|
|
|
'';
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
|
|
|
}
|