-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixos/soteria: init module (#355924)
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
lib, | ||
pkgs, | ||
config, | ||
... | ||
}: | ||
|
||
let | ||
cfg = config.security.soteria; | ||
in | ||
{ | ||
options.security.soteria = { | ||
enable = lib.mkEnableOption null // { | ||
description = '' | ||
Whether to enable Soteria, a Polkit authentication agent | ||
for any desktop environment. | ||
::: {.note} | ||
You should only enable this if you are on a Desktop Environment that | ||
does not provide a graphical polkit authentication agent, or you are on | ||
a standalone window manager or Wayland compositor. | ||
::: | ||
''; | ||
}; | ||
package = lib.mkPackageOption pkgs "soteria" { }; | ||
}; | ||
|
||
config = lib.mkIf cfg.enable { | ||
security.polkit.enable = true; | ||
environment.systemPackages = [ cfg.package ]; | ||
|
||
systemd.user.services.polkit-soteria = { | ||
description = "Soteria, Polkit authentication agent for any desktop environment"; | ||
|
||
wantedBy = [ "graphical-session.target" ]; | ||
wants = [ "graphical-session.target" ]; | ||
after = [ "graphical-session.target" ]; | ||
|
||
script = lib.getExe cfg.package; | ||
serviceConfig = { | ||
Type = "simple"; | ||
Restart = "on-failure"; | ||
RestartSec = 1; | ||
TimeoutStopSec = 10; | ||
}; | ||
}; | ||
}; | ||
|
||
meta.maintainers = with lib.maintainers; [ johnrtitor ]; | ||
} |