From 3afeae0c006210d2d6a5c65a43d1d3ce211f2862 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 20 Mar 2008 18:34:14 +0000 Subject: [PATCH] tightvnc service (there might still be some things to improve.. I can run it - has xfs check :) svn path=/nixos/trunk/; revision=11243 --- upstart-jobs/new-proposal/tightvnc.nix | 89 ++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 upstart-jobs/new-proposal/tightvnc.nix diff --git a/upstart-jobs/new-proposal/tightvnc.nix b/upstart-jobs/new-proposal/tightvnc.nix new file mode 100644 index 000000000000..054828a5230a --- /dev/null +++ b/upstart-jobs/new-proposal/tightvnc.nix @@ -0,0 +1,89 @@ +{ path, thisConfig, config, lib, pkgs, upstartHelpers } : with upstartHelpers; rec { + options = { + description = "tightvnc vnc server (share virtual desktop over network"; + + geometry = mkOption { + default = "-geometry 800x600"; + example = "800x600"; + description = '' + size of virtual screen + ''; + apply = x : "-geometry '${x}'"; + }; + depth = mkOption { + default = "-depth 24"; + description = '' + use screen-name instead the hostname to identify + this screen in the configuration. + value must be something between 8 and 32 + ''; + apply = x: "-depth '${x}'"; + check = x: (__lessThan x 33) && (7 __lessThan x); # not yet used + }; + display = mkOption { + default = ":8"; + example = 8; + description = "display to use"; + apply = x: ":${builtins.toString x}"; + }; + authFile = mkOption { + default = "-auth /etc/tightvnc-pwd"; + description = '' + The file containing authentication passwords. + Can be created using vncpasswd + ''; + apply = x: "-auth '${x}'"; + check = __pathExists; + }; + httpPort = mkOption { + default = "-httpport 5900"; + example = 5901; + description = "http port to listen to (Java applet remote interface)"; + apply = x: "-httpport '${builtins.toString x}'"; + }; + desktopName = mkOption { + description = '' + Set VNC desktop name ("x11" by default) + ''; + apply = x: "-desktop '${x}'"; + }; + viewOnly = mkOption { + default = ""; + description = '' + Don't accept keboard and pointer events from clients. All clients will be able to see + the desktop but won't be able to control it. + ''; + apply = x: "-viewonly '${x}'"; + }; + interface = mkOption { + default = ""; + description = '' + Listen for client connections only on the network interface with given ipaddr + ''; + apply = x: "-interface '${x}'"; + }; + extras = mkOption { + default = ""; + description = '' + additional params, see man Xvnc + ''; + }; + }; + + jobs = if (lib.getAttr ["services" "xfs" "enable"] false config) != true + then abort "you need to enable xfs services = { xfs = { enable = true; }; } within your nixos/configuration.nix file" + else + [ ( rec { + name = "tightvnc"; + + job = " +description \"${name}\" + +start on network-interfaces/started and xserver/started +stop on network-interfaces/stop or xserver/stop + +exec ${pkgs.tightvnc}/bin/Xvnc -fp unix/:7100 ${lib.concatStringsSep " " (lib.mapIf (x : x != "description") configV (__attrNames options ) ) } + "; +} ) ]; +} +#