2009-01-02 16:07:21 +00:00
|
|
|
{config, pkgs, ...}:
|
|
|
|
# TODO: this file need some make-up (Nicolas Pierron)
|
2006-11-28 22:27:56 +00:00
|
|
|
|
2009-05-24 18:28:30 +00:00
|
|
|
with pkgs.lib;
|
|
|
|
|
2009-01-02 16:07:21 +00:00
|
|
|
let
|
|
|
|
kernelPackages = config.boot.kernelPackages;
|
|
|
|
# List of font directories.
|
2009-01-02 16:07:39 +00:00
|
|
|
fontDirectories = config.fonts.fonts;
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
|
|
options = {
|
|
|
|
services = {
|
|
|
|
|
|
|
|
xserver = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "
|
|
|
|
Whether to enable the X server.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
autorun = mkOption {
|
|
|
|
default = true;
|
|
|
|
description = "
|
|
|
|
Switch to false to create upstart-job and configuration,
|
|
|
|
but not run it automatically
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
exportConfiguration = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "
|
|
|
|
Create /etc/X11/xorg.conf and a file with environment
|
|
|
|
variables
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
tcpEnable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "
|
|
|
|
Whether to enable TCP socket for the X server.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
resolutions = mkOption {
|
|
|
|
default = [{x = 1024; y = 768;} {x = 800; y = 600;} {x = 640; y = 480;}];
|
|
|
|
description = "
|
|
|
|
The screen resolutions for the X server. The first element is the default resolution.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
videoDriver = mkOption {
|
|
|
|
default = "vesa";
|
|
|
|
example = "i810";
|
|
|
|
description = "
|
|
|
|
The name of the video driver for your graphics card.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
driSupport = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "
|
|
|
|
Whether to enable accelerated OpenGL rendering through the
|
|
|
|
Direct Rendering Interface (DRI).
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
/*
|
2009-01-02 16:07:21 +00:00
|
|
|
sessionType = mkOption {
|
|
|
|
default = "gnome";
|
|
|
|
example = "xterm";
|
|
|
|
description = "
|
|
|
|
The kind of session to start after login. Current possibilies
|
|
|
|
are <literal>kde</literal> (which starts KDE),
|
|
|
|
<literal>gnome</literal> (which starts
|
|
|
|
<command>gnome-terminal</command>) and <literal>xterm</literal>
|
|
|
|
(which starts <command>xterm</command>).
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
windowManager = mkOption {
|
|
|
|
default = "";
|
|
|
|
description = "
|
|
|
|
This option selects the window manager. Available values are
|
|
|
|
<literal>twm</literal> (extremely primitive),
|
|
|
|
<literal>metacity</literal>, <literal>xmonad</literal>
|
|
|
|
and <literal>compiz</literal>. If
|
|
|
|
left empty, the <option>sessionType</option> determines the
|
|
|
|
window manager, e.g., Metacity for Gnome, and
|
|
|
|
<command>kwm</command> for KDE.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
sessionStarter = mkOption {
|
|
|
|
example = "${pkgs.xterm}/bin/xterm -ls";
|
|
|
|
description = "
|
|
|
|
The command executed after login and after the window manager
|
|
|
|
has been started. Used if
|
|
|
|
<option>services.xserver.sessionType</option> is empty.
|
|
|
|
";
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
*/
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
|
|
startSSHAgent = mkOption {
|
|
|
|
default = true;
|
|
|
|
description = "
|
|
|
|
Whether to start the SSH agent when you log in. The SSH agent
|
|
|
|
remembers private keys for you so that you don't have to type in
|
|
|
|
passphrases every time you make an SSH connection. Use
|
|
|
|
<command>ssh-add</command> to add a key to the agent.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
isClone = mkOption {
|
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
description = "
|
|
|
|
Whether to enable the X server clone mode for dual-head.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
synaptics = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = "
|
|
|
|
Whether to replace mouse with touchpad.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
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";
|
|
|
|
};
|
2009-01-02 19:41:39 +00:00
|
|
|
twoFingerScroll = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable two-finger drag-scrolling";
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
};
|
|
|
|
|
2009-08-03 19:55:33 +00:00
|
|
|
wacom = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable Wacom touchscreen/digitizer";
|
|
|
|
};
|
|
|
|
|
|
|
|
device = mkOption {
|
|
|
|
default = "/dev/ttyS0";
|
|
|
|
description = "Device to use";
|
|
|
|
};
|
|
|
|
|
|
|
|
forceDeviceType = mkOption {
|
|
|
|
default = "ISDV4";
|
|
|
|
example = null;
|
|
|
|
description = "Some models (think touchscreen) require forcing device type";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2009-01-02 16:07:21 +00:00
|
|
|
layout = mkOption {
|
|
|
|
default = "us";
|
|
|
|
description = "
|
|
|
|
Keyboard layout.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
xkbModel = mkOption {
|
|
|
|
default = "pc104";
|
|
|
|
example = "presario";
|
|
|
|
description = "
|
|
|
|
Keyboard model.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
xkbOptions = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "grp:caps_toggle, grp_led:scroll";
|
|
|
|
description = "
|
|
|
|
X keyboard options; layout switching goes here.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
useInternalAGPGART = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "no";
|
|
|
|
description = "
|
|
|
|
Just the wrapper for an xorg.conf option.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraDeviceConfig = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "VideoRAM 131072";
|
|
|
|
description = "
|
|
|
|
Just anything to add into Device section.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraMonitorSettings = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "HorizSync 28-49";
|
|
|
|
description = "
|
|
|
|
Just anything to add into Monitor section.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraDisplaySettings = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "Virtual 2048 2048";
|
|
|
|
description = "
|
|
|
|
Just anything to add into Display subsection (located in Screen section).
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraModules = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "
|
|
|
|
SubSection \"extmod\"
|
|
|
|
EndSubsection
|
|
|
|
";
|
|
|
|
description = "
|
|
|
|
Just anything to add into Modules section.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
serverLayoutOptions = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "
|
|
|
|
Option \"AIGLX\" \"true\"
|
|
|
|
";
|
|
|
|
description = "
|
|
|
|
Just anything to add into Monitor section.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultDepth = mkOption {
|
|
|
|
default = 24;
|
|
|
|
example = 8;
|
|
|
|
description = "
|
|
|
|
Default colour depth.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
useXFS = mkOption {
|
|
|
|
default = false;
|
|
|
|
example = "unix/:7100";
|
|
|
|
description = "
|
|
|
|
Way to access the X Font Server to use.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
tty = mkOption {
|
|
|
|
default = 7;
|
|
|
|
example = 9;
|
|
|
|
description = "
|
|
|
|
Virtual console for the X server.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
display = mkOption {
|
|
|
|
default = 0;
|
|
|
|
example = 1;
|
|
|
|
description = "
|
|
|
|
Display number for the X server.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
default = pkgs.xorg;
|
|
|
|
description = "
|
|
|
|
Alternative X.org package to use. For
|
|
|
|
example, you can replace individual drivers.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
virtualScreen = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = {
|
|
|
|
x=2048;
|
|
|
|
y=2048;
|
|
|
|
};
|
|
|
|
description = "
|
|
|
|
Virtual screen size for Xrandr
|
|
|
|
";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2009-06-25 22:08:03 +00:00
|
|
|
|
|
|
|
environment.x11Packages = mkOption {
|
|
|
|
default = [];
|
2009-06-25 22:49:05 +00:00
|
|
|
type = types.list types.package;
|
2009-06-25 22:08:03 +00:00
|
|
|
description = "
|
|
|
|
List of packages added to the system when the xserver is
|
|
|
|
activated. (<option>services.xserver.enable</option>).
|
|
|
|
";
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
};
|
|
|
|
in
|
2006-11-28 22:27:56 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2008-01-04 10:54:33 +00:00
|
|
|
# Abbreviations.
|
|
|
|
cfg = config.services.xserver;
|
2008-08-08 18:57:11 +00:00
|
|
|
xorg = cfg.package;
|
2008-02-22 03:08:26 +00:00
|
|
|
stdenv = pkgs.stdenv;
|
2008-01-04 10:54:33 +00:00
|
|
|
|
2008-10-10 16:45:56 +00:00
|
|
|
knownVideoDrivers = {
|
2009-04-08 14:01:16 +00:00
|
|
|
nvidia = { modulesFirst = [ kernelPackages.nvidia_x11 ]; }; #make sure it first loads the nvidia libs
|
2009-04-11 22:12:02 +00:00
|
|
|
vesa = { modules = [xorg.xf86videovesa]; };
|
|
|
|
vga = { modules = [xorg.xf86videovga]; };
|
|
|
|
sis = { modules = [xorg.xf86videosis]; };
|
|
|
|
i810 = { modules = [xorg.xf86videoi810]; };
|
|
|
|
intel = { modules = [xorg.xf86videointel]; };
|
|
|
|
nv = { modules = [xorg.xf86videonv]; };
|
|
|
|
ati = { modules = [xorg.xf86videoati]; };
|
2009-07-11 10:33:42 +00:00
|
|
|
openchrome = { modules = [xorg.xf86videoopenchrome]; };
|
2009-04-08 13:50:32 +00:00
|
|
|
cirrus = { modules = [xorg.xf86videocirrus]; };
|
2008-10-10 16:45:56 +00:00
|
|
|
};
|
|
|
|
|
2007-03-06 00:07:00 +00:00
|
|
|
# Get a bunch of user settings.
|
2007-11-09 18:49:45 +00:00
|
|
|
videoDriver = cfg.videoDriver;
|
2008-01-04 10:28:12 +00:00
|
|
|
resolutions = map (res: ''"${toString res.x}x${toString res.y}"'') (cfg.resolutions);
|
2007-03-06 00:07:00 +00:00
|
|
|
|
2009-05-24 18:28:30 +00:00
|
|
|
videoDriverModules = attrByPath [videoDriver] (throw "unknown video driver: `${videoDriver}'") knownVideoDrivers;
|
2007-03-06 00:07:00 +00:00
|
|
|
|
2007-05-28 14:09:04 +00:00
|
|
|
modules =
|
2009-05-24 18:28:30 +00:00
|
|
|
attrByPath ["modulesFirst"] [] videoDriverModules
|
2008-01-07 22:56:16 +00:00
|
|
|
++ [
|
2007-05-29 19:53:03 +00:00
|
|
|
xorg.xorgserver
|
2009-04-28 13:49:05 +00:00
|
|
|
xorg.xf86inputevdev
|
2007-05-29 19:53:03 +00:00
|
|
|
]
|
2009-05-24 18:28:30 +00:00
|
|
|
++ attrByPath ["modules"] [] videoDriverModules
|
2009-08-03 19:55:33 +00:00
|
|
|
++ optional cfg.synaptics.enable xorg.xf86inputsynaptics
|
|
|
|
++ (optional cfg.wacom.enable ["${pkgs.linuxwacom}"])
|
|
|
|
;
|
2008-01-04 10:54:33 +00:00
|
|
|
|
2008-01-04 10:28:12 +00:00
|
|
|
|
2008-08-27 10:00:49 +00:00
|
|
|
fontsForXServer =
|
|
|
|
fontDirectories ++
|
|
|
|
# We don't want these fonts in fonts.conf, because then modern,
|
|
|
|
# fontconfig-based applications will get horrible bitmapped
|
|
|
|
# Helvetica fonts. It's better to get a substitution (like Nimbus
|
|
|
|
# Sans) than that horror. But we do need the Adobe fonts for some
|
|
|
|
# old non-fontconfig applications. (Possibly this could be done
|
|
|
|
# better using a fontconfig rule.)
|
|
|
|
[ pkgs.xorg.fontadobe100dpi
|
|
|
|
pkgs.xorg.fontadobe75dpi
|
|
|
|
];
|
2009-06-25 23:29:49 +00:00
|
|
|
|
|
|
|
|
2009-08-11 21:16:59 +00:00
|
|
|
halConfigFiles = singleton
|
2009-06-25 23:29:49 +00:00
|
|
|
(pkgs.writeTextFile {
|
|
|
|
name = "hal-policy-keymap";
|
2009-08-11 21:16:59 +00:00
|
|
|
destination = "/share/hal/fdi/policy/30-keymap.fdi";
|
2009-06-25 23:29:49 +00:00
|
|
|
text = ''
|
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
|
<deviceinfo version="0.2">
|
|
|
|
<device>
|
|
|
|
<match key="info.capabilities" contains="input.keymap">
|
|
|
|
<append key="info.callouts.add" type="strlist">hal-setup-keymap</append>
|
|
|
|
</match>
|
|
|
|
|
|
|
|
<match key="info.capabilities" contains="input.keys">
|
|
|
|
<merge key="input.x11_options.XkbRules" type="string">base</merge>
|
|
|
|
<merge key="input.x11_options.XkbModel" type="string">${cfg.xkbModel}</merge>
|
|
|
|
<merge key="input.x11_options.XkbLayout" type="string">${cfg.layout}</merge>
|
|
|
|
<append key="input.x11_options.XkbOptions" type="strlist">${cfg.xkbOptions}</append>
|
|
|
|
</match>
|
|
|
|
</device>
|
|
|
|
</deviceinfo>
|
|
|
|
'';
|
2009-08-11 21:16:59 +00:00
|
|
|
});
|
2008-08-27 10:00:49 +00:00
|
|
|
|
2009-08-11 21:16:59 +00:00
|
|
|
|
2007-02-26 23:11:32 +00:00
|
|
|
configFile = stdenv.mkDerivation {
|
2006-11-28 22:27:56 +00:00
|
|
|
name = "xserver.conf";
|
|
|
|
src = ./xserver.conf;
|
2008-08-27 10:06:25 +00:00
|
|
|
inherit fontsForXServer videoDriver resolutions;
|
2008-01-04 10:36:14 +00:00
|
|
|
isClone = if cfg.isClone then "on" else "off";
|
2007-11-06 00:00:29 +00:00
|
|
|
|
2008-05-16 07:32:00 +00:00
|
|
|
synapticsInputDevice = if cfg.synaptics.enable then ''
|
2008-01-04 10:28:12 +00:00
|
|
|
Section "InputDevice"
|
|
|
|
Identifier "Touchpad[0]"
|
|
|
|
Driver "synaptics"
|
2008-05-16 07:32:00 +00:00
|
|
|
Option "Device" "${cfg.synaptics.dev}"
|
2008-01-04 10:28:12 +00:00
|
|
|
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"
|
2008-05-16 07:32:00 +00:00
|
|
|
Option "MinSpeed" "${cfg.synaptics.minSpeed}"
|
|
|
|
Option "MaxSpeed" "${cfg.synaptics.maxSpeed}"
|
2008-01-04 10:28:12 +00:00
|
|
|
Option "AccelFactor" "0.0010"
|
|
|
|
Option "SHMConfig" "on"
|
|
|
|
Option "Repeater" "/dev/input/mice"
|
|
|
|
Option "TapButton1" "1"
|
|
|
|
Option "TapButton2" "2"
|
|
|
|
Option "TapButton3" "3"
|
2009-01-02 19:41:39 +00:00
|
|
|
Option "VertTwoFingerScroll" "${if cfg.synaptics.twoFingerScroll then "1" else "0"}"
|
|
|
|
Option "HorizTwoFingerScroll" "${if cfg.synaptics.twoFingerScroll then "1" else "0"}"
|
2008-01-04 10:28:12 +00:00
|
|
|
EndSection
|
|
|
|
'' else "";
|
|
|
|
|
2009-08-03 19:55:33 +00:00
|
|
|
wacomInputDevice = if cfg.wacom.enable then ''
|
|
|
|
Section "InputDevice"
|
|
|
|
Driver "wacom"
|
|
|
|
Identifier "Wacom_stylus"
|
|
|
|
Option "Device" "${cfg.wacom.device}"
|
|
|
|
Option "Type" "stylus"
|
|
|
|
${if cfg.wacom.forceDeviceType!=null then ''Option "ForceDevice" "${cfg.wacom.forceDeviceType}"'' else ""}
|
|
|
|
Option "Button2" "3"
|
|
|
|
EndSection
|
|
|
|
Section "InputDevice"
|
|
|
|
Driver "wacom"
|
|
|
|
Identifier "Wacom_eraser"
|
|
|
|
Option "Device" "${cfg.wacom.device}"
|
|
|
|
Option "Type" "eraser"
|
|
|
|
${if cfg.wacom.forceDeviceType!=null then ''Option "ForceDevice" "${cfg.wacom.forceDeviceType}"'' else ""}
|
|
|
|
Option "Button1" "2"
|
|
|
|
EndSection
|
|
|
|
Section "InputDevice"
|
|
|
|
Driver "wacom"
|
|
|
|
Identifier "Wacom_cursor"
|
|
|
|
Option "Device" "${cfg.wacom.device}"
|
|
|
|
Option "Type" "cursor"
|
|
|
|
${if cfg.wacom.forceDeviceType!=null then ''Option "ForceDevice" "${cfg.wacom.forceDeviceType}"'' else ""}
|
|
|
|
EndSection
|
|
|
|
'' else "";
|
|
|
|
|
2008-01-04 10:28:12 +00:00
|
|
|
xkbOptions = if cfg.xkbOptions == "" then "" else ''
|
|
|
|
Option "XkbOptions" "${cfg.xkbOptions}"
|
|
|
|
'';
|
2007-11-06 00:00:29 +00:00
|
|
|
|
2009-04-28 13:49:05 +00:00
|
|
|
setCorePointer =
|
|
|
|
if cfg.synaptics.enable then ''
|
|
|
|
InputDevice "Touchpad[0]" "CorePointer"
|
|
|
|
'' else "";
|
2007-11-06 00:00:29 +00:00
|
|
|
|
|
|
|
internalAGPGART =
|
2008-01-04 10:28:12 +00:00
|
|
|
if cfg.useInternalAGPGART == "yes" then
|
|
|
|
'' Option "UseInternalAGPGART" "yes"''
|
|
|
|
else if cfg.useInternalAGPGART == "no" then
|
2008-07-23 14:13:27 +00:00
|
|
|
'' Option "UseInternalAGPGART" "no"''
|
2008-01-04 10:28:12 +00:00
|
|
|
else "";
|
2007-11-06 00:00:29 +00:00
|
|
|
|
2007-11-09 18:49:45 +00:00
|
|
|
extraDeviceConfig = cfg.extraDeviceConfig;
|
|
|
|
extraMonitorSettings = cfg.extraMonitorSettings;
|
2008-01-02 21:16:58 +00:00
|
|
|
extraDisplaySettings = cfg.extraDisplaySettings;
|
2007-11-09 18:49:45 +00:00
|
|
|
extraModules = cfg.extraModules;
|
2009-08-03 19:55:33 +00:00
|
|
|
serverLayoutOptions = cfg.serverLayoutOptions +
|
|
|
|
(if cfg.wacom.enable then ''
|
|
|
|
InputDevice "Wacom_stylus"
|
|
|
|
InputDevice "Wacom_cursor"
|
|
|
|
InputDevice "Wacom_eraser"
|
|
|
|
'' else "")
|
|
|
|
;
|
2007-11-09 18:49:45 +00:00
|
|
|
defaultDepth = cfg.defaultDepth;
|
2008-10-24 10:30:38 +00:00
|
|
|
virtualScreen = if cfg.virtualScreen != null then
|
|
|
|
"Virtual ${toString cfg.virtualScreen.x} ${toString cfg.virtualScreen.y}"
|
|
|
|
else "";
|
2007-09-24 09:02:43 +00:00
|
|
|
|
2008-01-04 10:28:12 +00:00
|
|
|
xfs = if cfg.useXFS == false then "" else
|
|
|
|
''FontPath "${toString cfg.useXFS}"'';
|
2007-12-25 12:16:38 +00:00
|
|
|
|
2008-01-04 10:28:12 +00:00
|
|
|
buildCommand = ''
|
2007-02-25 15:53:57 +00:00
|
|
|
buildCommand= # urgh, don't substitute this
|
2007-02-26 21:39:07 +00:00
|
|
|
|
2007-02-25 15:53:57 +00:00
|
|
|
export fontPaths=
|
2008-08-27 10:06:25 +00:00
|
|
|
for i in $fontsForXServer; do
|
2008-01-04 10:28:12 +00:00
|
|
|
if test "''${i:0:''${#NIX_STORE}}" == "$NIX_STORE"; then
|
2007-02-25 15:53:57 +00:00
|
|
|
for j in $(find $i -name fonts.dir); do
|
2008-01-04 10:28:12 +00:00
|
|
|
fontPaths="''${fontPaths}FontPath \"$(dirname $j)\"''\n"
|
2007-02-25 15:53:57 +00:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
done
|
2007-02-26 21:39:07 +00:00
|
|
|
|
|
|
|
export modulePaths=
|
2007-02-26 23:11:32 +00:00
|
|
|
for i in $(find ${toString modules} -type d); do
|
2008-01-07 22:56:16 +00:00
|
|
|
if ls $i/*.so* > /dev/null 2>&1; then
|
2008-01-04 10:28:12 +00:00
|
|
|
modulePaths="''${modulePaths}ModulePath \"$i\"''\n"
|
2007-02-26 21:39:07 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2008-01-07 23:12:02 +00:00
|
|
|
export moduleSection=""
|
|
|
|
export screen=""
|
|
|
|
export device=""
|
|
|
|
export extensions=""
|
|
|
|
|
|
|
|
|
2007-05-28 14:09:04 +00:00
|
|
|
#if only my gf were this dirty
|
2008-01-04 10:28:12 +00:00
|
|
|
if test "${toString videoDriver}" == "nvidia"; then
|
2007-10-03 14:48:41 +00:00
|
|
|
export screen='
|
2008-01-04 10:28:12 +00:00
|
|
|
Option "AddARGBGLXVisuals" "true"
|
|
|
|
Option "DisableGLXRootClipping" "true"
|
2008-07-23 14:13:27 +00:00
|
|
|
Option "RandRRotation" "on"
|
2007-10-03 14:48:41 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
export device='
|
2008-01-04 10:28:12 +00:00
|
|
|
Option "RenderAccel" "true"
|
|
|
|
Option "AllowGLXWithComposite" "true"
|
|
|
|
Option "AddARGBGLXVisuals" "true"
|
2007-10-03 14:48:41 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
export extensions='
|
2008-01-04 10:28:12 +00:00
|
|
|
Option "Composite" "Enable"
|
2007-10-03 14:48:41 +00:00
|
|
|
'
|
2007-05-28 14:09:04 +00:00
|
|
|
fi
|
2008-07-23 14:13:27 +00:00
|
|
|
|
2008-01-04 10:28:12 +00:00
|
|
|
if [ "${toString videoDriver}" = i810 ]; then
|
|
|
|
export extensions='
|
|
|
|
Option "Composite" "Enable"
|
|
|
|
';
|
|
|
|
fi;
|
2007-05-28 14:09:04 +00:00
|
|
|
|
2008-04-11 09:20:39 +00:00
|
|
|
if [ "${toString videoDriver}" = ati ]; then
|
|
|
|
export extensions='
|
|
|
|
Option "Composite" "Enable"
|
|
|
|
';
|
|
|
|
fi;
|
|
|
|
|
2008-06-28 07:46:50 +00:00
|
|
|
if [ "${toString videoDriver}" = radeonhd ]; then
|
|
|
|
export extensions='
|
|
|
|
Option "Composite" "Enable"
|
|
|
|
';
|
|
|
|
fi;
|
|
|
|
|
2007-02-25 15:53:57 +00:00
|
|
|
substituteAll $src $out
|
2008-01-04 10:36:14 +00:00
|
|
|
''; # */
|
2006-11-28 22:27:56 +00:00
|
|
|
};
|
|
|
|
|
2007-02-26 23:11:32 +00:00
|
|
|
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
mkIf cfg.enable {
|
2009-05-15 07:51:51 +00:00
|
|
|
|
|
|
|
assertions = [ { assertion = config.services.hal.enable == true; message = "The X server needs HAL running. Set services.hal.enable to true"; } ];
|
|
|
|
|
2009-01-02 16:07:21 +00:00
|
|
|
require = [
|
|
|
|
options
|
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
# services.xserver.*Manager
|
2009-05-25 09:02:29 +00:00
|
|
|
./display-managers/default.nix
|
|
|
|
./window-managers/default.nix
|
|
|
|
./desktop-managers/default.nix
|
2009-01-25 15:49:08 +00:00
|
|
|
|
2009-01-02 16:07:21 +00:00
|
|
|
# services.extraJobs
|
2009-05-24 23:13:23 +00:00
|
|
|
# ../../upstart-jobs/default.nix
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
|
|
# environment.etc
|
2009-05-24 23:13:23 +00:00
|
|
|
# ../../etc/default.nix
|
2009-01-02 16:07:21 +00:00
|
|
|
|
2009-01-02 16:07:39 +00:00
|
|
|
# fonts.fonts
|
2009-05-24 23:13:23 +00:00
|
|
|
# ../../system/fonts.nix
|
2009-01-02 16:07:39 +00:00
|
|
|
|
2009-01-02 16:07:21 +00:00
|
|
|
# boot.extraModulePackages
|
|
|
|
# security.extraSetuidPrograms
|
|
|
|
# environment.extraPackages
|
|
|
|
];
|
|
|
|
|
|
|
|
boot = {
|
|
|
|
extraModulePackages = mkIf (cfg.videoDriver == "nvidia") [
|
2009-04-08 14:01:16 +00:00
|
|
|
kernelPackages.nvidia_x11
|
2009-01-02 16:07:21 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
environment = {
|
2009-01-25 15:49:08 +00:00
|
|
|
etc = mkIf cfg.exportConfiguration [
|
|
|
|
{ source = "${configFile}";
|
|
|
|
target = "X11/xorg.conf";
|
2009-01-02 16:07:21 +00:00
|
|
|
}
|
2009-05-27 20:27:59 +00:00
|
|
|
# -xkbdir command line option does not seems to be passed to xkbcomp.
|
|
|
|
{ source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
|
|
|
|
target = "X11/xkb";
|
|
|
|
}
|
2009-01-25 15:49:08 +00:00
|
|
|
];
|
2009-01-02 16:07:21 +00:00
|
|
|
|
2009-06-25 22:08:03 +00:00
|
|
|
x11Packages = [
|
2009-01-25 15:49:08 +00:00
|
|
|
xorg.xrandr
|
|
|
|
xorg.xrdb
|
|
|
|
xorg.setxkbmap
|
|
|
|
xorg.iceauth # required for KDE applications (it's called by dcopserver)
|
|
|
|
]
|
2009-06-26 12:14:02 +00:00
|
|
|
++ optional (videoDriver == "nvidia") kernelPackages.nvidia_x11;
|
2009-06-25 22:08:03 +00:00
|
|
|
|
|
|
|
extraPackages = config.environment.x11Packages;
|
2009-01-02 16:07:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
2009-01-25 15:49:08 +00:00
|
|
|
xserver = {
|
|
|
|
displayManager = {
|
|
|
|
xserverArgs = [
|
|
|
|
"-ac"
|
|
|
|
"-logverbose"
|
|
|
|
"-verbose"
|
|
|
|
"-terminate"
|
|
|
|
"-logfile" "/var/log/X.${toString cfg.display}.log"
|
|
|
|
"-config ${configFile}"
|
|
|
|
":${toString cfg.display}" "vt${toString cfg.tty}"
|
|
|
|
"-xkbdir" "${pkgs.xkeyboard_config}/etc/X11/xkb"
|
|
|
|
] ++ optional (!cfg.tcpEnable) "-nolisten tcp";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2009-08-11 21:16:59 +00:00
|
|
|
hal.packages = halConfigFiles;
|
2009-06-25 23:29:49 +00:00
|
|
|
|
2009-01-02 16:07:21 +00:00
|
|
|
extraJobs = [{
|
2009-01-25 15:49:08 +00:00
|
|
|
name = "xserver";
|
|
|
|
job = ''
|
2009-05-15 07:51:51 +00:00
|
|
|
start on ${if cfg.autorun then "hal" else "never"}
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
|
|
start script
|
2009-06-03 08:14:54 +00:00
|
|
|
|
|
|
|
# Ugly hack: wait until udev has started since the X server
|
|
|
|
# needs various devices. This would more properly be
|
|
|
|
# expressed as an Upstart dependency, but AFAIK in "start
|
|
|
|
# on" we can't express a logical AND.
|
|
|
|
while ! initctl status udev 2>&1 | grep -q running; do
|
|
|
|
sleep 1
|
|
|
|
done
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
|
|
rm -f /var/run/opengl-driver
|
|
|
|
${if videoDriver == "nvidia"
|
|
|
|
then ''
|
2009-04-08 14:01:16 +00:00
|
|
|
ln -sf ${kernelPackages.nvidia_x11} /var/run/opengl-driver
|
2009-01-25 15:49:08 +00:00
|
|
|
''
|
|
|
|
else if cfg.driSupport
|
|
|
|
then "ln -sf ${pkgs.mesa} /var/run/opengl-driver"
|
|
|
|
else ""
|
|
|
|
}
|
|
|
|
|
|
|
|
${cfg.displayManager.job.beforeScript}
|
2009-04-08 13:41:33 +00:00
|
|
|
|
|
|
|
rm -f /tmp/.X0-lock
|
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
end script
|
|
|
|
|
|
|
|
${cfg.displayManager.job.env}
|
|
|
|
env FONTCONFIG_FILE=/etc/fonts/fonts.conf # !!! cleanup
|
|
|
|
env XKB_BINDIR=${xorg.xkbcomp}/bin # Needed for the Xkb extension.
|
|
|
|
|
|
|
|
${if videoDriver == "nvidia"
|
2009-04-08 14:01:16 +00:00
|
|
|
then "env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11}/lib"
|
2009-01-25 15:49:08 +00:00
|
|
|
else ""
|
|
|
|
}
|
|
|
|
|
|
|
|
${if videoDriver != "nvidia"
|
2009-04-28 13:51:58 +00:00
|
|
|
then "env XORG_DRI_DRIVER_PATH=${pkgs.mesa}/lib/dri"
|
2009-01-25 15:49:08 +00:00
|
|
|
else ""
|
|
|
|
}
|
|
|
|
|
|
|
|
exec ${cfg.displayManager.job.execCmd}
|
|
|
|
'';
|
2009-01-02 16:07:21 +00:00
|
|
|
}];
|
|
|
|
};
|
2006-11-28 22:27:56 +00:00
|
|
|
}
|