* Construct the module path dynamically.

svn path=/nixos/trunk/; revision=8059
This commit is contained in:
Eelco Dolstra 2007-02-26 21:39:07 +00:00
parent ef92ce06cb
commit 4164a4ff3e
3 changed files with 25 additions and 26 deletions

View File

@ -118,9 +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 (pkgs) stdenv writeText lib xterm slim; inherit (pkgs) stdenv writeText lib xterm slim xorg;
inherit (pkgs.xorg) xorgserver xinit twm xauth
xf86inputkeyboard xf86inputmouse xf86videovesa;
fontDirectories = import ./fonts.nix {inherit pkgs;}; fontDirectories = import ./fonts.nix {inherit pkgs;};
}) })

View File

@ -1,5 +1,9 @@
Section "Files" Section "Files"
# Font directories.
@fontPaths@ @fontPaths@
# Module (driver) directories.
@modulePaths@
EndSection EndSection

View File

@ -1,22 +1,4 @@
{ stdenv, writeText { stdenv, writeText, lib, xorg, xterm, slim
, lib
, xorgserver
, xinit
, # Initial client/window manager.
twm, xterm
, # Needed for the display manager (SLiM).
slim, xauth
, xf86inputkeyboard
, xf86inputmouse
, xf86videovesa
, # Virtual console for the X server. , # Virtual console for the X server.
tty ? 7 tty ? 7
@ -31,12 +13,20 @@
let let
drivers = [
xorg.xorgserver
xorg.xf86inputkeyboard
xorg.xf86inputmouse
xorg.xf86videovesa
];
config = stdenv.mkDerivation { config = stdenv.mkDerivation {
name = "xserver.conf"; name = "xserver.conf";
src = ./xserver.conf; src = ./xserver.conf;
inherit fontDirectories; inherit fontDirectories;
buildCommand = " buildCommand = "
buildCommand= # urgh, don't substitute this buildCommand= # urgh, don't substitute this
export fontPaths= export fontPaths=
for i in $fontDirectories; do for i in $fontDirectories; do
if test \"\${i:0:\${#NIX_STORE}}\" == \"$NIX_STORE\"; then if test \"\${i:0:\${#NIX_STORE}}\" == \"$NIX_STORE\"; then
@ -45,12 +35,20 @@ let
done done
fi fi
done done
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
substituteAll $src $out substituteAll $src $out
"; ";
}; };
clientScript = writeText "xclient" " clientScript = writeText "xclient" "
${twm}/bin/twm & ${xorg.twm}/bin/twm &
${xterm}/bin/xterm -ls ${xterm}/bin/xterm -ls
"; ";
@ -59,15 +57,14 @@ let
"-nolisten tcp" "-nolisten tcp"
"-terminate" "-terminate"
"-logfile" "/var/log/X.${toString display}.log" "-logfile" "/var/log/X.${toString display}.log"
"-modulepath" "${xorgserver}/lib/xorg/modules,${xf86inputkeyboard}/lib/xorg/modules/input,${xf86inputmouse}/lib/xorg/modules/input,${xf86videovesa}/lib/xorg/modules/drivers"
"-config ${config}" "-config ${config}"
":${toString display}" "vt${toString tty}" ":${toString display}" "vt${toString tty}"
]; ];
# Note: lines must not be indented. # Note: lines must not be indented.
slimConfig = writeText "slim.cfg" " slimConfig = writeText "slim.cfg" "
xauth_path ${xauth}/bin/xauth xauth_path ${xorg.xauth}/bin/xauth
default_xserver ${xorgserver}/bin/X default_xserver ${xorg.xorgserver}/bin/X
xserver_arguments ${toString xserverArgs} xserver_arguments ${toString xserverArgs}
login_cmd exec ${stdenv.bash}/bin/sh ${clientScript} login_cmd exec ${stdenv.bash}/bin/sh ${clientScript}
"; ";