at 21.11-pre 4.4 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.services.xserver.desktopManager.surf-display; 7 8 surfDisplayConf = '' 9 # Surf Kiosk Display: Wrap around surf browser and turn your 10 # system into a browser screen in KIOSK-mode. 11 12 # default download URI for all display screens if not configured individually 13 DEFAULT_WWW_URI="${cfg.defaultWwwUri}" 14 15 # Enforce fixed resolution for all displays (default: not set): 16 #DEFAULT_RESOLUTION="1920x1080" 17 18 # HTTP proxy URL, if needed (default: not set). 19 #HTTP_PROXY_URL="http://webcache:3128" 20 21 # Setting for internal inactivity timer to restart surf-display 22 # if the user goes inactive/idle. 23 INACTIVITY_INTERVAL="${builtins.toString cfg.inactivityInterval}" 24 25 # log to syslog instead of .xsession-errors 26 LOG_TO_SYSLOG="yes" 27 28 # Launch pulseaudio daemon if not already running. 29 WITH_PULSEAUDIO="yes" 30 31 # screensaver settings, see "man 1 xset" for possible options 32 SCREENSAVER_SETTINGS="${cfg.screensaverSettings}" 33 34 # disable right and middle pointer device click in browser sessions while keeping 35 # scrolling wheels' functionality intact... (consider "pointer" subcommand on 36 # xmodmap man page for details). 37 POINTER_BUTTON_MAP="${cfg.pointerButtonMap}" 38 39 # Hide idle mouse pointer. 40 HIDE_IDLE_POINTER="${cfg.hideIdlePointer}" 41 42 ${cfg.extraConfig} 43 ''; 44 45in { 46 options = { 47 services.xserver.desktopManager.surf-display = { 48 enable = mkEnableOption "surf-display as a kiosk browser session"; 49 50 defaultWwwUri = mkOption { 51 type = types.str; 52 default = "${pkgs.surf-display}/share/surf-display/empty-page.html"; 53 example = "https://www.example.com/"; 54 description = "Default URI to display."; 55 }; 56 57 inactivityInterval = mkOption { 58 type = types.int; 59 default = 300; 60 example = "0"; 61 description = '' 62 Setting for internal inactivity timer to restart surf-display if the 63 user goes inactive/idle to get a fresh session for the next user of 64 the kiosk. 65 66 If this value is set to zero, the whole feature of restarting due to 67 inactivity is disabled. 68 ''; 69 }; 70 71 screensaverSettings = mkOption { 72 type = types.separatedString " "; 73 default = ""; 74 description = '' 75 Screensaver settings, see <literal>man 1 xset</literal> for possible options. 76 ''; 77 }; 78 79 pointerButtonMap = mkOption { 80 type = types.str; 81 default = "1 0 0 4 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; 82 description = '' 83 Disable right and middle pointer device click in browser sessions 84 while keeping scrolling wheels' functionality intact. See pointer 85 subcommand on <literal>man xmodmap</literal> for details. 86 ''; 87 }; 88 89 hideIdlePointer = mkOption { 90 type = types.str; 91 default = "yes"; 92 example = "no"; 93 description = "Hide idle mouse pointer."; 94 }; 95 96 extraConfig = mkOption { 97 type = types.lines; 98 default = ""; 99 example = '' 100 # Enforce fixed resolution for all displays (default: not set): 101 DEFAULT_RESOLUTION="1920x1080" 102 103 # HTTP proxy URL, if needed (default: not set). 104 HTTP_PROXY_URL="http://webcache:3128" 105 106 # Configure individual display screens with host specific parameters: 107 DISPLAYS['display-host-0']="www_uri=https://www.displayserver.comany.net/display-1/index.html" 108 DISPLAYS['display-host-1']="www_uri=https://www.displayserver.comany.net/display-2/index.html" 109 DISPLAYS['display-host-2']="www_uri=https://www.displayserver.comany.net/display-3/index.html|res=1920x1280" 110 DISPLAYS['display-host-3']="www_uri=https://www.displayserver.comany.net/display-4/index.html"|res=1280x1024" 111 DISPLAYS['display-host-local-file']="www_uri=file:///usr/share/doc/surf-display/empty-page.html" 112 ''; 113 description = '' 114 Extra configuration options to append to <literal>/etc/default/surf-display</literal>. 115 ''; 116 }; 117 }; 118 }; 119 120 config = mkIf cfg.enable { 121 services.xserver.displayManager.sessionPackages = [ 122 pkgs.surf-display 123 ]; 124 125 environment.etc."default/surf-display".text = surfDisplayConf; 126 }; 127}