summaryrefslogtreecommitdiff
path: root/sys/kiosk/default.nix
blob: be2082963ac34ef188f96ae7f2095feb43fc38ad (plain)
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
{
  config,
  lib,
  ...
}:
with lib; let
  cfg = config.local.kiosk;
in {
  options.local.kiosk = {
    enable = mkEnableOption "kiosk mode";

    program = mkOption {
      type = types.str;
    };

    user = mkOption {
      type = types.str;
    };

    allowVTSwitch = mkOption {
      type = types.bool;
      default = false;
    };
  };

  config = mkIf cfg.enable {
    services = {
      cage = {
        enable = true;
        inherit (cfg) program user;

        extraArguments = [
          (
            if cfg.allowVTSwitch
            then "-sd"
            else "-d"
          )
        ];
      };

      physlock = {
        enable = true;
        disableSysRq = true;
        muteKernelMessages = true;
      };
    };
  };
}