From 49834aef6c3cbf58dea93e77201eb3d088738bda Mon Sep 17 00:00:00 2001 From: KFears Date: Tue, 7 Jun 2022 16:42:23 +0500 Subject: [PATCH] nixos/openvpn3: add enable option --- nixos/modules/module-list.nix | 1 + nixos/modules/programs/openvpn3.nix | 33 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 nixos/modules/programs/openvpn3.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index c6d8f4acba38..43ae28ac02c5 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -197,6 +197,7 @@ ./programs/npm.nix ./programs/noisetorch.nix ./programs/oblogout.nix + ./programs/openvpn3.nix ./programs/pantheon-tweaks.nix ./programs/partition-manager.nix ./programs/plotinus.nix diff --git a/nixos/modules/programs/openvpn3.nix b/nixos/modules/programs/openvpn3.nix new file mode 100644 index 000000000000..f3101d3cebdc --- /dev/null +++ b/nixos/modules/programs/openvpn3.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.openvpn3; +in +{ + options.programs.openvpn3 = { + enable = mkEnableOption "the openvpn3 client"; + }; + + config = mkIf cfg.enable { + services.dbus.packages = with pkgs; [ + openvpn3 + ]; + + users.users.openvpn = { + isSystemUser = true; + uid = config.ids.uids.openvpn; + group = "openvpn"; + }; + + users.groups.openvpn = { + gid = config.ids.gids.openvpn; + }; + + environment.systemPackages = with pkgs; [ + openvpn3 + ]; + }; + +}