From 3d46c011d2cc2c9ca24d9b803e9daf156d9429ea Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Mon, 20 Sep 2021 21:13:20 +0200 Subject: [PATCH] opensnitch-ui: add module --- .github/CODEOWNERS | 2 ++ modules/lib/maintainers.nix | 7 +++++- modules/misc/news.nix | 8 +++++++ modules/modules.nix | 1 + modules/services/opensnitch-ui.nix | 38 ++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 modules/services/opensnitch-ui.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4d49c32d..b897cc51 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -304,6 +304,8 @@ /modules/services/notify-osd.nix @imalison +/modules/services/opensnitch-ui.nix @onny + /modules/services/pantalaimon.nix @jojosch /tests/modules/services/pantalaimon @jojosch diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 0a88c664..d3bd599f 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -133,11 +133,16 @@ github = "hawkw"; githubId = 2796466; }; - pamplemousse = { name = "Xavier Maso"; email = "xav.maso@gmail.com"; github = "pamplemousse"; githubId = 2647236; }; + onny = { + name = "onny"; + email = "onny@project-insanity.org"; + github = "onny"; + githubId = 757752; + }; } diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 15297915..19957f9c 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -2312,6 +2312,14 @@ in A new module is available: 'services.gromit-mpx'. ''; } + + { + time = "2021-12-12T17:09:38+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.opensnitch-ui'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 6d7ea4a7..49a13c3c 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -196,6 +196,7 @@ let ./services/network-manager-applet.nix ./services/nextcloud-client.nix ./services/notify-osd.nix + ./services/opensnitch-ui.nix ./services/owncloud-client.nix ./services/pantalaimon.nix ./services/parcellite.nix diff --git a/modules/services/opensnitch-ui.nix b/modules/services/opensnitch-ui.nix new file mode 100644 index 00000000..a086554c --- /dev/null +++ b/modules/services/opensnitch-ui.nix @@ -0,0 +1,38 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.opensnitch-ui; + +in { + + meta.maintainers = [ maintainers.onny ]; + + options = { + services.opensnitch-ui = { enable = mkEnableOption "Opensnitch client"; }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.opensnitch-ui" pkgs + lib.platforms.linux) + ]; + + systemd.user.services.opensnitch-ui = { + Unit = { + Description = "Opensnitch ui"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Service = { + Environment = "PATH=${config.home.profileDirectory}/bin"; + ExecStart = "${pkgs.opensnitch-ui}/bin/opensnitch-ui"; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + }; + }; +}