2022-02-14 23:53:18 +01:00
|
|
|
{ buildGoModule
|
2022-07-27 01:27:00 +02:00
|
|
|
, cmake
|
2022-02-14 23:53:18 +01:00
|
|
|
, fetchFromGitHub
|
|
|
|
, go
|
|
|
|
, lib
|
2023-02-02 07:32:55 +01:00
|
|
|
, libsecret
|
2022-02-14 23:53:18 +01:00
|
|
|
, pkg-config
|
|
|
|
, polkit
|
|
|
|
, python3
|
2022-07-27 01:27:00 +02:00
|
|
|
, qt5compat
|
2022-02-14 23:53:18 +01:00
|
|
|
, qtbase
|
|
|
|
, qtcharts
|
|
|
|
, qtnetworkauth
|
|
|
|
, qttools
|
|
|
|
, qtwebsockets
|
2022-04-14 23:34:22 +02:00
|
|
|
, rustPlatform
|
2022-02-14 23:53:18 +01:00
|
|
|
, stdenv
|
|
|
|
, wireguard-tools
|
|
|
|
, wrapQtAppsHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "mozillavpn";
|
2023-02-14 00:39:08 +01:00
|
|
|
version = "2.13.1";
|
2022-02-14 23:53:18 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mozilla-mobile";
|
|
|
|
repo = "mozilla-vpn-client";
|
|
|
|
rev = "v${version}";
|
|
|
|
fetchSubmodules = true;
|
2023-02-14 00:39:08 +01:00
|
|
|
hash = "sha256-moXCtAFJyNkotYxBZSRP24tNHy5Rb6YW7mSKHDn9oXk=";
|
2022-02-14 23:53:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
netfilter-go-modules = (buildGoModule {
|
2022-07-27 01:27:00 +02:00
|
|
|
inherit pname version src;
|
2022-02-14 23:53:18 +01:00
|
|
|
modRoot = "linux/netfilter";
|
2022-10-27 22:22:06 +02:00
|
|
|
vendorHash = "sha256-Cmo0wnl0z5r1paaEf1MhCPbInWeoMhGjnxCxGh0cyO8=";
|
2022-02-14 23:53:18 +01:00
|
|
|
}).go-modules;
|
|
|
|
|
2022-10-27 22:22:06 +02:00
|
|
|
extensionBridgeDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}-extension-bridge";
|
|
|
|
preBuild = "cd extension/bridge";
|
2023-02-14 00:39:08 +01:00
|
|
|
hash = "sha256-/gRP7Th2HnoEQU8psf0797Tq6md4+P5zR13z3U9xlrI=";
|
2022-10-27 22:22:06 +02:00
|
|
|
};
|
|
|
|
signatureDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}-signature";
|
|
|
|
preBuild = "cd signature";
|
2023-02-14 00:39:08 +01:00
|
|
|
hash = "sha256-IBT7qTNbGVutR90wUhm7+9tLehDfrYDHTDkBz8hD6G0=";
|
2022-12-15 20:41:10 +01:00
|
|
|
};
|
|
|
|
vpngleanDeps = rustPlatform.fetchCargoTarball {
|
2023-02-02 07:32:55 +01:00
|
|
|
inherit src;
|
2022-12-15 20:41:10 +01:00
|
|
|
name = "${pname}-${version}-vpnglean";
|
|
|
|
preBuild = "cd vpnglean";
|
2023-02-14 00:39:08 +01:00
|
|
|
hash = "sha256-vQDXsoKyawdVFIQZfH8LD+ehGk692ZcAwtou4OoqLNI=";
|
2022-10-27 22:22:06 +02:00
|
|
|
};
|
2022-04-14 23:34:22 +02:00
|
|
|
|
2022-02-14 23:53:18 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2023-02-02 07:32:55 +01:00
|
|
|
inherit pname version src;
|
2022-02-14 23:53:18 +01:00
|
|
|
|
|
|
|
buildInputs = [
|
2023-02-02 07:32:55 +01:00
|
|
|
libsecret
|
2022-02-14 23:53:18 +01:00
|
|
|
polkit
|
2022-07-27 01:27:00 +02:00
|
|
|
qt5compat
|
2022-02-14 23:53:18 +01:00
|
|
|
qtbase
|
|
|
|
qtcharts
|
|
|
|
qtnetworkauth
|
|
|
|
qtwebsockets
|
|
|
|
];
|
|
|
|
nativeBuildInputs = [
|
2022-07-27 01:27:00 +02:00
|
|
|
cmake
|
2022-02-14 23:53:18 +01:00
|
|
|
go
|
|
|
|
pkg-config
|
|
|
|
python3
|
2022-07-27 01:27:00 +02:00
|
|
|
python3.pkgs.glean-parser
|
2022-02-14 23:53:18 +01:00
|
|
|
python3.pkgs.pyyaml
|
2022-07-27 01:27:00 +02:00
|
|
|
python3.pkgs.setuptools
|
2022-04-14 23:34:22 +02:00
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
rustPlatform.rust.cargo
|
2022-12-15 20:41:10 +01:00
|
|
|
rustPlatform.rust.rustc
|
2022-02-14 23:53:18 +01:00
|
|
|
wrapQtAppsHook
|
|
|
|
];
|
|
|
|
|
2022-10-27 22:22:06 +02:00
|
|
|
postUnpack = ''
|
|
|
|
pushd source/extension/bridge
|
|
|
|
cargoDeps='${extensionBridgeDeps}' cargoSetupPostUnpackHook
|
|
|
|
extensionBridgeDepsCopy="$cargoDepsCopy"
|
|
|
|
popd
|
|
|
|
|
|
|
|
pushd source/signature
|
|
|
|
cargoDeps='${signatureDeps}' cargoSetupPostUnpackHook
|
|
|
|
signatureDepsCopy="$cargoDepsCopy"
|
|
|
|
popd
|
2022-12-15 20:41:10 +01:00
|
|
|
|
|
|
|
pushd source/vpnglean
|
|
|
|
cargoDeps='${vpngleanDeps}' cargoSetupPostUnpackHook
|
|
|
|
vpngleanDepsCopy="$cargoDepsCopy"
|
|
|
|
popd
|
2022-10-27 22:22:06 +02:00
|
|
|
'';
|
|
|
|
dontCargoSetupPostUnpack = true;
|
2022-04-14 23:34:22 +02:00
|
|
|
|
2022-02-14 23:53:18 +01:00
|
|
|
postPatch = ''
|
2023-02-02 07:32:55 +01:00
|
|
|
substituteInPlace src/apps/vpn/platforms/linux/daemon/org.mozilla.vpn.dbus.service --replace /usr/bin/mozillavpn "$out/bin/mozillavpn"
|
2022-02-14 23:53:18 +01:00
|
|
|
|
2022-07-27 01:27:00 +02:00
|
|
|
substituteInPlace scripts/addon/build.py \
|
|
|
|
--replace 'qtbinpath = args.qtpath' 'qtbinpath = "${qttools.dev}/bin"' \
|
|
|
|
--replace 'rcc = os.path.join(qtbinpath, rcc_bin)' 'rcc = "${qtbase.dev}/libexec/rcc"'
|
|
|
|
|
2023-02-02 07:32:55 +01:00
|
|
|
substituteInPlace src/apps/vpn/cmake/linux.cmake \
|
2022-10-27 22:22:06 +02:00
|
|
|
--replace '/etc/xdg/autostart' "$out/etc/xdg/autostart" \
|
|
|
|
--replace '${"$"}{POLKIT_POLICY_DIR}' "$out/share/polkit-1/actions" \
|
|
|
|
--replace '/usr/share/dbus-1' "$out/share/dbus-1" \
|
2022-07-27 01:27:00 +02:00
|
|
|
--replace '${"$"}{SYSTEMD_UNIT_DIR}' "$out/lib/systemd/system"
|
|
|
|
|
2022-10-27 22:22:06 +02:00
|
|
|
substituteInPlace extension/CMakeLists.txt \
|
|
|
|
--replace '/etc' "$out/etc"
|
|
|
|
|
2022-02-14 23:53:18 +01:00
|
|
|
ln -s '${netfilter-go-modules}' linux/netfilter/vendor
|
2022-10-27 22:22:06 +02:00
|
|
|
|
|
|
|
pushd extension/bridge
|
|
|
|
cargoDepsCopy="$extensionBridgeDepsCopy" cargoSetupPostPatchHook
|
|
|
|
popd
|
|
|
|
|
|
|
|
pushd signature
|
|
|
|
cargoDepsCopy="$signatureDepsCopy" cargoSetupPostPatchHook
|
|
|
|
popd
|
|
|
|
|
2022-12-15 20:41:10 +01:00
|
|
|
pushd vpnglean
|
|
|
|
cargoDepsCopy="$vpngleanDepsCopy" cargoSetupPostPatchHook
|
|
|
|
popd
|
|
|
|
|
2022-10-27 22:22:06 +02:00
|
|
|
cargoSetupPostPatchHook() { true; }
|
2022-02-14 23:53:18 +01:00
|
|
|
'';
|
|
|
|
|
2022-07-27 01:27:00 +02:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DQT_LCONVERT_EXECUTABLE=${qttools.dev}/bin/lconvert"
|
|
|
|
"-DQT_LUPDATE_EXECUTABLE=${qttools.dev}/bin/lupdate"
|
|
|
|
"-DQT_LRELEASE_EXECUTABLE=${qttools.dev}/bin/lrelease"
|
2022-05-15 00:16:50 +02:00
|
|
|
];
|
2022-10-27 22:22:06 +02:00
|
|
|
dontFixCmake = true;
|
2022-07-27 01:27:00 +02:00
|
|
|
|
2022-02-14 23:53:18 +01:00
|
|
|
qtWrapperArgs =
|
|
|
|
[ "--prefix" "PATH" ":" (lib.makeBinPath [ wireguard-tools ]) ];
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Client for the Mozilla VPN service";
|
|
|
|
homepage = "https://vpn.mozilla.org/";
|
|
|
|
license = lib.licenses.mpl20;
|
|
|
|
maintainers = with lib.maintainers; [ andersk ];
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
}
|