2022-04-15 01:41:22 +00:00
|
|
|
{ buildGoModule
|
2022-08-12 12:06:08 +00:00
|
|
|
, cmake
|
2022-04-15 01:41:22 +00:00
|
|
|
, fetchFromGitHub
|
2022-12-17 10:02:37 +00:00
|
|
|
, fetchpatch
|
2022-04-15 01:41:22 +00:00
|
|
|
, go
|
|
|
|
, lib
|
|
|
|
, pkg-config
|
|
|
|
, polkit
|
|
|
|
, python3
|
2022-08-12 12:06:08 +00:00
|
|
|
, qt5compat
|
2022-04-15 01:41:22 +00:00
|
|
|
, qtbase
|
|
|
|
, qtcharts
|
|
|
|
, qtnetworkauth
|
|
|
|
, qttools
|
|
|
|
, qtwebsockets
|
2022-04-27 09:35:20 +00:00
|
|
|
, rustPlatform
|
2022-04-15 01:41:22 +00:00
|
|
|
, stdenv
|
|
|
|
, which
|
|
|
|
, wireguard-tools
|
|
|
|
, wrapQtAppsHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "mozillavpn";
|
2022-12-17 10:02:37 +00:00
|
|
|
version = "2.12.0";
|
2022-04-15 01:41:22 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mozilla-mobile";
|
|
|
|
repo = "mozilla-vpn-client";
|
|
|
|
rev = "v${version}";
|
|
|
|
fetchSubmodules = true;
|
2022-12-17 10:02:37 +00:00
|
|
|
hash = "sha256-T8dPM90X4soVG/plKsf7DM9XgdX5Vcp0i6zTE60gbq0=";
|
2022-04-15 01:41:22 +00:00
|
|
|
};
|
2022-12-17 10:02:37 +00:00
|
|
|
patches = [
|
|
|
|
# vpnglean: Add Cargo.lock file
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/mozilla-mobile/mozilla-vpn-client/pull/5236/commits/6fdc689001619a06b752fa629647642ea66f4e26.patch";
|
|
|
|
hash = "sha256-j666Z31D29WIL3EXbek2aLzA4Fui/9VZvupubMDG24Q=";
|
|
|
|
})
|
|
|
|
];
|
2022-04-15 01:41:22 +00:00
|
|
|
|
|
|
|
netfilter-go-modules = (buildGoModule {
|
2022-08-12 12:06:08 +00:00
|
|
|
inherit pname version src;
|
2022-04-15 01:41:22 +00:00
|
|
|
modRoot = "linux/netfilter";
|
2022-11-21 17:40:18 +00:00
|
|
|
vendorHash = "sha256-Cmo0wnl0z5r1paaEf1MhCPbInWeoMhGjnxCxGh0cyO8=";
|
2022-04-15 01:41:22 +00:00
|
|
|
}).go-modules;
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
extensionBridgeDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}-extension-bridge";
|
|
|
|
preBuild = "cd extension/bridge";
|
2022-12-17 10:02:37 +00:00
|
|
|
hash = "sha256-/DmKSV0IKxZV0Drh6dTsiqgZhuxt6CoegXpYdqN4UzQ=";
|
2022-11-21 17:40:18 +00:00
|
|
|
};
|
|
|
|
signatureDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}-signature";
|
|
|
|
preBuild = "cd signature";
|
2022-12-17 10:02:37 +00:00
|
|
|
hash = "sha256-6qyMARhPPgTryEtaBNrIPN9ja/fe7Fyx38iGuTd+Dk8=";
|
|
|
|
};
|
|
|
|
vpngleanDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src patches;
|
|
|
|
name = "${pname}-${version}-vpnglean";
|
|
|
|
preBuild = "cd vpnglean";
|
|
|
|
hash = "sha256-8OLTQmRvy6pATEBX2za6f9vMEqwkf9L5VyERtAN2BDQ=";
|
2022-11-21 17:40:18 +00:00
|
|
|
};
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2022-12-17 10:02:37 +00:00
|
|
|
inherit pname version src patches;
|
2022-04-15 01:41:22 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
polkit
|
2022-08-12 12:06:08 +00:00
|
|
|
qt5compat
|
2022-04-15 01:41:22 +00:00
|
|
|
qtbase
|
|
|
|
qtcharts
|
|
|
|
qtnetworkauth
|
|
|
|
qtwebsockets
|
|
|
|
];
|
|
|
|
nativeBuildInputs = [
|
2022-08-12 12:06:08 +00:00
|
|
|
cmake
|
2022-04-15 01:41:22 +00:00
|
|
|
go
|
|
|
|
pkg-config
|
|
|
|
python3
|
2022-08-12 12:06:08 +00:00
|
|
|
python3.pkgs.glean-parser
|
|
|
|
python3.pkgs.lxml
|
2022-04-15 01:41:22 +00:00
|
|
|
python3.pkgs.pyyaml
|
2022-08-12 12:06:08 +00:00
|
|
|
python3.pkgs.setuptools
|
2022-04-27 09:35:20 +00:00
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
rustPlatform.rust.cargo
|
2022-12-17 10:02:37 +00:00
|
|
|
rustPlatform.rust.rustc
|
2022-04-15 01:41:22 +00:00
|
|
|
which
|
|
|
|
wrapQtAppsHook
|
|
|
|
];
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
postUnpack = ''
|
|
|
|
pushd source/extension/bridge
|
|
|
|
cargoDeps='${extensionBridgeDeps}' cargoSetupPostUnpackHook
|
|
|
|
extensionBridgeDepsCopy="$cargoDepsCopy"
|
|
|
|
popd
|
|
|
|
|
|
|
|
pushd source/signature
|
|
|
|
cargoDeps='${signatureDeps}' cargoSetupPostUnpackHook
|
|
|
|
signatureDepsCopy="$cargoDepsCopy"
|
|
|
|
popd
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
pushd source/vpnglean
|
|
|
|
cargoDeps='${vpngleanDeps}' cargoSetupPostUnpackHook
|
|
|
|
vpngleanDepsCopy="$cargoDepsCopy"
|
|
|
|
popd
|
2022-11-21 17:40:18 +00:00
|
|
|
'';
|
|
|
|
dontCargoSetupPostUnpack = true;
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
postPatch = ''
|
|
|
|
for file in linux/*.service linux/extra/*.desktop src/platforms/linux/daemon/*.service; do
|
|
|
|
substituteInPlace "$file" --replace /usr/bin/mozillavpn "$out/bin/mozillavpn"
|
|
|
|
done
|
|
|
|
|
2022-08-12 12:06:08 +00: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"'
|
|
|
|
|
|
|
|
substituteInPlace src/cmake/linux.cmake \
|
2022-11-21 17:40:18 +00: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-08-12 12:06:08 +00:00
|
|
|
--replace '${"$"}{SYSTEMD_UNIT_DIR}' "$out/lib/systemd/system"
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
substituteInPlace extension/CMakeLists.txt \
|
|
|
|
--replace '/etc' "$out/etc"
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
ln -s '${netfilter-go-modules}' linux/netfilter/vendor
|
2022-11-21 17:40:18 +00:00
|
|
|
|
|
|
|
pushd extension/bridge
|
|
|
|
cargoDepsCopy="$extensionBridgeDepsCopy" cargoSetupPostPatchHook
|
|
|
|
popd
|
|
|
|
|
|
|
|
pushd signature
|
|
|
|
cargoDepsCopy="$signatureDepsCopy" cargoSetupPostPatchHook
|
|
|
|
popd
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
pushd vpnglean
|
|
|
|
cargoDepsCopy="$vpngleanDepsCopy" cargoSetupPostPatchHook
|
|
|
|
popd
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
cargoSetupPostPatchHook() { true; }
|
2022-04-15 01:41:22 +00:00
|
|
|
'';
|
|
|
|
|
2022-08-12 12:06:08 +00: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-18 14:49:53 +00:00
|
|
|
];
|
2022-11-21 17:40:18 +00:00
|
|
|
dontFixCmake = true;
|
2022-08-12 12:06:08 +00:00
|
|
|
|
2022-04-15 01:41:22 +00: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;
|
|
|
|
};
|
|
|
|
}
|