nixpkgs/pkgs/tools/networking/mozillavpn/default.nix
Anders Kaseorg fc3790f995 mozillavpn: 2.8.0 → 2.8.3
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-05-23 14:53:23 -07:00

137 lines
3.1 KiB
Nix

{ buildGoModule
, fetchFromGitHub
, fetchpatch
, go
, lib
, pkg-config
, polkit
, python3
, qmake
, qtbase
, qtcharts
, qtgraphicaleffects
, qtnetworkauth
, qtquickcontrols2
, qttools
, qtwebsockets
, rustPlatform
, stdenv
, which
, wireguard-tools
, wrapQtAppsHook
}:
let
glean_parser_4_1_1 = python3.pkgs.buildPythonPackage rec {
pname = "glean_parser";
version = "4.1.1";
src = python3.pkgs.fetchPypi {
inherit pname version;
hash = "sha256-4noazRqjjJNI2kTO714kSp70jZpWmqHWR2vnkgAftLE=";
};
nativeBuildInputs = with python3.pkgs; [ setuptools-scm ];
propagatedBuildInputs = with python3.pkgs; [
appdirs
click
diskcache
jinja2
jsonschema
pyyaml
setuptools
yamllint
];
postPatch = ''
substituteInPlace setup.py --replace '"pytest-runner", ' ""
'';
doCheck = false;
};
pname = "mozillavpn";
version = "2.8.3";
src = fetchFromGitHub {
owner = "mozilla-mobile";
repo = "mozilla-vpn-client";
rev = "v${version}";
fetchSubmodules = true;
hash = "sha256-eKgoRE/JDEQEFp7xYY60ARDgw/n5VoZpD/Gb/CWzHuo=";
};
patches = [
# Rust bridge: Add Cargo.lock file
(fetchpatch {
url = "https://github.com/mozilla-mobile/mozilla-vpn-client/commit/05c9a366cf9dc4e378485c8e9d494f77c35dbb8c.patch";
hash = "sha256-fG+SATbJpGqpCFXSWEiBo4dYx6RLtJYR0yTdBqN6Fww=";
})
];
netfilter-go-modules = (buildGoModule {
inherit pname version src patches;
vendorSha256 = "KFYMim5U8WlJHValvIBQgEN+17SDv0JVbH03IiyfDc0=";
modRoot = "linux/netfilter";
}).go-modules;
cargoRoot = "extension/bridge";
in
stdenv.mkDerivation {
inherit pname version src patches cargoRoot;
buildInputs = [
polkit
qtbase
qtcharts
qtgraphicaleffects
qtnetworkauth
qtquickcontrols2
qtwebsockets
];
nativeBuildInputs = [
glean_parser_4_1_1
go
pkg-config
python3
python3.pkgs.pyyaml
qmake
qttools
rustPlatform.cargoSetupHook
rustPlatform.rust.cargo
which
wrapQtAppsHook
];
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src patches;
name = "${pname}-${version}";
preBuild = "cd ${cargoRoot}";
hash = "sha256-C0wPmGVXbhUs0IzeIMZD6724P0XTOzeK1bzrnUMPlWo=";
};
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
'';
preBuild = ''
ln -s '${netfilter-go-modules}' linux/netfilter/vendor
python3 scripts/utils/generate_glean.py
python3 scripts/utils/import_languages.py --qt_path '${lib.getDev qttools}/bin'
'';
qmakeFlags = [
"USRPATH=$(out)"
"ETCPATH=$(out)/etc"
"CONFIG-=debug" # https://github.com/mozilla-mobile/mozilla-vpn-client/pull/3539
];
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;
};
}