84 lines
2.2 KiB
Nix
84 lines
2.2 KiB
Nix
self:
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.services.rhemawave;
|
|
in
|
|
{
|
|
options.services.rhemawave = {
|
|
enable = lib.mkEnableOption "RhemaWave kiosk application";
|
|
|
|
package = lib.mkOption {
|
|
type = lib.types.package;
|
|
default = self.packages.${pkgs.system}.default;
|
|
description = "The RhemaWave package to use.";
|
|
};
|
|
|
|
# There should not be a "kioskUser" defined in the program
|
|
# That should be defined by the system, so everything kioskUser related
|
|
# has been commented out.
|
|
|
|
user = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "kiosk";
|
|
description = "User account that runs the kiosk session.";
|
|
};
|
|
|
|
# extraGroups = lib.mkOption {
|
|
# type = lib.types.listOf lib.types.str;
|
|
# default = [];
|
|
# description = "Additional groups for the kiosk user.";
|
|
# };
|
|
|
|
autoVolume = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = "Set all PipeWire sinks to full volume before launching.";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# # --- Kiosk user ---
|
|
# users.users.${cfg.kioskUser} = {
|
|
# isNormalUser = true;
|
|
# group = cfg.kioskUser;
|
|
# extraGroups = [ "audio" "video" "input" "networkmanager" ] ++ cfg.extraGroups;
|
|
# };
|
|
# users.groups.${cfg.kioskUser} = {};
|
|
|
|
# --- Display: agetty + cage ---
|
|
|
|
|
|
# --- Environment ---
|
|
environment.variables.SDL_VIDEODRIVER = "wayland";
|
|
|
|
# --- Networking ---
|
|
networking.networkmanager.enable = true;
|
|
|
|
# --- Audio: PipeWire + WirePlumber ---
|
|
services.pipewire = {
|
|
enable = true;
|
|
alsa.enable = true;
|
|
pulse.enable = true;
|
|
wireplumber.enable = true;
|
|
};
|
|
|
|
# --- Polkit rules ---
|
|
security.polkit.extraConfig = ''
|
|
polkit.addRule(function(action, subject) {
|
|
// Allow restarting getty@tty1
|
|
if (action.id == "org.freedesktop.systemd1.manage-units") {
|
|
var unit = action.lookup("unit");
|
|
if (unit == "getty@tty1.service") {
|
|
return polkit.Result.YES;
|
|
}
|
|
}
|
|
});
|
|
'';
|
|
|
|
# --- Make the package available system-wide ---
|
|
environment.systemPackages = [ cfg.package ];
|
|
};
|
|
}
|