diff options
-rw-r--r-- | configuration.nix | 1 | ||||
-rw-r--r-- | modules/seatd.nix | 49 | ||||
-rw-r--r-- | modules/wayland.nix | 14 |
3 files changed, 58 insertions, 6 deletions
diff --git a/configuration.nix b/configuration.nix index 9c4febb..922b034 100644 --- a/configuration.nix +++ b/configuration.nix @@ -26,6 +26,7 @@ in isNormalUser = true; extraGroups = [ "wheel" + "seat" "adbusers" ]; packages = with pkgs; [ diff --git a/modules/seatd.nix b/modules/seatd.nix new file mode 100644 index 0000000..32fff58 --- /dev/null +++ b/modules/seatd.nix @@ -0,0 +1,49 @@ +{ 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"; + }; + }; + }; +} diff --git a/modules/wayland.nix b/modules/wayland.nix index a06834c..4ae34e1 100644 --- a/modules/wayland.nix +++ b/modules/wayland.nix @@ -1,6 +1,8 @@ { pkgs, ... }: { + imports = [ ./seatd.nix ]; + # pkgs environment.systemPackages = with pkgs; [ dwl-sinan @@ -47,9 +49,11 @@ }; # misc - hardware.opengl.enable = true; + services = { + seatd.enable = true; + dbus.enable = true; + }; - services.dbus.enable = true; programs = { xwayland.enable = true; gnupg.agent = { @@ -66,8 +70,6 @@ }; }; - security = { - polkit.enable = true; - pam.services.swaylock.text = "auth include login"; - }; + security.pam.services.swaylock.text = "auth include login"; + hardware.opengl.enable = true; } |