1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8let
9 cfg = config.services.seatd;
10 inherit (lib) mkEnableOption mkOption types;
11in
12{
13 meta.maintainers = with lib.maintainers; [ sinanmohd ];
14
15 options.services.seatd = {
16 enable = mkEnableOption "seatd";
17
18 user = mkOption {
19 type = types.str;
20 default = "root";
21 description = "User to own the seatd socket";
22 };
23 group = mkOption {
24 type = types.str;
25 default = "seat";
26 description = "Group to own the seatd socket";
27 };
28 logLevel = mkOption {
29 type = types.enum [
30 "debug"
31 "info"
32 "error"
33 "silent"
34 ];
35 default = "info";
36 description = "Logging verbosity";
37 };
38 };
39
40 config = lib.mkIf cfg.enable {
41 environment.systemPackages = with pkgs; [
42 seatd
43 sdnotify-wrapper
44 ];
45 users.groups.seat = lib.mkIf (cfg.group == "seat") { };
46
47 systemd.services.seatd = {
48 description = "Seat management daemon";
49 documentation = [ "man:seatd(1)" ];
50
51 wantedBy = [ "multi-user.target" ];
52 restartIfChanged = false;
53
54 serviceConfig = {
55 Type = "notify";
56 NotifyAccess = "all";
57 SyslogIdentifier = "seatd";
58 ExecStart = "${pkgs.sdnotify-wrapper}/bin/sdnotify-wrapper ${pkgs.seatd.bin}/bin/seatd -n 1 -u ${cfg.user} -g ${cfg.group} -l ${cfg.logLevel}";
59 RestartSec = 1;
60 Restart = "always";
61 };
62 };
63 };
64}