1{
2 lib,
3 pkgs,
4 config,
5 ...
6}:
7
8let
9 cfg = config.security.soteria;
10in
11{
12 options.security.soteria = {
13 enable = lib.mkEnableOption null // {
14 description = ''
15 Whether to enable Soteria, a Polkit authentication agent
16 for any desktop environment.
17
18 ::: {.note}
19 You should only enable this if you are on a Desktop Environment that
20 does not provide a graphical polkit authentication agent, or you are on
21 a standalone window manager or Wayland compositor.
22 :::
23 '';
24 };
25 package = lib.mkPackageOption pkgs "soteria" { };
26 };
27
28 config = lib.mkIf cfg.enable {
29 security.polkit.enable = true;
30 environment.systemPackages = [ cfg.package ];
31
32 systemd.user.services.polkit-soteria = {
33 description = "Soteria, Polkit authentication agent for any desktop environment";
34
35 wantedBy = [ "graphical-session.target" ];
36 wants = [ "graphical-session.target" ];
37 after = [ "graphical-session.target" ];
38
39 script = lib.getExe cfg.package;
40 serviceConfig = {
41 Type = "simple";
42 Restart = "on-failure";
43 RestartSec = 1;
44 TimeoutStopSec = 10;
45 };
46 };
47 };
48
49 meta.maintainers = with lib.maintainers; [ johnrtitor ];
50}