{ buildGoModule, cargo, cmake, fetchFromGitHub, fetchpatch, go, lib, libcap, libgcrypt, libgpg-error, libsecret, pkg-config, python3, qt5compat, qtbase, qtnetworkauth, qtsvg, qttools, qtwayland, qtwebsockets, rustPlatform, rustc, stdenv, wireguard-tools, wrapQtAppsHook, }: stdenv.mkDerivation (finalAttrs: { pname = "mozillavpn"; version = "2.23.1"; src = fetchFromGitHub { owner = "mozilla-mobile"; repo = "mozilla-vpn-client"; rev = "v${finalAttrs.version}"; fetchSubmodules = true; hash = "sha256-NQM1ZII9owD9ek/Leo6WRfvNybZ5pUjDgvQGXQBrD+0="; }; patches = [ # Update cargo deps for "time" (fetchpatch { url = "https://github.com/mozilla-mobile/mozilla-vpn-client/commit/31d5799a30fc02067ad31d86b6ef63294bb3c3b8.patch"; hash = "sha256-ECrIcfhhSuvbqQ/ExPdFkQ6b9Q767lhUKmwPdDz7yxI="; }) ]; netfilterGoModules = (buildGoModule { inherit (finalAttrs) pname version src patches ; modRoot = "linux/netfilter"; vendorHash = "sha256-Cmo0wnl0z5r1paaEf1MhCPbInWeoMhGjnxCxGh0cyO8="; }).goModules; cargoDeps = rustPlatform.fetchCargoTarball { inherit (finalAttrs) src patches; hash = "sha256-JIe6FQL0xm6FYYGoIwwnOxq21sC1y8xPsr8tYPF0Mzo="; }; buildInputs = [ libcap libgcrypt libgpg-error libsecret qt5compat qtbase qtnetworkauth qtsvg qtwayland qtwebsockets ]; nativeBuildInputs = [ cargo cmake go pkg-config python3 python3.pkgs.glean-parser python3.pkgs.pyyaml python3.pkgs.setuptools qttools rustPlatform.cargoSetupHook rustc wrapQtAppsHook ]; postPatch = '' substituteInPlace src/cmake/linux.cmake \ --replace '/etc/xdg/autostart' "$out/etc/xdg/autostart" \ --replace '/usr/share/dbus-1' "$out/share/dbus-1" \ --replace '${"$"}{SYSTEMD_UNIT_DIR}' "$out/lib/systemd/system" substituteInPlace extension/CMakeLists.txt \ --replace '/etc' "$out/etc" ln -s '${finalAttrs.netfilterGoModules}' 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" ]; dontFixCmake = true; qtWrapperArgs = [ "--prefix" "PATH" ":" (lib.makeBinPath [ wireguard-tools ]) ]; meta = { description = "Client for the Mozilla VPN service"; mainProgram = "mozillavpn"; homepage = "https://vpn.mozilla.org/"; license = lib.licenses.mpl20; maintainers = with lib.maintainers; [ andersk ]; platforms = lib.platforms.linux; }; })