python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / tools / networking / mozillavpn / default.nix
blobd8641cb29d94781f107abdd8f94d7deb60fb29fe
1 { buildGoModule
2 , cmake
3 , fetchFromGitHub
4 , go
5 , lib
6 , pkg-config
7 , polkit
8 , python3
9 , qt5compat
10 , qtbase
11 , qtcharts
12 , qtnetworkauth
13 , qttools
14 , qtwebsockets
15 , rustPlatform
16 , stdenv
17 , which
18 , wireguard-tools
19 , wrapQtAppsHook
22 let
23   pname = "mozillavpn";
24   version = "2.10.1";
25   src = fetchFromGitHub {
26     owner = "mozilla-mobile";
27     repo = "mozilla-vpn-client";
28     rev = "v${version}";
29     fetchSubmodules = true;
30     hash = "sha256-am2acceDig7tjhkO5GiWfvkq0Mabyxedbc8mR49SXBU=";
31   };
33   netfilter-go-modules = (buildGoModule {
34     inherit pname version src;
35     modRoot = "linux/netfilter";
36     vendorHash = "sha256-Cmo0wnl0z5r1paaEf1MhCPbInWeoMhGjnxCxGh0cyO8=";
37   }).go-modules;
39   extensionBridgeDeps = rustPlatform.fetchCargoTarball {
40     inherit src;
41     name = "${pname}-${version}-extension-bridge";
42     preBuild = "cd extension/bridge";
43     hash = "sha256-sw6iylh3SgCDA1z/xvwNGWrCU2xr7IVPUL4fdOi43lc=";
44   };
46   signatureDeps = rustPlatform.fetchCargoTarball {
47     inherit src;
48     name = "${pname}-${version}-signature";
49     preBuild = "cd signature";
50     hash = "sha256-gBJIzTTo6i415aHwUsBriokUt2K/r55QCpC6Tv8GXh4=";
51   };
54 stdenv.mkDerivation {
55   inherit pname version src;
57   buildInputs = [
58     polkit
59     qt5compat
60     qtbase
61     qtcharts
62     qtnetworkauth
63     qtwebsockets
64   ];
65   nativeBuildInputs = [
66     cmake
67     go
68     pkg-config
69     python3
70     python3.pkgs.glean-parser
71     python3.pkgs.lxml
72     python3.pkgs.pyyaml
73     python3.pkgs.setuptools
74     rustPlatform.cargoSetupHook
75     rustPlatform.rust.cargo
76     which
77     wrapQtAppsHook
78   ];
80   postUnpack = ''
81     pushd source/extension/bridge
82     cargoDeps='${extensionBridgeDeps}' cargoSetupPostUnpackHook
83     extensionBridgeDepsCopy="$cargoDepsCopy"
84     popd
86     pushd source/signature
87     cargoDeps='${signatureDeps}' cargoSetupPostUnpackHook
88     signatureDepsCopy="$cargoDepsCopy"
89     popd
90   '';
91   dontCargoSetupPostUnpack = true;
93   postPatch = ''
94     for file in linux/*.service linux/extra/*.desktop src/platforms/linux/daemon/*.service; do
95       substituteInPlace "$file" --replace /usr/bin/mozillavpn "$out/bin/mozillavpn"
96     done
98     substituteInPlace scripts/addon/build.py \
99       --replace 'qtbinpath = args.qtpath' 'qtbinpath = "${qttools.dev}/bin"' \
100       --replace 'rcc = os.path.join(qtbinpath, rcc_bin)' 'rcc = "${qtbase.dev}/libexec/rcc"'
102     substituteInPlace src/cmake/linux.cmake \
103       --replace '/etc/xdg/autostart' "$out/etc/xdg/autostart" \
104       --replace '${"$"}{POLKIT_POLICY_DIR}' "$out/share/polkit-1/actions" \
105       --replace '/usr/share/dbus-1' "$out/share/dbus-1" \
106       --replace '${"$"}{SYSTEMD_UNIT_DIR}' "$out/lib/systemd/system"
108     substituteInPlace extension/CMakeLists.txt \
109       --replace '/etc' "$out/etc"
111     substituteInPlace src/connectionbenchmark/benchmarktaskdownload.cpp \
112       --replace 'QT_VERSION >= 0x060400' 'false'
114     ln -s '${netfilter-go-modules}' linux/netfilter/vendor
116     pushd extension/bridge
117     cargoDepsCopy="$extensionBridgeDepsCopy" cargoSetupPostPatchHook
118     popd
120     pushd signature
121     cargoDepsCopy="$signatureDepsCopy" cargoSetupPostPatchHook
122     popd
124     cargoSetupPostPatchHook() { true; }
125   '';
127   cmakeFlags = [
128     "-DQT_LCONVERT_EXECUTABLE=${qttools.dev}/bin/lconvert"
129     "-DQT_LUPDATE_EXECUTABLE=${qttools.dev}/bin/lupdate"
130     "-DQT_LRELEASE_EXECUTABLE=${qttools.dev}/bin/lrelease"
131   ];
132   dontFixCmake = true;
134   qtWrapperArgs =
135     [ "--prefix" "PATH" ":" (lib.makeBinPath [ wireguard-tools ]) ];
137   meta = {
138     description = "Client for the Mozilla VPN service";
139     homepage = "https://vpn.mozilla.org/";
140     license = lib.licenses.mpl20;
141     maintainers = with lib.maintainers; [ andersk ];
142     platforms = lib.platforms.linux;
143   };