2010-04-15 17:46:38 +02:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.xserver.wacom;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.xserver.wacom = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
2013-01-05 20:38:23 +01:00
|
|
|
description = "Whether to enable the Wacom touchscreen/digitizer/tablet.";
|
2010-04-15 17:46:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
device = mkOption {
|
2013-01-05 20:38:23 +01:00
|
|
|
default = null;
|
|
|
|
example = "/dev/ttyS0";
|
|
|
|
description = "Device to use. Set to null for autodetect (think USB tablet).";
|
2010-04-15 17:46:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
forceDeviceType = mkOption {
|
2013-01-05 20:38:23 +01:00
|
|
|
default = null;
|
|
|
|
example = "ISDV4";
|
|
|
|
description = "Some models (think touchscreen) require the device type to be specified. Set to null for autodetect (think USB tablet).";
|
|
|
|
};
|
|
|
|
|
|
|
|
stylusExtraConfig = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = ''
|
|
|
|
Option "Button1" "2"
|
|
|
|
'';
|
|
|
|
description = "Lines to be added to Wacom_stylus InputDevice section.";
|
|
|
|
};
|
|
|
|
|
|
|
|
eraserExtraConfig = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = ''
|
|
|
|
Option "Button2" "3"
|
|
|
|
'';
|
|
|
|
description = "Lines to be added to Wacom_eraser InputDevice section.";
|
|
|
|
};
|
|
|
|
|
|
|
|
cursorExtraConfig = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "";
|
|
|
|
description = "Lines to be added to Wacom_cursor InputDevice section.";
|
2010-04-15 17:46:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
services.xserver.modules = [ pkgs.xf86_input_wacom ];
|
|
|
|
|
|
|
|
services.udev.packages = [ pkgs.xf86_input_wacom ];
|
|
|
|
|
|
|
|
services.xserver.serverLayoutSection =
|
|
|
|
''
|
|
|
|
InputDevice "Wacom_stylus"
|
|
|
|
InputDevice "Wacom_eraser"
|
2013-01-05 20:38:23 +01:00
|
|
|
InputDevice "Wacom_cursor"
|
2010-04-15 17:46:38 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
services.xserver.config =
|
|
|
|
''
|
|
|
|
Section "InputDevice"
|
|
|
|
Driver "wacom"
|
|
|
|
Identifier "Wacom_stylus"
|
2013-01-05 20:38:23 +01:00
|
|
|
${optionalString (cfg.device != null) ''
|
|
|
|
Option "Device" "${cfg.device}"
|
|
|
|
''}
|
2010-04-15 17:46:38 +02:00
|
|
|
Option "Type" "stylus"
|
|
|
|
${optionalString (cfg.forceDeviceType != null) ''
|
|
|
|
Option "ForceDevice" "${cfg.forceDeviceType}"
|
|
|
|
''}
|
2013-01-05 20:38:23 +01:00
|
|
|
${cfg.stylusExtraConfig}
|
2010-04-15 17:46:38 +02:00
|
|
|
EndSection
|
|
|
|
|
|
|
|
Section "InputDevice"
|
|
|
|
Driver "wacom"
|
|
|
|
Identifier "Wacom_eraser"
|
2013-01-05 20:38:23 +01:00
|
|
|
${optionalString (cfg.device != null) ''
|
|
|
|
Option "Device" "${cfg.device}"
|
|
|
|
''}
|
2010-04-15 17:46:38 +02:00
|
|
|
Option "Type" "eraser"
|
|
|
|
${optionalString (cfg.forceDeviceType != null) ''
|
|
|
|
Option "ForceDevice" "${cfg.forceDeviceType}"
|
|
|
|
''}
|
2013-01-05 20:38:23 +01:00
|
|
|
${cfg.eraserExtraConfig}
|
2010-04-15 17:46:38 +02:00
|
|
|
EndSection
|
|
|
|
|
|
|
|
Section "InputDevice"
|
|
|
|
Driver "wacom"
|
|
|
|
Identifier "Wacom_cursor"
|
2013-01-05 20:38:23 +01:00
|
|
|
${optionalString (cfg.device != null) ''
|
|
|
|
Option "Device" "${cfg.device}"
|
|
|
|
''}
|
2010-04-15 17:46:38 +02:00
|
|
|
Option "Type" "cursor"
|
|
|
|
${optionalString (cfg.forceDeviceType != null) ''
|
|
|
|
Option "ForceDevice" "${cfg.forceDeviceType}"
|
|
|
|
''}
|
2013-01-05 20:38:23 +01:00
|
|
|
${cfg.cursorExtraConfig}
|
2010-04-15 17:46:38 +02:00
|
|
|
EndSection
|
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|