Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unfinished and hacky, please don't judge
{ pkgs, lib, config, ... }: let
i3Config = pkgs.writeText "i3-minimal.conf" ''
# i3 config file (v4)
set $mod Mod4
floating_modifier $mod
font pango:monospace 8
bindsym $mod+f fullscreen toggle
default_border none
'';
cfg = config.services.vnc-thinclient;
in {
options = {
services.vnc-thinclient = {
user = lib.mkOption {
type = lib.types.string;
description = "User to run the VNC client as";
default = "vnc";
};
server = lib.mkOption {
type = lib.types.string;
description = "VNC server to connect to";
};
extraOptions = lib.mkOption {
type = lib.types.list lib.types.string;
description = "Extra command-line options passed to vncviewer";
};
};
};
config = {
users.users.${cfg.user} = {};
services.xserver = {
enable = true;
displayManager.auto = {
enable = true;
user = cfg.user;
};
windowManager.i3.enable = true;
};
systemd.services.vncviewer = {
wantedBy = ["multi-user.target"];
after = ["display-manager.service"];
path = [ pkgs.tigervnc pkgs.coreutils pkgs.xorg.xset ];
serviceConfig = {
User = cfg.user;
Restart = "always";
};
script = ''
set -x
export \
DISPLAY=:0 \
XAUTHORITY=${config.users.users.${cfg.user}.home}/.Xauthority
until xset -q >/dev/null; do sleep 1; done
vncviewer \
-FullScreen \
-AlertOnFatalError=off \
${lib.escapeShellArgs cfg.extraOptions} \
${lib.escapeShellArg cfg.server}
'';
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.