Refactoring of the X server module:

* Modularised the xorg.conf generation.  For instance, the Wacom and
  Synaptics support has been moved into separate modules.  The
  contents of xorg.conf is defined by the option
  services.xserver.config, and various other options for specific
  sections (e.g. services.xserver.serverLayoutSection).

* displayManager.job.env: made this an attribute set.

* tcpEnable -> enableTCP for naming consistency.

* defaultDepth can be set to 0 to leave it undefined (needed for the
  vmware driver).

* Removed some options that seem obsolete or are now the default
  (e.g. RenderAccel, AllowGLXWithComposite).

* Removed services.xserver.package.  This can now be done using
  nixpkgs.config.packageOverrides.

svn path=/nixos/trunk/; revision=17004
This commit is contained in:
Eelco Dolstra 2009-09-10 12:37:33 +00:00
parent cbe27af191
commit 6920f43f1c
9 changed files with 622 additions and 726 deletions

View file

@ -96,6 +96,8 @@
./services/x11/xserver/display-managers/default.nix
./services/x11/xserver/display-managers/kdm.nix
./services/x11/xserver/display-managers/slim.nix
./services/x11/xserver/hardware/synaptics.nix
./services/x11/xserver/hardware/wacom.nix
./services/x11/xserver/window-managers/compiz.nix
./services/x11/xserver/window-managers/default.nix
./services/x11/xserver/window-managers/kwm.nix

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@ let
xcfg = config.services.xserver;
cfg = xcfg.desktopManager.kde4;
xorg = xcfg.package;
xorg = pkgs.xorg;
in

View file

@ -3,10 +3,11 @@
let
inherit (pkgs.lib) mkOption mergeOneOption optionals filter concatMap concatMapStrings;
cfg = config.services.xserver;
xorg = cfg.package;
xorg = pkgs.xorg;
# file provided by services.xserver.displayManager.session.script
xsession = wm: dm: pkgs.writeScript "xsession" ''#!/bin/sh
xsession = wm: dm: pkgs.writeScript "xsession" ''
#!/bin/sh
source /etc/profile
@ -161,12 +162,10 @@ in
job = mkOption {
default = {};
example = {
beforeScript = ''
preStart = ''
rm -f /var/log/slim.log
'';
env = ''
env SLIM_CFGFILE=/etc/slim.conf
'';
environment = { SLIM_CFGFILE = /etc/slim.conf; };
execCmd = "${pkgs.slim}/bin/slim";
};

View file

@ -74,11 +74,11 @@ in
services.xserver.displayManager.job =
{ beforeScript = "";
env = "";
environment = {};
execCmd = "${kdebase_workspace}/bin/kdm -config ${kdmrc}";
};
security.pam.services = [ { name = "kde"; localLogin = true; } ];
security.pam.services = [ { name = "kde"; localLogin = true; ckHack = true; } ];
};

View file

