Commit 9796cbb0 authored by sinanmohd's avatar sinanmohd Committed by tomf
Browse files

nixos/seatd: init

parent 8be0176e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@

- [hddfancontrol](https://github.com/desbma/hddfancontrol), a service to regulate fan speeds based on hard drive temperature. Available as [services.hddfancontrol](#opt-services.hddfancontrol.enable).

- [seatd](https://sr.ht/~kennylevinsen/seatd/), A minimal seat management daemon. Available as [services.seatd](#opt-services.seatd.enable).

- [GoToSocial](https://gotosocial.org/), an ActivityPub social network server, written in Golang. Available as [services.gotosocial](#opt-services.gotosocial.enable).

- [Castopod](https://castopod.org/), an open-source hosting platform made for podcasters who want to engage and interact with their audience. Available as [services.castopod](#opt-services.castopod.enable).
+1 −0
Original line number Diff line number Diff line
@@ -474,6 +474,7 @@
  ./services/desktops/pipewire/pipewire.nix
  ./services/desktops/pipewire/wireplumber.nix
  ./services/desktops/profile-sync-daemon.nix
  ./services/desktops/seatd.nix
  ./services/desktops/system-config-printer.nix
  ./services/desktops/system76-scheduler.nix
  ./services/desktops/telepathy.nix
+49 −0
Original line number Diff line number Diff line
{ config, lib, pkgs, ... }:

let
  cfg = config.services.seatd;
  inherit (lib) mkEnableOption mkOption mdDoc types;
in
{
  meta.maintainers = with lib.maintainers; [ sinanmohd ];

  options.services.seatd = {
    enable = mkEnableOption (mdDoc "seatd");

    user = mkOption {
      type = types.str;
      default = "root";
      description = mdDoc "User to own the seatd socket";
    };
    group = mkOption {
      type = types.str;
      default = "seat";
      description = mdDoc "Group to own the seatd socket";
    };
    logLevel = mkOption {
      type = types.enum [ "debug" "info" "error" "silent" ];
      default = "info";
      description = mdDoc "Logging verbosity";
    };
  };

  config = lib.mkIf cfg.enable {
    environment.systemPackages = with pkgs; [ seatd ];
    users.groups.seat = lib.mkIf (cfg.group == "seat") {};

    systemd.services.seatd = {
      description = "Seat management daemon";
      documentation = [ "man:seatd(1)" ];

      wantedBy = [ "multi-user.target" ];
      restartIfChanged = false;

      serviceConfig = {
        Type = "simple";
        ExecStart = "${pkgs.seatd.bin}/bin/seatd -u ${cfg.user} -g ${cfg.group} -l ${cfg.logLevel}";
        RestartSec = 1;
        Restart = "always";
      };
    };
  };
}