85 lines
1.8 KiB
Nix
85 lines
1.8 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.services.kiosk;
|
|
in
|
|
{
|
|
options.services.kiosk = {
|
|
enable = mkEnableOption "Enable simple kiosk display";
|
|
|
|
user = mkOption {
|
|
type = types.str;
|
|
default = "root";
|
|
description = "The user to run the kiosk under";
|
|
};
|
|
|
|
cursor = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Allow a cursor";
|
|
};
|
|
|
|
session = mkOption {
|
|
type = types.lines;
|
|
default = "${pkgs.kitty}/bin/kitty ${pkgs.htop}/bin/htop";
|
|
description = "The session script to run for the kiosk";
|
|
};
|
|
|
|
wayland = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Use wayland instead of xserver";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
services.cage = mkIf cfg.wayland {
|
|
enable = true;
|
|
user = cfg.user;
|
|
program = cfg.session;
|
|
# TODO cursor
|
|
};
|
|
|
|
services.xserver = mkIf (!cfg.wayland) {
|
|
enable = true;
|
|
|
|
windowManager.ratpoison.enable = true;
|
|
|
|
monitorSection = ''
|
|
Option "NODPMS"
|
|
'';
|
|
|
|
serverLayoutSection = ''
|
|
Option "BlankTime" "0"
|
|
Option "DPMS" "false"
|
|
'';
|
|
|
|
displayManager.lightdm = {
|
|
enable = true;
|
|
autoLogin = {
|
|
enable = true;
|
|
user = "${cfg.user}";
|
|
};
|
|
};
|
|
|
|
displayManager.xserverArgs = if cfg.cursor then [ ] else [ "-nocursor" ];
|
|
displayManager.defaultSession = "kiosk+ratpoison";
|
|
|
|
desktopManager.session = [
|
|
{
|
|
name = "kiosk";
|
|
start = ''
|
|
# dont blank the screen after 5min
|
|
xset dpms force on
|
|
xset -dpms
|
|
xset s noblank
|
|
xset s off
|
|
|
|
${cfg.session}
|
|
'';
|
|
}
|
|
];
|
|
};
|
|
};
|
|
}
|