@ -93,15 +93,14 @@ in
config = mkIf cfg.enable {
services.xserver.displayManager.job =
{ beforeScript =
{ preStart =
''
rm -f /var/log/slim.log
'';
env =
''
env SLIM_CFGFILE=${slimConfig}
env SLIM_THEMESDIR=${slimThemesDir}
'';
environment =
{ SLIM_CFGFILE = slimConfig;
SLIM_THEMESDIR = slimThemesDir;
};
execCmd = "${pkgs.slim}/bin/slim";
};

View file

@ -0,0 +1,84 @@
{ config, pkgs, ... }:
with pkgs.lib;
let cfg = config.services.xserver.synaptics; in
{
options = {
services.xserver.synaptics = {
enable = mkOption {
default = false;
example = true;
description = "Whether to enable touchpad support.";
};
dev = mkOption {
default = "/dev/input/event0";
description = "Event device for Synaptics touchpad.";
};
minSpeed = mkOption {
default = "0.06";
description = "Cursor speed factor for precision finger motion.";
};
maxSpeed = mkOption {
default = "0.12";
description = "Cursor speed factor for highest-speed finger motion.";
};
twoFingerScroll = mkOption {
default = false;
description = "Whether to enable two-finger drag-scrolling.";
};
};
};
config = mkIf cfg.enable {
services.xserver.modules = [ pkgs.xorg.xf86inputsynaptics ];
services.xserver.config =
''
Section "InputDevice"
Identifier "Touchpad[0]"
Driver "synaptics"
Option "Device" "${cfg.dev}"
Option "Protocol" "PS/2"
Option "LeftEdge" "1700"
Option "RightEdge" "5300"
Option "TopEdge" "1700"
Option "BottomEdge" "4200"
Option "FingerLow" "25"
Option "FingerHigh" "30"
Option "MaxTapTime" "180"
Option "MaxTapMove" "220"
Option "VertScrollDelta" "100"
Option "MinSpeed" "${cfg.minSpeed}"
Option "MaxSpeed" "${cfg.maxSpeed}"
Option "AccelFactor" "0.0010"
Option "SHMConfig" "on"
Option "Repeater" "/dev/input/mice"
Option "TapButton1" "1"
Option "TapButton2" "2"
Option "TapButton3" "3"
Option "VertTwoFingerScroll" "${if cfg.twoFingerScroll then "1" else "0"}"
Option "HorizTwoFingerScroll" "${if cfg.twoFingerScroll then "1" else "0"}"
EndSection
'';
services.xserver.serverLayoutSection =
''
InputDevice "Touchpad[0]" "CorePointer"
'';
};
}

View file

@ -0,0 +1,88 @@
{ config, pkgs, ... }:
with pkgs.lib;
let
cfg = config.services.xserver.wacom;
in
{
options = {
services.xserver.wacom = {
enable = mkOption {
default = false;
description = "Whether to enable the Wacom touchscreen/digitizer.";
};
device = mkOption {
default = "/dev/ttyS0";
description = "Device to use.";
};
forceDeviceType = mkOption {
default = "ISDV4";
example = null;
description = "Some models (think touchscreen) require the device type to be specified.";
};
};
};
config = mkIf cfg.enable {
services.xserver.modules = [ pkgs.linuxwacom ];
services.udev.packages = [ pkgs.linuxwacom ];
services.xserver.serverLayoutSection =
''
InputDevice "Wacom_stylus"
InputDevice "Wacom_cursor"
InputDevice "Wacom_eraser"
'';
services.xserver.config =
''
Section "InputDevice"
Driver "wacom"
Identifier "Wacom_stylus"
Option "Device" "${cfg.device}"
Option "Type" "stylus"
${optionalString (cfg.forceDeviceType != null) ''
Option "ForceDevice" "${cfg.forceDeviceType}"
''}
Option "Button2" "3"
EndSection
Section "InputDevice"
Driver "wacom"
Identifier "Wacom_eraser"
Option "Device" "${cfg.device}"
Option "Type" "eraser"
${optionalString (cfg.forceDeviceType != null) ''
Option "ForceDevice" "${cfg.forceDeviceType}"
''}
Option "Button1" "2"
EndSection
Section "InputDevice"
Driver "wacom"
Identifier "Wacom_cursor"
Option "Device" "${cfg.device}"
Option "Type" "cursor"
${optionalString (cfg.forceDeviceType != null) ''
Option "ForceDevice" "${cfg.forceDeviceType}"
''}
EndSection
'';
};
}

View file

@ -1,92 +0,0 @@
Section "Files"
# Font directories.
@xfs@
@fontPaths@
# Module (driver) directories.
@modulePaths@
EndSection
Section "ServerFlags"
Option "AllowMouseOpenFail" "on"
EndSection
Section "Module"
Load "bitmap"
Load "int10"
Load "vbe"
@moduleSection@
@extraModules@
EndSection
@synapticsInputDevice@
@wacomInputDevice@
Section "Monitor"
Identifier "Monitor[0]"
Option "DPMS"
# HorizSync 28-49
# VertRefresh 43-75
@extraMonitorSettings@
EndSection
Section "Screen"
Identifier "Screen[0]"
Device "Device[0]"
Monitor "Monitor[0]"
DefaultDepth @defaultDepth@
SubSection "Display"
Depth 16
Modes @resolutions@
@extraDisplaySettings@
@virtualScreen@
EndSubSection
SubSection "Display"
Depth 24
Modes @resolutions@
@extraDisplaySettings@
@virtualScreen@
EndSubSection
#SubSection "Display"
# Depth 32
# Modes @resolutions@
# @extraDisplaySettings@
#EndSubSection
@screen@
EndSection
Section "Device"
Identifier "Device[0]"
Driver "@videoDriver@"
Option "Clone" "@isClone@"
@device@
@internalAGPGART@
@extraDeviceConfig@
EndSection
Section "ServerLayout"
Identifier "Layout[all]"
@setCorePointer@
Screen "Screen[0]"
@serverLayoutOptions@
# If you want to disable HAL-based configuration, set AutoAddDevices to 0
# Option "AutoAddDevices" "0"
EndSection
Section "Extensions"
@extensions@
EndSection
Section "DRI"
Mode 0666 # !!! FIX THIS!
EndSection