2022-02-14 22:53:18 +00:00
|
|
|
{ buildGoModule
|
2023-05-12 14:17:16 +00:00
|
|
|
, cargo
|
2022-07-26 23:27:00 +00:00
|
|
|
, cmake
|
2022-02-14 22:53:18 +00:00
|
|
|
, fetchFromGitHub
|
2023-05-30 20:13:43 +00:00
|
|
|
, fetchpatch
|
2022-02-14 22:53:18 +00:00
|
|
|
, go
|
|
|
|
, lib
|
2023-02-02 06:32:55 +00:00
|
|
|
, libsecret
|
2022-02-14 22:53:18 +00:00
|
|
|
, pkg-config
|
|
|
|
, polkit
|
|
|
|
, python3
|
2022-07-26 23:27:00 +00:00
|
|
|
, qt5compat
|
2022-02-14 22:53:18 +00:00
|
|
|
, qtbase
|
|
|
|
, qtnetworkauth
|
2023-03-27 20:31:46 +00:00
|
|
|
, qtsvg
|
2022-02-14 22:53:18 +00:00
|
|
|
, qttools
|
|
|
|
, qtwebsockets
|
2022-04-14 21:34:22 +00:00
|
|
|
, rustPlatform
|
2023-05-12 14:17:16 +00:00
|
|
|
, rustc
|
2022-02-14 22:53:18 +00:00
|
|
|
, stdenv
|
|
|
|
, wireguard-tools
|
|
|
|
, wrapQtAppsHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "mozillavpn";
|
2023-05-30 20:13:43 +00:00
|
|
|
version = "2.15.0";
|
2022-02-14 22:53:18 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mozilla-mobile";
|
|
|
|
repo = "mozilla-vpn-client";
|
|
|
|
rev = "v${version}";
|
|
|
|
fetchSubmodules = true;
|
2023-05-30 20:13:43 +00:00
|
|
|
hash = "sha256-eyYrA8ysfmXxlHNUBkGU9ioYrnbx3L1wP9byNz9L/MA=";
|
2022-02-14 22:53:18 +00:00
|
|
|
};
|
2023-05-30 20:13:43 +00:00
|
|
|
patches = [
|
|
|
|
# Force version downgrade for openssl and openssl-sys crates
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/mozilla-mobile/mozilla-vpn-client/commit/5911071ea37d12401af32dcdf2a542ca5049bf2f.patch";
|
|
|
|
hash = "sha256-b3yOgn3Et0sYpqzUUdmlGIbzZSz13Q9HW56hyQqRnHc=";
|
|
|
|
revert = true;
|
|
|
|
})
|
|
|
|
# [2.15] Restore qtglean/Cargo.lock
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/mozilla-mobile/mozilla-vpn-client/pull/7026/commits/13c1b77ee4249883a33b6ac240b3ca143b485ba1.patch";
|
|
|
|
hash = "sha256-L4D71zreDMLAIbP4x1as9QdNmMC1snUZSwlkKehg5yM=";
|
|
|
|
})
|
|
|
|
];
|
2022-02-14 22:53:18 +00:00
|
|
|
|
|
|
|
netfilter-go-modules = (buildGoModule {
|
2023-05-30 20:13:43 +00:00
|
|
|
inherit pname version src patches;
|
2022-02-14 22:53:18 +00:00
|
|
|
modRoot = "linux/netfilter";
|
2022-10-27 20:22:06 +00:00
|
|
|
vendorHash = "sha256-Cmo0wnl0z5r1paaEf1MhCPbInWeoMhGjnxCxGh0cyO8=";
|
2022-02-14 22:53:18 +00:00
|
|
|
}).go-modules;
|
|
|
|
|
2022-10-27 20:22:06 +00:00
|
|
|
extensionBridgeDeps = rustPlatform.fetchCargoTarball {
|
2023-05-30 20:13:43 +00:00
|
|
|
inherit src patches;
|
2022-10-27 20:22:06 +00:00
|
|
|
name = "${pname}-${version}-extension-bridge";
|
|
|
|
preBuild = "cd extension/bridge";
|
2023-05-30 20:13:43 +00:00
|
|
|
hash = "sha256-R/9ePEhc4qVgg3WC5ng+cD88K/N3PTnx4QWyaZZfRds=";
|
2022-10-27 20:22:06 +00:00
|
|
|
};
|
|
|
|
signatureDeps = rustPlatform.fetchCargoTarball {
|
2023-05-30 20:13:43 +00:00
|
|
|
inherit src patches;
|
2022-10-27 20:22:06 +00:00
|
|
|
name = "${pname}-${version}-signature";
|
|
|
|
preBuild = "cd signature";
|
2023-05-30 20:13:43 +00:00
|
|
|
hash = "sha256-27g2qnnUrxbThM1cHZquQgWQLWDtZaBnlf8PjvQtBJU=";
|
2022-12-15 19:41:10 +00:00
|
|
|
};
|
2023-05-30 20:13:43 +00:00
|
|
|
qtgleanDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src patches;
|
|
|
|
name = "${pname}-${version}-qtglean";
|
|
|
|
preBuild = "cd qtglean";
|
|
|
|
hash = "sha256-cW+nf+Dho+eSzOBo3xhxki7NXpg0wd5ZM9OMA6iOUl4=";
|
2022-10-27 20:22:06 +00:00
|
|
|
};
|
2022-04-14 21:34:22 +00:00
|
|
|
|
2022-02-14 22:53:18 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2023-05-30 20:13:43 +00:00
|
|
|
inherit pname version src patches;
|
2022-02-14 22:53:18 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2023-02-02 06:32:55 +00:00
|
|
|
libsecret
|
2022-02-14 22:53:18 +00:00
|
|
|
polkit
|
2022-07-26 23:27:00 +00:00
|
|
|
qt5compat
|
2022-02-14 22:53:18 +00:00
|
|
|
qtbase
|
|
|
|
qtnetworkauth
|
2023-03-27 20:31:46 +00:00
|
|
|
qtsvg
|
2022-02-14 22:53:18 +00:00
|
|
|
qtwebsockets
|
|
|
|
];
|
|
|
|
nativeBuildInputs = [
|
2022-07-26 23:27:00 +00:00
|
|
|
cmake
|
2022-02-14 22:53:18 +00:00
|
|
|
go
|
|
|
|
pkg-config
|
|
|
|
python3
|
2022-07-26 23:27:00 +00:00
|
|
|
python3.pkgs.glean-parser
|
2022-02-14 22:53:18 +00:00
|
|
|
python3.pkgs.pyyaml
|
2022-07-26 23:27:00 +00:00
|
|
|
python3.pkgs.setuptools
|
2022-04-14 21:34:22 +00:00
|
|
|
rustPlatform.cargoSetupHook
|
2023-05-12 14:17:16 +00:00
|
|
|
cargo
|
|
|
|
rustc
|
2022-02-14 22:53:18 +00:00
|
|
|
wrapQtAppsHook
|
|
|
|
];
|
|
|
|
|
2022-10-27 20:22:06 +00:00
|
|
|
postUnpack = ''
|
|
|
|
pushd source/extension/bridge
|
|
|
|
cargoDeps='${extensionBridgeDeps}' cargoSetupPostUnpackHook
|
|
|
|
extensionBridgeDepsCopy="$cargoDepsCopy"
|
|
|
|
popd
|
|
|
|
|
|
|
|
pushd source/signature
|
|
|
|
cargoDeps='${signatureDeps}' cargoSetupPostUnpackHook
|
|
|
|
signatureDepsCopy="$cargoDepsCopy"
|
|
|
|
popd
|
2022-12-15 19:41:10 +00:00
|
|
|
|
2023-05-30 20:13:43 +00:00
|
|
|
pushd source/qtglean
|
|
|
|
cargoDeps='${qtgleanDeps}' cargoSetupPostUnpackHook
|
|
|
|
qtgleanDepsCopy="$cargoDepsCopy"
|
2022-12-15 19:41:10 +00:00
|
|
|
popd
|
2022-10-27 20:22:06 +00:00
|
|
|
'';
|
|
|
|
dontCargoSetupPostUnpack = true;
|
2022-04-14 21:34:22 +00:00
|
|
|
|
2022-02-14 22:53:18 +00:00
|
|
|
postPatch = ''
|
2023-02-02 06:32:55 +00:00
|
|
|
substituteInPlace src/apps/vpn/platforms/linux/daemon/org.mozilla.vpn.dbus.service --replace /usr/bin/mozillavpn "$out/bin/mozillavpn"
|
2022-02-14 22:53:18 +00:00
|
|
|
|
2022-07-26 23:27:00 +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"'
|
|
|
|
|
2023-02-02 06:32:55 +00:00
|
|
|
substituteInPlace src/apps/vpn/cmake/linux.cmake \
|
2022-10-27 20:22:06 +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-07-26 23:27:00 +00:00
|
|
|
--replace '${"$"}{SYSTEMD_UNIT_DIR}' "$out/lib/systemd/system"
|
|
|
|
|
2022-10-27 20:22:06 +00:00
|
|
|
substituteInPlace extension/CMakeLists.txt \
|
|
|
|
--replace '/etc' "$out/etc"
|
|
|
|
|
2022-02-14 22:53:18 +00:00
|
|
|
ln -s '${netfilter-go-modules}' linux/netfilter/vendor
|
2022-10-27 20:22:06 +00:00
|
|
|
|
|
|
|
pushd extension/bridge
|
|
|
|
cargoDepsCopy="$extensionBridgeDepsCopy" cargoSetupPostPatchHook
|
|
|
|
popd
|
|
|
|
|
|
|
|
pushd signature
|
|
|
|
cargoDepsCopy="$signatureDepsCopy" cargoSetupPostPatchHook
|
|
|
|
popd
|
|
|
|
|
2023-05-30 20:13:43 +00:00
|
|
|
pushd qtglean
|
|
|
|
cargoDepsCopy="$qtgleanDepsCopy" cargoSetupPostPatchHook
|
2022-12-15 19:41:10 +00:00
|
|
|
popd
|
|
|
|
|
2022-10-27 20:22:06 +00:00
|
|
|
cargoSetupPostPatchHook() { true; }
|
2022-02-14 22:53:18 +00:00
|
|
|
'';
|
|
|
|
|
2022-07-26 23:27:00 +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-14 22:16:50 +00:00
|
|
|
];
|
2022-10-27 20:22:06 +00:00
|
|
|
dontFixCmake = true;
|
2022-07-26 23:27:00 +00:00
|
|
|
|
2022-02-14 22:53:18 +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;
|
|
|
|
};
|
|
|
|
}
|