* Specify the resolution and the video driver name in the configuration file.
svn path=/nixos/trunk/; revision=8061
This commit is contained in:
parent
4164a4ff3e
commit
fdb5a06fa4
|
@ -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"];
|
name = ["services" "httpd" "enable"];
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -461,6 +480,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
name = ["services" "httpd" "user"];
|
name = ["services" "httpd" "user"];
|
||||||
default = "wwwrun";
|
default = "wwwrun";
|
||||||
|
@ -617,6 +637,7 @@
|
||||||
Extra subservices to enable in the webserver.
|
Extra subservices to enable in the webserver.
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
{
|
{
|
||||||
name = ["installer" "nixpkgsURL"];
|
name = ["installer" "nixpkgsURL"];
|
||||||
|
|
|
@ -118,6 +118,7 @@ import ../upstart-jobs/gather.nix {
|
||||||
# X server.
|
# X server.
|
||||||
++ optional ["services" "xserver" "enable"]
|
++ optional ["services" "xserver" "enable"]
|
||||||
(import ../upstart-jobs/xserver.nix {
|
(import ../upstart-jobs/xserver.nix {
|
||||||
|
inherit config;
|
||||||
inherit (pkgs) stdenv writeText lib xterm slim xorg;
|
inherit (pkgs) stdenv writeText lib xterm slim xorg;
|
||||||
fontDirectories = import ./fonts.nix {inherit pkgs;};
|
fontDirectories = import ./fonts.nix {inherit pkgs;};
|
||||||
})
|
})
|
||||||
|
|
|
@ -9,7 +9,6 @@ EndSection
|
||||||
|
|
||||||
Section "ServerFlags"
|
Section "ServerFlags"
|
||||||
Option "AllowMouseOpenFail" "on"
|
Option "AllowMouseOpenFail" "on"
|
||||||
Option "DontVTSwitch" "off"
|
|
||||||
EndSection
|
EndSection
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,12 +36,8 @@ EndSection
|
||||||
Section "Monitor"
|
Section "Monitor"
|
||||||
Identifier "Monitor[0]"
|
Identifier "Monitor[0]"
|
||||||
Option "DPMS"
|
Option "DPMS"
|
||||||
UseModes "Modes[0]"
|
HorizSync 28-49
|
||||||
EndSection
|
VertRefresh 43-75
|
||||||
|
|
||||||
|
|
||||||
Section "Modes"
|
|
||||||
Identifier "Modes[0]"
|
|
||||||
EndSection
|
EndSection
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,14 +48,14 @@ Section "Screen"
|
||||||
DefaultDepth 16
|
DefaultDepth 16
|
||||||
SubSection "Display"
|
SubSection "Display"
|
||||||
Depth 16
|
Depth 16
|
||||||
Modes "1024x768"
|
Modes @resolutions@
|
||||||
EndSubSection
|
EndSubSection
|
||||||
EndSection
|
EndSection
|
||||||
|
|
||||||
|
|
||||||
Section "Device"
|
Section "Device"
|
||||||
Identifier "Device[0]"
|
Identifier "Device[0]"
|
||||||
Driver "vesa"
|
Driver "@videoDriver@"
|
||||||
EndSection
|
EndSection
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,4 +65,3 @@ Section "ServerLayout"
|
||||||
InputDevice "Mouse[0]" "CorePointer"
|
InputDevice "Mouse[0]" "CorePointer"
|
||||||
Screen "Screen[0]"
|
Screen "Screen[0]"
|
||||||
EndSection
|
EndSection
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
{ stdenv, writeText, lib, xorg, xterm, slim
|
{ stdenv, writeText, lib, xorg, xterm, slim
|
||||||
|
|
||||||
|
, config
|
||||||
|
|
||||||
, # Virtual console for the X server.
|
, # Virtual console for the X server.
|
||||||
tty ? 7
|
tty ? 7
|
||||||
|
|
||||||
|
@ -13,17 +15,29 @@
|
||||||
|
|
||||||
let
|
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.xorgserver
|
||||||
xorg.xf86inputkeyboard
|
xorg.xf86inputkeyboard
|
||||||
xorg.xf86inputmouse
|
xorg.xf86inputmouse
|
||||||
xorg.xf86videovesa
|
]
|
||||||
];
|
++ optional (videoDriver == "vesa") xorg.xf86videovesa
|
||||||
|
++ optional (videoDriver == "i810") xorg.xf86videoi810;
|
||||||
|
|
||||||
config = stdenv.mkDerivation {
|
|
||||||
|
configFile = stdenv.mkDerivation {
|
||||||
name = "xserver.conf";
|
name = "xserver.conf";
|
||||||
src = ./xserver.conf;
|
src = ./xserver.conf;
|
||||||
inherit fontDirectories;
|
inherit fontDirectories videoDriver resolutions;
|
||||||
buildCommand = "
|
buildCommand = "
|
||||||
buildCommand= # urgh, don't substitute this
|
buildCommand= # urgh, don't substitute this
|
||||||
|
|
||||||
|
@ -37,7 +51,7 @@ let
|
||||||
done
|
done
|
||||||
|
|
||||||
export modulePaths=
|
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
|
if ls $i/*.so 2> /dev/null; then
|
||||||
modulePaths=\"\${modulePaths}ModulePath \\\"$i\\\"\\n\"
|
modulePaths=\"\${modulePaths}ModulePath \\\"$i\\\"\\n\"
|
||||||
fi
|
fi
|
||||||
|
@ -47,17 +61,19 @@ let
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
clientScript = writeText "xclient" "
|
clientScript = writeText "xclient" "
|
||||||
${xorg.twm}/bin/twm &
|
${xorg.twm}/bin/twm &
|
||||||
${xterm}/bin/xterm -ls
|
${xterm}/bin/xterm -ls
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
xserverArgs = [
|
xserverArgs = [
|
||||||
"-ac"
|
"-ac"
|
||||||
"-nolisten tcp"
|
"-nolisten tcp"
|
||||||
"-terminate"
|
"-terminate"
|
||||||
"-logfile" "/var/log/X.${toString display}.log"
|
"-logfile" "/var/log/X.${toString display}.log"
|
||||||
"-config ${config}"
|
"-config ${configFile}"
|
||||||
":${toString display}" "vt${toString tty}"
|
":${toString display}" "vt${toString tty}"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -69,8 +85,10 @@ xserver_arguments ${toString xserverArgs}
|
||||||
login_cmd exec ${stdenv.bash}/bin/sh ${clientScript}
|
login_cmd exec ${stdenv.bash}/bin/sh ${clientScript}
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
name = "xserver";
|
name = "xserver";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue