2007-02-26 22:39:07 +01:00
|
|
|
{ stdenv, writeText, lib, xorg, xterm, slim
|
2006-11-28 23:27:56 +01:00
|
|
|
|
|
|
|
, # Virtual console for the X server.
|
|
|
|
tty ? 7
|
|
|
|
|
|
|
|
, # X display number.
|
|
|
|
display ? 0
|
|
|
|
|
2007-02-25 16:53:57 +01:00
|
|
|
, # List of font directories.
|
|
|
|
fontDirectories
|
|
|
|
|
2006-11-28 23:27:56 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2007-02-26 22:39:07 +01:00
|
|
|
drivers = [
|
|
|
|
xorg.xorgserver
|
|
|
|
xorg.xf86inputkeyboard
|
|
|
|
xorg.xf86inputmouse
|
|
|
|
xorg.xf86videovesa
|
|
|
|
];
|
|
|
|
|
2007-02-25 16:53:57 +01:00
|
|
|
config = stdenv.mkDerivation {
|
2006-11-28 23:27:56 +01:00
|
|
|
name = "xserver.conf";
|
|
|
|
src = ./xserver.conf;
|
2007-02-25 16:53:57 +01:00
|
|
|
inherit fontDirectories;
|
|
|
|
buildCommand = "
|
|
|
|
buildCommand= # urgh, don't substitute this
|
2007-02-26 22:39:07 +01:00
|
|
|
|
2007-02-25 16:53:57 +01:00
|
|
|
export fontPaths=
|
|
|
|
for i in $fontDirectories; do
|
|
|
|
if test \"\${i:0:\${#NIX_STORE}}\" == \"$NIX_STORE\"; then
|
|
|
|
for j in $(find $i -name fonts.dir); do
|
|
|
|
fontPaths=\"\${fontPaths}FontPath \\\"$(dirname $j)\\\"\\n\"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
done
|
2007-02-26 22:39:07 +01:00
|
|
|
|
|
|
|
export modulePaths=
|
|
|
|
for i in $(find ${toString drivers} -type d); do
|
|
|
|
if ls $i/*.so 2> /dev/null; then
|
|
|
|
modulePaths=\"\${modulePaths}ModulePath \\\"$i\\\"\\n\"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2007-02-25 16:53:57 +01:00
|
|
|
substituteAll $src $out
|
|
|
|
";
|
2006-11-28 23:27:56 +01:00
|
|
|
};
|
|
|
|
|
2007-02-25 17:20:14 +01:00
|
|
|
clientScript = writeText "xclient" "
|
2007-02-26 22:39:07 +01:00
|
|
|
${xorg.twm}/bin/twm &
|
2007-02-25 17:20:14 +01:00
|
|
|
${xterm}/bin/xterm -ls
|
|
|
|
";
|
|
|
|
|
2007-02-25 23:27:17 +01:00
|
|
|
xserverArgs = [
|
|
|
|
"-ac"
|
|
|
|
"-nolisten tcp"
|
|
|
|
"-terminate"
|
|
|
|
"-logfile" "/var/log/X.${toString display}.log"
|
|
|
|
"-config ${config}"
|
|
|
|
":${toString display}" "vt${toString tty}"
|
|
|
|
];
|
|
|
|
|
|
|
|
# Note: lines must not be indented.
|
|
|
|
slimConfig = writeText "slim.cfg" "
|
2007-02-26 22:39:07 +01:00
|
|
|
xauth_path ${xorg.xauth}/bin/xauth
|
|
|
|
default_xserver ${xorg.xorgserver}/bin/X
|
2007-02-25 23:27:17 +01:00
|
|
|
xserver_arguments ${toString xserverArgs}
|
|
|
|
login_cmd exec ${stdenv.bash}/bin/sh ${clientScript}
|
|
|
|
";
|
|
|
|
|
2006-11-28 23:27:56 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
rec {
|
|
|
|
name = "xserver";
|
|
|
|
|
|
|
|
job = "
|
2006-11-29 23:34:59 +01:00
|
|
|
#start on network-interfaces
|
2006-11-28 23:27:56 +01:00
|
|
|
|
|
|
|
start script
|
|
|
|
|
|
|
|
end script
|
|
|
|
|
2007-02-25 23:27:17 +01:00
|
|
|
env SLIM_CFGFILE=${slimConfig}
|
|
|
|
env FONTCONFIG_FILE=/etc/fonts/fonts.conf # !!! cleanup
|
|
|
|
|
|
|
|
exec ${slim}/bin/slim
|
2006-11-28 23:27:56 +01:00
|
|
|
";
|
|
|
|
|
|
|
|
}
|