diff --git a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml index cee9095d3a9..23f1ddb76c4 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml @@ -219,6 +219,15 @@ to be able to access the device. + + + mozillavpn, + the client for the + Mozilla VPN + service. Available as + services.mozillavpn. + + mtr-exporter, diff --git a/nixos/doc/manual/release-notes/rl-2205.section.md b/nixos/doc/manual/release-notes/rl-2205.section.md index 8796afebc8b..3f6f77c567c 100644 --- a/nixos/doc/manual/release-notes/rl-2205.section.md +++ b/nixos/doc/manual/release-notes/rl-2205.section.md @@ -65,6 +65,8 @@ In addition to numerous new and upgraded packages, this release has the followin - [K40-Whisperer](https://www.scorchworks.com/K40whisperer/k40whisperer.html), a program to control cheap Chinese laser cutters. Available as [programs.k40-whisperer.enable](options.html#opt-programs.k4-whisperer.enable). Users must add themselves to the `k40` group to be able to access the device. +- [mozillavpn](https://github.com/mozilla-mobile/mozilla-vpn-client), the client for the [Mozilla VPN](https://vpn.mozilla.org/) service. Available as [services.mozillavpn](options.html#opt-services.mozillavpn). + - [mtr-exporter](https://github.com/mgumz/mtr-exporter), a Prometheus exporter for mtr metrics. Available as [services.mtr-exporter](options.html#opt-services.mtr-exporter.enable). - [prometheus-pve-exporter](https://github.com/prometheus-pve/prometheus-pve-exporter), a tool that exposes information from the Proxmox VE API for use by Prometheus. Available as [services.prometheus.exporters.pve](options.html#opt-services.prometheus.exporters.pve). diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 1ad2592b1dd..c11497e46f1 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -816,6 +816,7 @@ ./services/networking/mosquitto.nix ./services/networking/monero.nix ./services/networking/morty.nix + ./services/networking/mozillavpn.nix ./services/networking/miredo.nix ./services/networking/mstpd.nix ./services/networking/mtprotoproxy.nix diff --git a/nixos/modules/services/networking/mozillavpn.nix b/nixos/modules/services/networking/mozillavpn.nix new file mode 100644 index 00000000000..e35ba65314e --- /dev/null +++ b/nixos/modules/services/networking/mozillavpn.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: + +{ + options.services.mozillavpn.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enable the Mozilla VPN daemon. + ''; + }; + + config = lib.mkIf config.services.mozillavpn.enable { + environment.systemPackages = [ pkgs.mozillavpn ]; + services.dbus.packages = [ pkgs.mozillavpn ]; + systemd.packages = [ pkgs.mozillavpn ]; + }; + + meta.maintainers = with lib.maintainers; [ andersk ]; +} diff --git a/pkgs/tools/networking/mozillavpn/default.nix b/pkgs/tools/networking/mozillavpn/default.nix new file mode 100644 index 00000000000..9e4e7cc29d4 --- /dev/null +++ b/pkgs/tools/networking/mozillavpn/default.nix @@ -0,0 +1,111 @@ +{ buildGoModule +, fetchFromGitHub +, go +, lib +, pkg-config +, polkit +, python3 +, qmake +, qtbase +, qtcharts +, qtgraphicaleffects +, qtnetworkauth +, qtquickcontrols2 +, qttools +, qtwebsockets +, 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.7.1"; + src = fetchFromGitHub { + owner = "mozilla-mobile"; + repo = "mozilla-vpn-client"; + rev = "v${version}"; + fetchSubmodules = true; + hash = "sha256-i551UkCOwWnioe1YgCNZAlYiQJ4YDDBMoDZhfbkLTbs="; + }; + + netfilter-go-modules = (buildGoModule { + inherit pname version src; + vendorSha256 = "sha256-KFYMim5U8WlJHValvIBQgEN+17SDv0JVbH03IiyfDc0="; + modRoot = "linux/netfilter"; + }).go-modules; + +in +stdenv.mkDerivation { + inherit pname version src; + + buildInputs = [ + polkit + qtbase + qtcharts + qtgraphicaleffects + qtnetworkauth + qtquickcontrols2 + qtwebsockets + ]; + nativeBuildInputs = [ + glean_parser_4_1_1 + go + pkg-config + python3 + python3.pkgs.pyyaml + qmake + qttools + which + wrapQtAppsHook + ]; + + 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/generate_glean.py + python3 scripts/importLanguages.py + ''; + + qmakeFlags = [ "USRPATH=$(out)" "ETCPATH=$(out)/etc" ]; + 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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bb7a4ae839e..9e56fc859a8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5082,6 +5082,8 @@ with pkgs; mcrcon = callPackage ../tools/networking/mcrcon {}; + mozillavpn = libsForQt5.callPackage ../tools/networking/mozillavpn { }; + mozwire = callPackage ../tools/networking/mozwire { inherit (darwin.apple_sdk.frameworks) Security; };