* Specify the resolution and the video driver name in the configuration file.

svn path=/nixos/trunk/; revision=8061
This commit is contained in:
Eelco Dolstra 2007-02-26 23:11:32 +00:00
parent 4164a4ff3e
commit fdb5a06fa4
4 changed files with 51 additions and 17 deletions

View File

@ -452,6 +452,25 @@
}
{
name = ["services" "xserver" "resolutions"];
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.
";
}
{
name = ["services" "xserver" "videoDriver"];
default = "vesa";
example = "i810";
description = "
The name of the video driver for your graphics card.
";
}
{
name = ["services" "httpd" "enable"];
default = false;
@ -461,6 +480,7 @@
}
/*
{
name = ["services" "httpd" "user"];
default = "wwwrun";
@ -617,6 +637,7 @@
Extra subservices to enable in the webserver.
";
}
*/
{
name = ["installer" "nixpkgsURL"];

View File

@ -118,6 +118,7 @@ import ../upstart-jobs/gather.nix {
# X server.
++ optional ["services" "xserver" "enable"]
(import ../upstart-jobs/xserver.nix {
inherit config;
inherit (pkgs) stdenv writeText lib xterm slim xorg;
fontDirectories = import ./fonts.nix {inherit pkgs;};
})

View File

@ -9,7 +9,6 @@ EndSection
Section "ServerFlags"
Option "AllowMouseOpenFail" "on"
Option "DontVTSwitch" "off"
EndSection
@ -37,12 +36,8 @@ EndSection
Section "Monitor"
Identifier "Monitor[0]"
Option "DPMS"
UseModes "Modes[0]"
EndSection
Section "Modes"
Identifier "Modes[0]"
HorizSync 28-49
VertRefresh 43-75
EndSection
@ -53,14 +48,14 @@ Section "Screen"
DefaultDepth 16
SubSection "Display"
Depth 16
Modes "1024x768"
Modes @resolutions@
EndSubSection
EndSection
Section "Device"
Identifier "Device[0]"
Driver "vesa"
Driver "@videoDriver@"
EndSection
@ -70,4 +65,3 @@ Section "ServerLayout"
InputDevice "Mouse[0]" "CorePointer"
Screen "Screen[0]"
EndSection

View File

@ -1,5 +1,7 @@
{ stdenv, writeText, lib, xorg, xterm, slim
, config
, # Virtual console for the X server.
tty ? 7
@ -13,17 +15,29 @@
let
drivers = [
getCfg = option: config.get ["services" "xserver" option];
optional = condition: x: if condition then [x] else [];
videoDriver = getCfg "videoDriver";
resolutions = map (res: "\"${toString res.x}x${toString res.y}\"") (getCfg "resolutions");
modules = [
xorg.xorgserver
xorg.xf86inputkeyboard
xorg.xf86inputmouse
xorg.xf86videovesa
];
]
++ optional (videoDriver == "vesa") xorg.xf86videovesa
++ optional (videoDriver == "i810") xorg.xf86videoi810;
config = stdenv.mkDerivation {
configFile = stdenv.mkDerivation {
name = "xserver.conf";
src = ./xserver.conf;
inherit fontDirectories;
inherit fontDirectories videoDriver resolutions;
buildCommand = "
buildCommand= # urgh, don't substitute this
@ -37,7 +51,7 @@ let
done
export modulePaths=
for i in $(find ${toString drivers} -type d); do
for i in $(find ${toString modules} -type d); do
if ls $i/*.so 2> /dev/null; then
modulePaths=\"\${modulePaths}ModulePath \\\"$i\\\"\\n\"
fi
@ -47,17 +61,19 @@ let
";
};
clientScript = writeText "xclient" "
${xorg.twm}/bin/twm &
${xterm}/bin/xterm -ls
";
xserverArgs = [
"-ac"
"-nolisten tcp"
"-terminate"
"-logfile" "/var/log/X.${toString display}.log"
"-config ${config}"
"-config ${configFile}"
":${toString display}" "vt${toString tty}"
];
@ -69,8 +85,10 @@ xserver_arguments ${toString xserverArgs}
login_cmd exec ${stdenv.bash}/bin/sh ${clientScript}
";
in
rec {
name = "xserver";