* Just pass all of Nixpkgs to xserver.nix.

svn path=/nixos/trunk/; revision=10068
This commit is contained in:
Eelco Dolstra 2008-01-04 10:54:33 +00:00
parent b73424833a
commit 8f0e88d4e5
3 changed files with 64 additions and 64 deletions

View File

@ -900,6 +900,22 @@
"; ";
}; };
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.
";
};
}; };

View File

@ -146,13 +146,7 @@ let
# X server. # X server.
++ optional config.services.xserver.enable ++ optional config.services.xserver.enable
(import ../upstart-jobs/xserver.nix { (import ../upstart-jobs/xserver.nix {
inherit config; inherit config pkgs;
inherit (pkgs) writeText lib xterm slim xorg mesa
gnome compiz feh kdebase kdelibs xkeyboard_config
openssh x11_ssh_askpass nvidiaDrivers synaptics;
stdenv = pkgs.stdenvNewSetupScript;
libX11 = pkgs.xlibs.libX11;
libXext = pkgs.xlibs.libXext;
fontDirectories = import ../system/fonts.nix {inherit pkgs config;}; fontDirectories = import ../system/fonts.nix {inherit pkgs config;};
}) })

View File

@ -1,18 +1,4 @@
{ stdenv, writeText, lib, xorg, mesa, xterm, slim, gnome { config, pkgs
, compiz, feh
, kdelibs, kdebase
, xkeyboard_config
, openssh, x11_ssh_askpass
, nvidiaDrivers, libX11, libXext
, synaptics
, config
, # Virtual console for the X server.
tty ? 7
, # X display number.
display ? 0
, # List of font directories. , # List of font directories.
fontDirectories fontDirectories
@ -20,10 +6,14 @@
let let
cfg = config.services.xserver;
optional = condition: x: if condition then [x] else []; optional = condition: x: if condition then [x] else [];
# Abbreviations.
cfg = config.services.xserver;
xorg = pkgs.xorg;
gnome = pkgs.gnome;
stdenv = pkgs.stdenvNewSetupScript;
# Get a bunch of user settings. # Get a bunch of user settings.
videoDriver = cfg.videoDriver; videoDriver = cfg.videoDriver;
resolutions = map (res: ''"${toString res.x}x${toString res.y}"'') (cfg.resolutions); resolutions = map (res: ''"${toString res.x}x${toString res.y}"'') (cfg.resolutions);
@ -34,7 +24,7 @@ let
sessionCmd = sessionCmd =
if sessionType == "" then sessionStarter else if sessionType == "" then sessionStarter else
if sessionType == "xterm" then "${xterm}/bin/xterm -ls" else if sessionType == "xterm" then "${pkgs.xterm}/bin/xterm -ls" else
if sessionType == "gnome" then "${gnome.gnometerminal}/bin/gnome-terminal -ls" else if sessionType == "gnome" then "${gnome.gnometerminal}/bin/gnome-terminal -ls" else
abort ("unknown session type "+ sessionType); abort ("unknown session type "+ sessionType);
@ -48,7 +38,7 @@ let
modules = modules =
optional (videoDriver == "nvidia") nvidiaDrivers ++ #make sure it first loads the nvidia libs optional (videoDriver == "nvidia") pkgs.nvidiaDrivers ++ #make sure it first loads the nvidia libs
[ [
xorg.xorgserver xorg.xorgserver
xorg.xf86inputkeyboard xorg.xf86inputkeyboard
@ -61,7 +51,7 @@ let
++ optional (videoDriver == "intel") xorg.xf86videointel ++ optional (videoDriver == "intel") xorg.xf86videointel
++ optional (videoDriver == "nv") xorg.xf86videonv ++ optional (videoDriver == "nv") xorg.xf86videonv
++ optional (videoDriver == "ati") xorg.xf86videoati ++ optional (videoDriver == "ati") xorg.xf86videoati
++ (optional (cfg.isSynaptics) [(synaptics+"/"+xorg.xorgserver) /*xorg.xf86inputevdev*/]); ++ (optional cfg.isSynaptics ["${pkgs.synaptics}/${xorg.xorgserver}" /*xorg.xf86inputevdev*/]);
configFile = stdenv.mkDerivation { configFile = stdenv.mkDerivation {
@ -185,7 +175,7 @@ let
}; };
clientScript = writeText "xclient" '' clientScript = pkgs.writeText "xclient" ''
source /etc/profile source /etc/profile
@ -200,8 +190,8 @@ let
${if cfg.startSSHAgent then '' ${if cfg.startSSHAgent then ''
### Start the SSH agent. ### Start the SSH agent.
export SSH_ASKPASS=${x11_ssh_askpass}/libexec/x11-ssh-askpass export SSH_ASKPASS=${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass
eval $(${openssh}/bin/ssh-agent) eval $(${pkgs.openssh}/bin/ssh-agent)
'' else ""} '' else ""}
### Allow user to override system-wide configuration ### Allow user to override system-wide configuration
@ -217,7 +207,7 @@ let
'' ''
else if windowManager == "metacity" then '' else if windowManager == "metacity" then ''
env LD_LIBRARY_PATH=${libX11}/lib:${libXext}/lib:/usr/lib/ env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:/usr/lib/
# !!! Hack: load the schemas for Metacity. # !!! Hack: load the schemas for Metacity.
GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \ GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \
--makefile-install-rule ${gnome.metacity}/etc/gconf/schemas/*.schemas --makefile-install-rule ${gnome.metacity}/etc/gconf/schemas/*.schemas
@ -225,13 +215,13 @@ let
'' ''
else if windowManager == "kwm" then '' else if windowManager == "kwm" then ''
${kdebase}/bin/kwin & ${pkgs.kdebase}/bin/kwin &
'' ''
else if windowManager == "compiz" then '' else if windowManager == "compiz" then ''
# !!! Hack: load the schemas for Compiz. # !!! Hack: load the schemas for Compiz.
GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \ GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \
--makefile-install-rule ${compiz}/etc/gconf/schemas/*.schemas --makefile-install-rule ${pkgs.compiz}/etc/gconf/schemas/*.schemas
# !!! Hack: turn on most Compiz modules. # !!! Hack: turn on most Compiz modules.
${gnome.GConf}/bin/gconftool-2 -t list --list-type=string \ ${gnome.GConf}/bin/gconftool-2 -t list --list-type=string \
@ -239,9 +229,9 @@ let
[gconf,png,decoration,wobbly,fade,minimize,move,resize,cube,switcher,rotate,place,scale,water] [gconf,png,decoration,wobbly,fade,minimize,move,resize,cube,switcher,rotate,place,scale,water]
# Start Compiz and the GTK-style window decorator. # Start Compiz and the GTK-style window decorator.
env LD_LIBRARY_PATH=${libX11}/lib:${libXext}/lib:/usr/lib/ env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:/usr/lib/
${compiz}/bin/compiz gconf ${renderingFlag}& ${pkgs.compiz}/bin/compiz gconf ${renderingFlag}&
${compiz}/bin/gtk-window-decorator --sync & ${pkgs.compiz}/bin/gtk-window-decorator --sync &
'' ''
else if windowManager == "none" then '' else if windowManager == "none" then ''
@ -256,7 +246,7 @@ let
${if sessionType != "kde" then '' ${if sessionType != "kde" then ''
if test -e $HOME/.background-image; then if test -e $HOME/.background-image; then
${feh}/bin/feh --bg-scale $HOME/.background-image ${pkgs.feh}/bin/feh --bg-scale $HOME/.background-image
fi fi
'' else ""} '' else ""}
@ -266,10 +256,10 @@ let
${if sessionType == "kde" then '' ${if sessionType == "kde" then ''
# Start KDE. # Start KDE.
export KDEDIRS=$HOME/.nix-profile:/nix/var/nix/profiles/default:${kdebase}:${kdelibs} export KDEDIRS=$HOME/.nix-profile:/nix/var/nix/profiles/default:${pkgs.kdebase}:${pkgs.kdelibs}
export XDG_CONFIG_DIRS=${kdebase}/etc/xdg:${kdelibs}/etc/xdg export XDG_CONFIG_DIRS=${pkgs.kdebase}/etc/xdg:${pkgs.kdelibs}/etc/xdg
export XDG_DATA_DIRS=${kdebase}/share export XDG_DATA_DIRS=${pkgs.kdebase}/share
exec ${kdebase}/bin/startkde exec ${pkgs.kdebase}/bin/startkde
'' else '' '' else ''
@ -290,14 +280,14 @@ let
"-logverbose" "-logverbose"
"-verbose" "-verbose"
"-terminate" "-terminate"
"-logfile" "/var/log/X.${toString display}.log" "-logfile" "/var/log/X.${toString cfg.display}.log"
"-config ${configFile}" "-config ${configFile}"
":${toString display}" "vt${toString tty}" ":${toString cfg.display}" "vt${toString cfg.tty}"
"-xkbdir" "${xkeyboard_config}/etc/X11/xkb" "-xkbdir" "${pkgs.xkeyboard_config}/etc/X11/xkb"
] ++ optional (!config.services.xserver.tcpEnable) "-nolisten tcp"; ] ++ optional (!config.services.xserver.tcpEnable) "-nolisten tcp";
slimConfig = writeText "slim.cfg" '' slimConfig = pkgs.writeText "slim.cfg" ''
xauth_path ${xorg.xauth}/bin/xauth xauth_path ${xorg.xauth}/bin/xauth
default_xserver ${xorg.xorgserver}/bin/X default_xserver ${xorg.xorgserver}/bin/X
xserver_arguments ${toString xserverArgs} xserver_arguments ${toString xserverArgs}
@ -317,7 +307,7 @@ let
ln -s * default ln -s * default
''; '';
}; };
in if cfg.slim.theme == null then "${slim}/share/slim/themes" else unpackedTheme; in if cfg.slim.theme == null then "${pkgs.slim}/share/slim/themes" else unpackedTheme;
in in
@ -331,7 +321,7 @@ rec {
xorg.xrandr xorg.xrandr
xorg.xrdb xorg.xrdb
xorg.setxkbmap xorg.setxkbmap
feh pkgs.feh
] ]
++ optional (windowManager == "twm") [ ++ optional (windowManager == "twm") [
xorg.twm xorg.twm
@ -340,10 +330,10 @@ rec {
gnome.metacity gnome.metacity
] ]
++ optional (windowManager == "compiz") [ ++ optional (windowManager == "compiz") [
compiz pkgs.compiz
] ]
++ optional (sessionType == "xterm") [ ++ optional (sessionType == "xterm") [
xterm pkgs.xterm
] ]
++ optional (sessionType == "gnome") [ ++ optional (sessionType == "gnome") [
gnome.gnometerminal gnome.gnometerminal
@ -351,8 +341,8 @@ rec {
gnome.gconfeditor gnome.gconfeditor
] ]
++ optional (sessionType == "kde") [ ++ optional (sessionType == "kde") [
kdelibs pkgs.kdelibs
kdebase pkgs.kdebase
xorg.iceauth # absolutely required by dcopserver xorg.iceauth # absolutely required by dcopserver
xorg.xset # used by startkde, non-essential xorg.xset # used by startkde, non-essential
]; ];
@ -360,7 +350,7 @@ rec {
extraEtc = extraEtc =
optional (sessionType == "kde") optional (sessionType == "kde")
{ source = "${xkeyboard_config}/etc/X11/xkb"; { source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
target = "X11/xkb"; target = "X11/xkb";
} }
++ ++
@ -377,9 +367,9 @@ rec {
rm -f /var/run/opengl-driver rm -f /var/run/opengl-driver
${if videoDriver == "nvidia" ${if videoDriver == "nvidia"
then "ln -sf ${nvidiaDrivers} /var/run/opengl-driver" then "ln -sf ${pkgs.nvidiaDrivers} /var/run/opengl-driver"
else if cfg.driSupport else if cfg.driSupport
then "ln -sf ${mesa} /var/run/opengl-driver" then "ln -sf ${pkgs.mesa} /var/run/opengl-driver"
else "" else ""
} }
@ -391,16 +381,16 @@ rec {
env SLIM_THEMESDIR=${slimThemesDir} env SLIM_THEMESDIR=${slimThemesDir}
env FONTCONFIG_FILE=/etc/fonts/fonts.conf # !!! cleanup env FONTCONFIG_FILE=/etc/fonts/fonts.conf # !!! cleanup
env XKB_BINDIR=${xorg.xkbcomp}/bin # Needed for the Xkb extension. env XKB_BINDIR=${xorg.xkbcomp}/bin # Needed for the Xkb extension.
env LD_LIBRARY_PATH=${libX11}/lib:${libXext}/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz) env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz)
${if videoDriver == "nvidia" ${if videoDriver == "nvidia"
then "env XORG_DRI_DRIVER_PATH=${nvidiaDrivers}/X11R6/lib/modules/drivers/" then "env XORG_DRI_DRIVER_PATH=${pkgs.nvidiaDrivers}/X11R6/lib/modules/drivers/"
else if cfg.driSupport else if cfg.driSupport
then "env XORG_DRI_DRIVER_PATH=${mesa}/lib/modules/dri" then "env XORG_DRI_DRIVER_PATH=${pkgs.mesa}/lib/modules/dri"
else "" else ""
} }
exec ${slim}/bin/slim exec ${pkgs.slim}/bin/slim
''; '';
} }