2010-05-31 02:00:52 +04:00
|
|
|
|
{ config, pkgs, pkgs_i686, ... }:
|
2006-11-29 01:27:56 +03:00
|
|
|
|
|
2009-05-24 22:28:30 +04:00
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
2009-01-02 19:07:21 +03:00
|
|
|
|
let
|
2006-11-29 01:27:56 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
kernelPackages = config.boot.kernelPackages;
|
2006-11-29 01:27:56 +03:00
|
|
|
|
|
2008-01-04 13:54:33 +03:00
|
|
|
|
# Abbreviations.
|
|
|
|
|
cfg = config.services.xserver;
|
2009-09-10 16:37:33 +04:00
|
|
|
|
xorg = pkgs.xorg;
|
|
|
|
|
|
2008-01-04 13:54:33 +03:00
|
|
|
|
|
2009-11-06 03:59:03 +03:00
|
|
|
|
# Map video driver names to driver packages.
|
2008-10-10 20:45:56 +04:00
|
|
|
|
knownVideoDrivers = {
|
2010-05-18 23:36:11 +04:00
|
|
|
|
ati_unfree = { modules = [ kernelPackages.ati_drivers_x11 ]; driverName = "fglrx"; };
|
2012-03-20 20:29:22 +04:00
|
|
|
|
nouveau = { modules = [ pkgs.xf86_video_nouveau ]; };
|
2009-11-06 03:59:03 +03:00
|
|
|
|
nvidia = { modules = [ kernelPackages.nvidia_x11 ]; };
|
2010-08-25 02:00:18 +04:00
|
|
|
|
nvidiaLegacy96 = { modules = [ kernelPackages.nvidia_x11_legacy96 ]; driverName = "nvidia"; };
|
|
|
|
|
nvidiaLegacy173 = { modules = [ kernelPackages.nvidia_x11_legacy173 ]; driverName = "nvidia"; };
|
2012-12-13 14:36:18 +04:00
|
|
|
|
nvidiaLegacy304 = { modules = [ kernelPackages.nvidia_x11_legacy304 ]; driverName = "nvidia"; };
|
2009-11-06 03:59:03 +03:00
|
|
|
|
unichrome = { modules = [ pkgs.xorgVideoUnichrome ]; };
|
2009-11-06 12:22:00 +03:00
|
|
|
|
virtualbox = { modules = [ kernelPackages.virtualboxGuestAdditions ]; driverName = "vboxvideo"; };
|
2008-10-10 20:45:56 +04:00
|
|
|
|
};
|
|
|
|
|
|
2009-11-06 03:59:03 +03:00
|
|
|
|
driverNames =
|
|
|
|
|
optional (cfg.videoDriver != null) cfg.videoDriver ++ cfg.videoDrivers;
|
2007-03-06 03:07:00 +03:00
|
|
|
|
|
2009-11-06 03:59:03 +03:00
|
|
|
|
drivers = flip map driverNames
|
2009-11-06 12:22:00 +03:00
|
|
|
|
(name: { inherit name; driverName = name; } //
|
2012-03-20 03:57:26 +04:00
|
|
|
|
attrByPath [name] (if (hasAttr ("xf86video" + name) xorg) then { modules = [(getAttr ("xf86video" + name) xorg) ]; } else throw "unknown video driver `${name}'") knownVideoDrivers);
|
2008-01-04 13:54:33 +03:00
|
|
|
|
|
2008-08-27 14:00:49 +04:00
|
|
|
|
fontsForXServer =
|
2009-09-10 16:37:33 +04:00
|
|
|
|
config.fonts.fonts ++
|
2008-08-27 14:00:49 +04:00
|
|
|
|
# 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-26 03:29:49 +04:00
|
|
|
|
|
2013-01-24 16:06:32 +04:00
|
|
|
|
|
2013-01-10 03:31:08 +04:00
|
|
|
|
# Just enumerate all heads without discarding XRandR output information.
|
|
|
|
|
xrandrHeads = let
|
|
|
|
|
mkHead = num: output: {
|
|
|
|
|
name = "multihead${toString num}";
|
|
|
|
|
inherit output;
|
|
|
|
|
};
|
|
|
|
|
in imap mkHead cfg.xrandrHeads;
|
|
|
|
|
|
|
|
|
|
xrandrDeviceSection = flip concatMapStrings xrandrHeads (h: ''
|
|
|
|
|
Option "monitor-${h.output}" "${h.name}"
|
|
|
|
|
'');
|
|
|
|
|
|
|
|
|
|
# Here we chain every monitor from the left to right, so we have:
|
|
|
|
|
# m4 right of m3 right of m2 right of m1 .----.----.----.----.
|
|
|
|
|
# Which will end up in reverse ----------> | m1 | m2 | m3 | m4 |
|
|
|
|
|
# `----^----^----^----'
|
|
|
|
|
xrandrMonitorSections = let
|
|
|
|
|
mkMonitor = previous: current: previous ++ singleton {
|
|
|
|
|
inherit (current) name;
|
|
|
|
|
value = ''
|
|
|
|
|
Section "Monitor"
|
|
|
|
|
Identifier "${current.name}"
|
|
|
|
|
${optionalString (previous != []) ''
|
|
|
|
|
Option "RightOf" "${(head previous).name}"
|
|
|
|
|
''}
|
|
|
|
|
EndSection
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
monitors = foldl mkMonitor [] xrandrHeads;
|
|
|
|
|
in concatMapStrings (getAttr "value") monitors;
|
2009-06-26 03:29:49 +04:00
|
|
|
|
|
2013-01-24 16:06:32 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
configFile = pkgs.stdenv.mkDerivation {
|
2006-11-29 01:27:56 +03:00
|
|
|
|
name = "xserver.conf";
|
2009-09-10 16:37:33 +04:00
|
|
|
|
|
|
|
|
|
xfs = optionalString (cfg.useXFS != false)
|
2008-01-04 13:28:12 +03:00
|
|
|
|
''FontPath "${toString cfg.useXFS}"'';
|
2007-12-25 15:16:38 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
inherit (cfg) config;
|
|
|
|
|
|
|
|
|
|
buildCommand =
|
|
|
|
|
''
|
|
|
|
|
echo 'Section "Files"' >> $out
|
|
|
|
|
echo $xfs >> $out
|
|
|
|
|
|
|
|
|
|
for i in ${toString fontsForXServer}; do
|
|
|
|
|
if test "''${i:0:''${#NIX_STORE}}" == "$NIX_STORE"; then
|
|
|
|
|
for j in $(find $i -name fonts.dir); do
|
|
|
|
|
echo " FontPath \"$(dirname $j)\"" >> $out
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
done
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
for i in $(find ${toString cfg.modules} -type d); do
|
|
|
|
|
if test $(echo $i/*.so* | wc -w) -ne 0; then
|
|
|
|
|
echo " ModulePath \"$i\"" >> $out
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
echo 'EndSection' >> $out
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
echo "$config" >> $out
|
|
|
|
|
''; # */
|
2006-11-29 01:27:56 +03:00
|
|
|
|
};
|
|
|
|
|
|
2013-01-24 16:06:32 +04:00
|
|
|
|
|
|
|
|
|
checkAgent = mkAssert (!(cfg.startOpenSSHAgent && cfg.startGnuPGAgent))
|
|
|
|
|
''
|
|
|
|
|
The OpenSSH agent and GnuPG agent cannot be started both.
|
|
|
|
|
Choose between `startOpenSSHAgent' and `startGnuPGAgent'.
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
checkPolkit = mkAssert config.security.polkit.enable
|
|
|
|
|
"X11 requires Polkit to be enabled (‘security.polkit.enable = true’).";
|
|
|
|
|
|
|
|
|
|
|
2009-01-02 19:07:21 +03:00
|
|
|
|
in
|
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
{
|
2009-05-15 11:51:51 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
imports =
|
|
|
|
|
[ ./display-managers/default.nix
|
|
|
|
|
./window-managers/default.nix
|
|
|
|
|
./desktop-managers/default.nix
|
|
|
|
|
];
|
2009-05-15 11:51:51 +04:00
|
|
|
|
|
2009-01-02 19:07:21 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
###### interface
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
options = {
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
services.xserver = {
|
|
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to enable the X server.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-25 18:49:08 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
autorun = mkOption {
|
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to start the X server automatically.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 19:07:21 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
exportConfiguration = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to symlink the X server configuration under
|
|
|
|
|
<filename>/etc/X11/xorg.conf</filename>.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 19:07:21 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
enableTCP = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to allow the X server to accept TCP connections.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 19:07:39 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
modules = mkOption {
|
|
|
|
|
default = [];
|
2010-04-15 19:46:38 +04:00
|
|
|
|
example = [ pkgs.xf86_input_wacom ];
|
2009-09-10 16:37:33 +04:00
|
|
|
|
description = "Packages to be added to the module search path of the X server.";
|
|
|
|
|
};
|
2009-01-02 19:07:21 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
resolutions = mkOption {
|
2009-11-06 03:59:03 +03:00
|
|
|
|
default = [];
|
2010-08-10 00:10:16 +04:00
|
|
|
|
example = [ { x = 1600; y = 1200; } { x = 1024; y = 786; } ];
|
2009-09-10 16:37:33 +04:00
|
|
|
|
description = ''
|
2009-11-06 03:59:03 +03:00
|
|
|
|
The screen resolutions for the X server. The first element
|
|
|
|
|
is the default resolution. If this list is empty, the X
|
|
|
|
|
server will automatically configure the resolution.
|
2009-09-10 16:37:33 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 19:07:21 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
videoDriver = mkOption {
|
2009-11-06 03:59:03 +03:00
|
|
|
|
default = null;
|
2009-09-10 16:37:33 +04:00
|
|
|
|
example = "i810";
|
|
|
|
|
description = ''
|
2009-11-06 03:59:03 +03:00
|
|
|
|
The name of the video driver for your graphics card. This
|
|
|
|
|
option is obsolete; please set the
|
|
|
|
|
<option>videoDrivers</option> instead.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
videoDrivers = mkOption {
|
2013-03-01 21:05:00 +04:00
|
|
|
|
# !!! We'd like "nv" here, but it segfaults the X server.
|
2013-03-01 05:53:08 +04:00
|
|
|
|
default = [ "ati" "cirrus" "intel" "vesa" "vmware" ];
|
2009-11-06 03:59:03 +03:00
|
|
|
|
example = [ "vesa" ];
|
|
|
|
|
description = ''
|
|
|
|
|
The names of the video drivers that the X server should
|
|
|
|
|
support. The X server will try all of the drivers listed
|
|
|
|
|
here until it finds one that supports your video card.
|
2009-09-10 16:37:33 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 19:07:21 +03:00
|
|
|
|
|
2013-01-30 23:22:40 +04:00
|
|
|
|
vaapiDrivers = mkOption {
|
2013-02-04 18:48:28 +04:00
|
|
|
|
default = [ ];
|
2013-01-30 23:22:40 +04:00
|
|
|
|
defaultText = "[ pkgs.vaapiIntel pkgs.vaapiVdpau ]";
|
|
|
|
|
example = "[ pkgs.vaapiIntel pkgs.vaapiVdpau ]";
|
|
|
|
|
description = ''
|
2013-02-04 18:48:28 +04:00
|
|
|
|
Packages providing libva acceleration drivers.
|
2013-01-30 23:22:40 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
driSupport = mkOption {
|
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to enable accelerated OpenGL rendering through the
|
|
|
|
|
Direct Rendering Interface (DRI).
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-06-26 02:08:03 +04:00
|
|
|
|
|
2010-05-31 02:00:52 +04:00
|
|
|
|
driSupport32Bit = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
On 64-bit systems, whether to support Direct Rendering for
|
|
|
|
|
32-bit applications (such as Wine). This is currently only
|
2013-02-19 21:28:25 +04:00
|
|
|
|
supported for the <literal>nvidia</literal> driver and for
|
|
|
|
|
<literal>mesa</literal>.
|
2010-05-31 02:00:52 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2009-11-22 03:40:53 +03:00
|
|
|
|
startOpenSSHAgent = mkOption {
|
2009-09-10 16:37:33 +04:00
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
2009-11-22 03:40:53 +03:00
|
|
|
|
Whether to start the OpenSSH agent when you log in. The OpenSSH agent
|
2009-09-10 16:37:33 +04:00
|
|
|
|
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.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 19:07:21 +03:00
|
|
|
|
|
2009-11-22 01:14:01 +03:00
|
|
|
|
startGnuPGAgent = mkOption {
|
2009-11-22 17:34:53 +03:00
|
|
|
|
default = false;
|
2009-11-22 01:14:01 +03:00
|
|
|
|
description = ''
|
|
|
|
|
Whether to start the GnuPG agent when you log in. The GnuPG agent
|
|
|
|
|
remembers private keys for you so that you don't have to type in
|
|
|
|
|
passphrases every time you make an SSH connection or sign/encrypt
|
|
|
|
|
data. Use <command>ssh-add</command> to add a key to the agent.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
layout = mkOption {
|
|
|
|
|
default = "us";
|
|
|
|
|
description = ''
|
|
|
|
|
Keyboard layout.
|
|
|
|
|
'';
|
2009-01-25 18:49:08 +03:00
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
xkbModel = mkOption {
|
|
|
|
|
default = "pc104";
|
|
|
|
|
example = "presario";
|
|
|
|
|
description = ''
|
|
|
|
|
Keyboard model.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-06-26 03:29:49 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
xkbOptions = mkOption {
|
2010-08-10 16:37:39 +04:00
|
|
|
|
default = "terminate:ctrl_alt_bksp";
|
2009-09-10 16:37:33 +04:00
|
|
|
|
example = "grp:caps_toggle, grp_led:scroll";
|
|
|
|
|
description = ''
|
|
|
|
|
X keyboard options; layout switching goes here.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-25 18:49:08 +03:00
|
|
|
|
|
2011-12-31 03:26:11 +04:00
|
|
|
|
xkbVariant = mkOption {
|
|
|
|
|
default = "";
|
|
|
|
|
example = "colemak";
|
|
|
|
|
description = ''
|
|
|
|
|
X keyboard variant.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
config = mkOption {
|
|
|
|
|
description = ''
|
|
|
|
|
The contents of the configuration file of the X server
|
|
|
|
|
(<filename>xorg.conf</filename>).
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-06-03 12:14:54 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
deviceSection = mkOption {
|
|
|
|
|
default = "";
|
|
|
|
|
example = "VideoRAM 131072";
|
|
|
|
|
description = "Contents of the first Device section of the X server configuration file.";
|
|
|
|
|
};
|
2009-01-25 18:49:08 +03:00
|
|
|
|
|
2010-05-08 21:18:22 +04:00
|
|
|
|
screenSection = mkOption {
|
|
|
|
|
default = "";
|
|
|
|
|
example = ''
|
|
|
|
|
Option "RandRRotation" "on"
|
|
|
|
|
'';
|
|
|
|
|
description = "Contents of the first Screen section of the X server configuration file.";
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
monitorSection = mkOption {
|
|
|
|
|
default = "";
|
|
|
|
|
example = "HorizSync 28-49";
|
|
|
|
|
description = "Contents of the first Monitor section of the X server configuration file.";
|
|
|
|
|
};
|
2009-04-08 17:41:33 +04:00
|
|
|
|
|
2013-01-10 03:31:08 +04:00
|
|
|
|
xrandrHeads = mkOption {
|
|
|
|
|
default = [];
|
|
|
|
|
example = [ "HDMI-0" "DVI-0" ];
|
|
|
|
|
type = with types; listOf string;
|
|
|
|
|
description = ''
|
|
|
|
|
Simple multiple monitor configuration, just specify a list of XRandR
|
|
|
|
|
outputs which will be mapped from left to right in the order of the
|
|
|
|
|
list.
|
|
|
|
|
|
|
|
|
|
Be careful using this option with multiple graphic adapters or with
|
|
|
|
|
drivers that have poor support for XRandR, unexpected things might
|
|
|
|
|
happen with those.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
moduleSection = mkOption {
|
|
|
|
|
default = "";
|
|
|
|
|
example =
|
|
|
|
|
''
|
|
|
|
|
SubSection "extmod"
|
|
|
|
|
EndSubsection
|
|
|
|
|
'';
|
|
|
|
|
description = "Contents of the Module section of the X server configuration file.";
|
|
|
|
|
};
|
2009-04-08 17:41:33 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
serverLayoutSection = mkOption {
|
|
|
|
|
default = "";
|
|
|
|
|
example =
|
|
|
|
|
''
|
|
|
|
|
Option "AIGLX" "true"
|
|
|
|
|
'';
|
|
|
|
|
description = "Contents of the ServerLayout section of the X server configuration file.";
|
|
|
|
|
};
|
2009-01-25 18:49:08 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
extraDisplaySettings = mkOption {
|
|
|
|
|
default = "";
|
|
|
|
|
example = "Virtual 2048 2048";
|
|
|
|
|
description = "Lines to be added to every Display subsection of the Screen section.";
|
|
|
|
|
};
|
2009-01-25 18:49:08 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
defaultDepth = mkOption {
|
2009-11-06 03:59:03 +03:00
|
|
|
|
default = 0;
|
2009-09-10 16:37:33 +04:00
|
|
|
|
example = 8;
|
|
|
|
|
description = "Default colour depth.";
|
|
|
|
|
};
|
2009-01-25 18:49:08 +03:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
useXFS = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
example = "unix/:7100";
|
|
|
|
|
description = "Determines how to connect to the X Font Server.";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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.";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
virtualScreen = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
example = { x = 2048; y = 2048; };
|
|
|
|
|
description = ''
|
|
|
|
|
Virtual screen size for Xrandr.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
environment.x11Packages = mkOption {
|
|
|
|
|
default = [];
|
2013-03-14 20:09:21 +04:00
|
|
|
|
type = types.listOf types.package;
|
2009-09-10 16:37:33 +04:00
|
|
|
|
description = ''
|
|
|
|
|
List of packages added to the system when the X server is
|
|
|
|
|
activated (<option>services.xserver.enable</option>).
|
|
|
|
|
'';
|
|
|
|
|
};
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2013-05-16 19:23:31 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
###### implementation
|
2009-11-22 01:14:01 +03:00
|
|
|
|
|
2013-01-24 16:06:32 +04:00
|
|
|
|
config = mkIf cfg.enable (checkAgent (checkPolkit {
|
2009-09-10 16:37:33 +04:00
|
|
|
|
|
|
|
|
|
boot.extraModulePackages =
|
2011-09-14 22:20:50 +04:00
|
|
|
|
optional (elem "nvidia" driverNames) kernelPackages.nvidia_x11 ++
|
2010-08-25 02:00:18 +04:00
|
|
|
|
optional (elem "nvidiaLegacy96" driverNames) kernelPackages.nvidia_x11_legacy96 ++
|
|
|
|
|
optional (elem "nvidiaLegacy173" driverNames) kernelPackages.nvidia_x11_legacy173 ++
|
2012-12-13 14:36:18 +04:00
|
|
|
|
optional (elem "nvidiaLegacy304" driverNames) kernelPackages.nvidia_x11_legacy304 ++
|
2010-05-18 23:36:11 +04:00
|
|
|
|
optional (elem "virtualbox" driverNames) kernelPackages.virtualboxGuestAdditions ++
|
|
|
|
|
optional (elem "ati_unfree" driverNames) kernelPackages.ati_drivers_x11;
|
2009-09-10 16:37:33 +04:00
|
|
|
|
|
2012-10-07 19:24:42 +04:00
|
|
|
|
environment.etc =
|
|
|
|
|
(optionals cfg.exportConfiguration
|
2009-09-10 16:37:33 +04:00
|
|
|
|
[ { source = "${configFile}";
|
|
|
|
|
target = "X11/xorg.conf";
|
|
|
|
|
}
|
|
|
|
|
# -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 18:49:08 +03:00
|
|
|
|
}
|
2012-10-07 19:24:42 +04:00
|
|
|
|
])
|
|
|
|
|
++ (optionals (elem "ati_unfree" driverNames) [
|
|
|
|
|
|
|
|
|
|
# according toiive on #ati you don't need the pcs, it is like registry... keeps old stuff to make your
|
|
|
|
|
# life harder ;) Still it seems to be required
|
|
|
|
|
{ source = "${kernelPackages.ati_drivers_x11}/etc/ati";
|
|
|
|
|
target = "ati";
|
|
|
|
|
}
|
|
|
|
|
]);
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
environment.x11Packages =
|
|
|
|
|
[ xorg.xorgserver
|
|
|
|
|
xorg.xrandr
|
|
|
|
|
xorg.xrdb
|
|
|
|
|
xorg.setxkbmap
|
|
|
|
|
xorg.iceauth # required for KDE applications (it's called by dcopserver)
|
2010-02-10 16:22:38 +03:00
|
|
|
|
xorg.xlsclients
|
|
|
|
|
xorg.xset
|
2009-09-10 16:37:33 +04:00
|
|
|
|
xorg.xsetroot
|
2013-04-27 05:30:40 +04:00
|
|
|
|
xorg.xinput
|
2009-09-13 17:26:35 +04:00
|
|
|
|
xorg.xprop
|
2010-02-10 16:22:38 +03:00
|
|
|
|
pkgs.xterm
|
2012-05-15 06:49:47 +04:00
|
|
|
|
pkgs.xdg_utils
|
2009-09-10 16:37:33 +04:00
|
|
|
|
]
|
2009-11-06 03:59:03 +03:00
|
|
|
|
++ optional (elem "nvidia" driverNames) kernelPackages.nvidia_x11
|
2010-08-25 02:00:18 +04:00
|
|
|
|
++ optional (elem "nvidiaLegacy96" driverNames) kernelPackages.nvidia_x11_legacy96
|
|
|
|
|
++ optional (elem "nvidiaLegacy173" driverNames) kernelPackages.nvidia_x11_legacy173
|
2012-12-13 14:36:18 +04:00
|
|
|
|
++ optional (elem "nvidiaLegacy304" driverNames) kernelPackages.nvidia_x11_legacy304
|
2010-05-18 23:36:11 +04:00
|
|
|
|
++ optional (elem "virtualbox" driverNames) xorg.xrefresh
|
|
|
|
|
++ optional (elem "ati_unfree" driverNames) kernelPackages.ati_drivers_x11;
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
environment.systemPackages = config.environment.x11Packages;
|
2010-08-09 22:04:55 +04:00
|
|
|
|
|
|
|
|
|
environment.pathsToLink =
|
|
|
|
|
[ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ];
|
2011-03-30 21:52:34 +04:00
|
|
|
|
|
2013-01-16 15:33:18 +04:00
|
|
|
|
systemd.defaultUnit = mkIf cfg.autorun "graphical.target";
|
2012-06-19 22:51:04 +04:00
|
|
|
|
|
2013-01-16 15:33:18 +04:00
|
|
|
|
systemd.services."display-manager" =
|
2013-01-10 16:59:41 +04:00
|
|
|
|
{ description = "X11 Server";
|
|
|
|
|
|
|
|
|
|
after = [ "systemd-udev-settle.service" "local-fs.target" ];
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2012-08-17 21:14:42 +04:00
|
|
|
|
restartIfChanged = false;
|
2012-03-18 06:10:39 +04:00
|
|
|
|
|
|
|
|
|
environment =
|
2009-09-10 16:37:33 +04:00
|
|
|
|
{ FONTCONFIG_FILE = "/etc/fonts/fonts.conf"; # !!! cleanup
|
|
|
|
|
XKB_BINDIR = "${xorg.xkbcomp}/bin"; # Needed for the Xkb extension.
|
2013-05-16 19:23:31 +04:00
|
|
|
|
XORG_DRI_DRIVER_PATH = "/run/opengl-driver/lib/dri"; # !!! Depends on the driver selected at runtime.
|
2009-11-06 03:59:03 +03:00
|
|
|
|
} // optionalAttrs (elem "nvidia" driverNames) {
|
2009-09-10 16:37:33 +04:00
|
|
|
|
LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11}/lib";
|
2010-08-25 02:00:18 +04:00
|
|
|
|
} // optionalAttrs (elem "nvidiaLegacy96" driverNames) {
|
|
|
|
|
LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11_legacy96}/lib";
|
|
|
|
|
} // optionalAttrs (elem "nvidiaLegacy173" driverNames) {
|
|
|
|
|
LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11_legacy173}/lib";
|
2012-12-13 14:36:18 +04:00
|
|
|
|
} // optionalAttrs (elem "nvidiaLegacy304" driverNames) {
|
|
|
|
|
LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11_legacy304}/lib";
|
2010-05-18 23:36:11 +04:00
|
|
|
|
} // optionalAttrs (elem "ati_unfree" driverNames) {
|
|
|
|
|
LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.ati_drivers_x11}/lib:${kernelPackages.ati_drivers_x11}/X11R6/lib64/modules/linux";
|
2013-05-16 19:23:31 +04:00
|
|
|
|
#XORG_DRI_DRIVER_PATH = "${kernelPackages.ati_drivers_x11}/lib/dri"; # is ignored because ati drivers ship their own unpatched libglx.so !
|
2009-09-10 16:37:33 +04:00
|
|
|
|
} // cfg.displayManager.job.environment;
|
|
|
|
|
|
|
|
|
|
preStart =
|
|
|
|
|
''
|
2013-05-17 01:52:17 +04:00
|
|
|
|
rm -f /run/opengl-driver{,-32}
|
|
|
|
|
${optionalString (!cfg.driSupport32Bit) "ln -sf opengl-driver /run/opengl-driver-32"}
|
|
|
|
|
|
2009-11-06 03:59:03 +03:00
|
|
|
|
${# !!! The OpenGL driver depends on what's detected at runtime.
|
2010-05-31 02:00:52 +04:00
|
|
|
|
if elem "nvidia" driverNames then
|
|
|
|
|
''
|
2012-07-16 19:32:26 +04:00
|
|
|
|
ln -sf ${kernelPackages.nvidia_x11} /run/opengl-driver
|
2013-05-16 19:23:31 +04:00
|
|
|
|
${optionalString cfg.driSupport32Bit
|
2013-03-25 01:07:40 +04:00
|
|
|
|
"ln -sf ${pkgs_i686.linuxPackages.nvidia_x11.override { libsOnly = true; kernelDev = null; } } /run/opengl-driver-32"}
|
2010-05-31 02:00:52 +04:00
|
|
|
|
''
|
2010-08-25 02:00:18 +04:00
|
|
|
|
else if elem "nvidiaLegacy96" driverNames then
|
2012-07-16 19:32:26 +04:00
|
|
|
|
"ln -sf ${kernelPackages.nvidia_x11_legacy96} /run/opengl-driver"
|
2010-08-25 02:00:18 +04:00
|
|
|
|
else if elem "nvidiaLegacy173" driverNames then
|
2012-07-16 19:32:26 +04:00
|
|
|
|
"ln -sf ${kernelPackages.nvidia_x11_legacy173} /run/opengl-driver"
|
2012-12-13 14:36:18 +04:00
|
|
|
|
else if elem "nvidiaLegacy304" driverNames then
|
2013-01-17 01:49:21 +04:00
|
|
|
|
''
|
|
|
|
|
ln -sf ${kernelPackages.nvidia_x11_legacy304} /run/opengl-driver
|
2013-05-16 19:23:31 +04:00
|
|
|
|
${optionalString cfg.driSupport32Bit
|
2013-04-01 14:08:30 +04:00
|
|
|
|
"ln -sf ${pkgs_i686.linuxPackages.nvidia_x11_legacy304.override { libsOnly = true; kernelDev = null; } } /run/opengl-driver-32"}
|
2013-01-17 01:49:21 +04:00
|
|
|
|
''
|
2012-10-07 19:24:42 +04:00
|
|
|
|
else if elem "ati_unfree" driverNames then
|
|
|
|
|
"ln -sf ${kernelPackages.ati_drivers_x11} /run/opengl-driver"
|
2013-02-19 21:28:25 +04:00
|
|
|
|
else
|
|
|
|
|
''
|
2013-05-16 19:23:31 +04:00
|
|
|
|
${optionalString cfg.driSupport "ln -sf ${pkgs.mesa_drivers} /run/opengl-driver"}
|
|
|
|
|
${optionalString cfg.driSupport32Bit
|
|
|
|
|
"ln -sf ${pkgs_i686.mesa_drivers} /run/opengl-driver-32"}
|
2013-02-19 21:28:25 +04:00
|
|
|
|
''
|
2010-05-31 02:00:52 +04:00
|
|
|
|
}
|
2009-09-10 16:37:33 +04:00
|
|
|
|
|
2009-09-10 19:49:16 +04:00
|
|
|
|
${cfg.displayManager.job.preStart}
|
2009-09-10 16:37:33 +04:00
|
|
|
|
|
|
|
|
|
rm -f /tmp/.X0-lock
|
|
|
|
|
'';
|
|
|
|
|
|
2009-09-13 19:03:07 +04:00
|
|
|
|
script = "${cfg.displayManager.job.execCmd}";
|
2009-09-10 16:37:33 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.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.enableTCP) "-nolisten tcp";
|
|
|
|
|
|
2009-11-06 03:59:03 +03:00
|
|
|
|
services.xserver.modules =
|
|
|
|
|
concatLists (catAttrs "modules" drivers) ++
|
|
|
|
|
[ xorg.xorgserver
|
|
|
|
|
xorg.xf86inputevdev
|
|
|
|
|
];
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
services.xserver.config =
|
|
|
|
|
''
|
|
|
|
|
Section "ServerFlags"
|
|
|
|
|
Option "AllowMouseOpenFail" "on"
|
|
|
|
|
EndSection
|
|
|
|
|
|
|
|
|
|
Section "Module"
|
|
|
|
|
${cfg.moduleSection}
|
|
|
|
|
EndSection
|
|
|
|
|
|
|
|
|
|
Section "Monitor"
|
2009-11-06 03:59:03 +03:00
|
|
|
|
Identifier "Monitor[0]"
|
2009-09-10 16:37:33 +04:00
|
|
|
|
${cfg.monitorSection}
|
|
|
|
|
EndSection
|
|
|
|
|
|
2010-08-02 23:06:42 +04:00
|
|
|
|
Section "InputClass"
|
2010-08-10 18:13:57 +04:00
|
|
|
|
Identifier "Keyboard catchall"
|
2010-08-02 23:06:42 +04:00
|
|
|
|
MatchIsKeyboard "on"
|
|
|
|
|
Option "XkbRules" "base"
|
|
|
|
|
Option "XkbModel" "${cfg.xkbModel}"
|
|
|
|
|
Option "XkbLayout" "${cfg.layout}"
|
|
|
|
|
Option "XkbOptions" "${cfg.xkbOptions}"
|
2011-12-31 03:26:11 +04:00
|
|
|
|
Option "XkbVariant" "${cfg.xkbVariant}"
|
2010-08-02 23:06:42 +04:00
|
|
|
|
EndSection
|
|
|
|
|
|
2009-09-10 16:37:33 +04:00
|
|
|
|
Section "ServerLayout"
|
2009-11-06 03:59:03 +03:00
|
|
|
|
Identifier "Layout[all]"
|
2009-09-10 16:37:33 +04:00
|
|
|
|
${cfg.serverLayoutSection}
|
2009-11-06 03:59:03 +03:00
|
|
|
|
# Reference the Screen sections for each driver. This will
|
|
|
|
|
# cause the X server to try each in turn.
|
|
|
|
|
${flip concatMapStrings drivers (d: ''
|
|
|
|
|
Screen "Screen-${d.name}[0]"
|
|
|
|
|
'')}
|
2009-09-10 16:37:33 +04:00
|
|
|
|
EndSection
|
|
|
|
|
|
2009-11-06 03:59:03 +03:00
|
|
|
|
# For each supported driver, add a "Device" and "Screen"
|
|
|
|
|
# section.
|
|
|
|
|
${flip concatMapStrings drivers (driver: ''
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2009-11-06 03:59:03 +03:00
|
|
|
|
Section "Device"
|
|
|
|
|
Identifier "Device-${driver.name}[0]"
|
2009-11-06 12:22:00 +03:00
|
|
|
|
Driver "${driver.driverName}"
|
2009-11-06 03:59:03 +03:00
|
|
|
|
${cfg.deviceSection}
|
2013-01-10 03:31:08 +04:00
|
|
|
|
${xrandrDeviceSection}
|
2009-11-06 03:59:03 +03:00
|
|
|
|
EndSection
|
|
|
|
|
|
|
|
|
|
Section "Screen"
|
|
|
|
|
Identifier "Screen-${driver.name}[0]"
|
|
|
|
|
Device "Device-${driver.name}[0]"
|
2010-08-10 00:10:16 +04:00
|
|
|
|
${optionalString (cfg.monitorSection != "") ''
|
|
|
|
|
Monitor "Monitor[0]"
|
|
|
|
|
''}
|
2009-11-06 03:59:03 +03:00
|
|
|
|
|
2010-05-08 21:18:22 +04:00
|
|
|
|
${cfg.screenSection}
|
|
|
|
|
|
2009-11-06 03:59:03 +03:00
|
|
|
|
${optionalString (cfg.defaultDepth != 0) ''
|
|
|
|
|
DefaultDepth ${toString cfg.defaultDepth}
|
|
|
|
|
''}
|
|
|
|
|
|
|
|
|
|
${optionalString (driver.name == "nvidia") ''
|
|
|
|
|
Option "RandRRotation" "on"
|
|
|
|
|
''}
|
|
|
|
|
|
|
|
|
|
${optionalString
|
2010-08-10 00:10:16 +04:00
|
|
|
|
(driver.name != "virtualbox" &&
|
|
|
|
|
(cfg.resolutions != [] ||
|
|
|
|
|
cfg.extraDisplaySettings != "" ||
|
|
|
|
|
cfg.virtualScreen != null))
|
|
|
|
|
(let
|
2009-11-06 03:59:03 +03:00
|
|
|
|
f = depth:
|
|
|
|
|
''
|
|
|
|
|
SubSection "Display"
|
|
|
|
|
Depth ${toString depth}
|
|
|
|
|
${optionalString (cfg.resolutions != [])
|
|
|
|
|
"Modes ${concatMapStrings (res: ''"${toString res.x}x${toString res.y}"'') cfg.resolutions}"}
|
|
|
|
|
${cfg.extraDisplaySettings}
|
|
|
|
|
${optionalString (cfg.virtualScreen != null)
|
|
|
|
|
"Virtual ${toString cfg.virtualScreen.x} ${toString cfg.virtualScreen.y}"}
|
|
|
|
|
EndSubSection
|
|
|
|
|
'';
|
|
|
|
|
in concatMapStrings f [8 16 24]
|
|
|
|
|
)}
|
2011-09-14 22:20:50 +04:00
|
|
|
|
|
2009-11-06 03:59:03 +03:00
|
|
|
|
EndSection
|
|
|
|
|
'')}
|
2013-01-10 01:19:58 +04:00
|
|
|
|
|
2013-01-10 03:31:08 +04:00
|
|
|
|
${xrandrMonitorSections}
|
2009-09-10 16:37:33 +04:00
|
|
|
|
'';
|
|
|
|
|
|
2013-01-24 16:06:32 +04:00
|
|
|
|
}));
|
2009-09-10 16:37:33 +04:00
|
|
|
|
|
2006-11-29 01:27:56 +03:00
|
|
|
|
}
|
2013-05-16 19:23:31 +04:00
|
|
|
|
|