depot/third_party/nixpkgs/pkgs/tools/networking/mozillavpn/default.nix
Default email 02cf88bb76 Project import generated by Copybara.
GitOrigin-RevId: c4a0efdd5a728e20791b8d8d2f26f90ac228ee8d
2022-08-12 15:06:08 +03:00

106 lines
2.4 KiB
Nix

{ buildGoModule
, cmake
, fetchFromGitHub
, go
, lib
, pkg-config
, polkit
, python3
, qt5compat
, qtbase
, qtcharts
, qtnetworkauth
, qttools
, qtwebsockets
, rustPlatform
, stdenv
, which
, wireguard-tools
, wrapQtAppsHook
}:
let
pname = "mozillavpn";
version = "2.9.0";
src = fetchFromGitHub {
owner = "mozilla-mobile";
repo = "mozilla-vpn-client";
rev = "v${version}";
fetchSubmodules = true;
hash = "sha256-arz8hTgQfPFSZesSddcnZoyLfoLQsQT8LIsl+3ZfA0M=";
};
netfilter-go-modules = (buildGoModule {
inherit pname version src;
vendorSha256 = "KFYMim5U8WlJHValvIBQgEN+17SDv0JVbH03IiyfDc0=";
modRoot = "linux/netfilter";
}).go-modules;
cargoRoot = "extension/bridge";
in
stdenv.mkDerivation {
inherit pname version src cargoRoot;
buildInputs = [
polkit
qt5compat
qtbase
qtcharts
qtnetworkauth
qtwebsockets
];
nativeBuildInputs = [
cmake
go
pkg-config
python3
python3.pkgs.glean-parser
python3.pkgs.lxml
python3.pkgs.pyyaml
python3.pkgs.setuptools
rustPlatform.cargoSetupHook
rustPlatform.rust.cargo
which
wrapQtAppsHook
];
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
name = "${pname}-${version}";
preBuild = "cd ${cargoRoot}";
hash = "sha256-lJfDLyoVDSFiZyWcBTI085MorWHPcNW4i7ua1+Ip3rA=";
};
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
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 \
--replace '${"$"}{SYSTEMD_UNIT_DIR}' "$out/lib/systemd/system"
ln -s '${netfilter-go-modules}' linux/netfilter/vendor
'';
cmakeFlags = [
"-DQT_LCONVERT_EXECUTABLE=${qttools.dev}/bin/lconvert"
"-DQT_LUPDATE_EXECUTABLE=${qttools.dev}/bin/lupdate"
"-DQT_LRELEASE_EXECUTABLE=${qttools.dev}/bin/lrelease"
];
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;
};
}