-
Notifications
You must be signed in to change notification settings - Fork 3
/
kiosk.nix
53 lines (53 loc) · 1.69 KB
/
kiosk.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ pkgs, lib, ... }:
let
mouseUrl = "https://register.socallinuxexpo.org/reg6/?kiosk=1";
regularUrl = "http://signs.scale.lan/";
# using electron should be preferable, but in practice it has some
# quirks that make using chromium better
kioskProgram = pkgs.writeShellScript "kiosk.sh" ''
LAST_OCTET=$(ip -j route | ${lib.getExe pkgs.jq} '.[] | select(.dst == "default") | .prefsrc | split(".") | .[-1]' -r)
cd /home/kiosk
# account for ALT+F4 closing window in wayland
while true
do
if [ -e /sys/class/input/mouse1 ]
then
# required cross-origin-iframe and popup blocking flags due to iframe
${lib.getExe pkgs.ungoogled-chromium} --force-device-scale-factor=2.0 --blink-settings=allowScriptsToCloseWindows=true --user-agent="SCALE:$LAST_OCTET" --disable-popup-blocking --disable-throttle-non-visible-cross-origin-iframes --incognito --start-maximized --disable-gpu --kiosk ${mouseUrl}
else
${lib.getExe pkgs.ungoogled-chromium} --force-device-scale-factor=2.0 --incognito --start-maximized --disable-gpu --kiosk ${regularUrl}
fi
done
'';
in
{
# Disable CTRL keys
services.keyd = {
enable = true;
keyboards = {
default = {
ids = ["*"];
settings = {
main = {
control = "noop";
alt = "noop";
leftalt = "noop";
rightalt = "noop";
};
};
};
};
};
users.users.kiosk = {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
services.cage = {
enable = true;
user = "kiosk";
program = kioskProgram;
environment = {
WLR_LIBINPUT_NO_DEVICES = "1"; # boot up even if no mouse/keyboard connected
};
};
}