mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
* Use the '' string syntax, it cleans up xserver.nix a lot.
svn path=/nixos/trunk/; revision=10066
This commit is contained in:
parent
3da504ab6a
commit
48142d8135
@ -20,9 +20,8 @@ Section "Module"
|
||||
Load "int10"
|
||||
Load "type1"
|
||||
Load "vbe"
|
||||
#Load "evdev"
|
||||
@moduleSection@
|
||||
@extraModules@
|
||||
@extraModules@
|
||||
EndSection
|
||||
|
||||
|
||||
@ -84,7 +83,6 @@ Section "Device"
|
||||
Driver "@videoDriver@"
|
||||
Option "Clone" "@isClone@"
|
||||
#Option "MonitorLayout" "CRT,LFP"
|
||||
#Option "MonitorLayout" "LVDS,CRT"
|
||||
@device@
|
||||
@internalAGPGART@
|
||||
@extraDeviceConfig@
|
||||
|
@ -35,7 +35,7 @@ let
|
||||
|
||||
# Get a bunch of user settings.
|
||||
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);
|
||||
sessionType = cfg.sessionType;
|
||||
sessionStarter = cfg.sessionStarter;
|
||||
renderingFlag = cfg.renderingFlag;
|
||||
@ -71,50 +71,53 @@ let
|
||||
++ optional (videoDriver == "nv") xorg.xf86videonv
|
||||
++ optional (videoDriver == "ati") xorg.xf86videoati
|
||||
++ (optional (cfg.isSynaptics) [(synaptics+"/"+xorg.xorgserver) /*xorg.xf86inputevdev*/]);
|
||||
|
||||
|
||||
|
||||
configFile = stdenv.mkDerivation {
|
||||
name = "xserver.conf";
|
||||
src = ./xserver.conf;
|
||||
inherit fontDirectories videoDriver resolutions isClone;
|
||||
|
||||
synapticsInputDevice = (if cfg.isSynaptics then "
|
||||
Section \"InputDevice\"
|
||||
Identifier \"Touchpad[0]\"
|
||||
Driver \"synaptics\"
|
||||
Option \"Device\" \"${cfg.devSynaptics}\"
|
||||
Option \"Protocol\" \"PS/2\"
|
||||
Option \"LeftEdge\" \"1700\"
|
||||
Option \"RightEdge\" \"5300\"
|
||||
Option \"TopEdge\" \"1700\"
|
||||
Option \"BottomEdge\" \"4200\"
|
||||
Option \"FingerLow\" \"25\"
|
||||
Option \"FingerHigh\" \"30\"
|
||||
Option \"MaxTapTime\" \"180\"
|
||||
Option \"MaxTapMove\" \"220\"
|
||||
Option \"VertScrollDelta\" \"100\"
|
||||
Option \"MinSpeed\" \"0.06\"
|
||||
Option \"MaxSpeed\" \"0.12\"
|
||||
Option \"AccelFactor\" \"0.0010\"
|
||||
Option \"SHMConfig\" \"on\"
|
||||
Option \"Repeater\" \"/dev/input/mice\"
|
||||
Option \"TapButton1\" \"1\"
|
||||
Option \"TapButton2\" \"2\"
|
||||
Option \"TapButton3\" \"3\"
|
||||
EndSection " else "");
|
||||
synapticsInputDevice = if cfg.isSynaptics then ''
|
||||
Section "InputDevice"
|
||||
Identifier "Touchpad[0]"
|
||||
Driver "synaptics"
|
||||
Option "Device" "${cfg.devSynaptics}"
|
||||
Option "Protocol" "PS/2"
|
||||
Option "LeftEdge" "1700"
|
||||
Option "RightEdge" "5300"
|
||||
Option "TopEdge" "1700"
|
||||
Option "BottomEdge" "4200"
|
||||
Option "FingerLow" "25"
|
||||
Option "FingerHigh" "30"
|
||||
Option "MaxTapTime" "180"
|
||||
Option "MaxTapMove" "220"
|
||||
Option "VertScrollDelta" "100"
|
||||
Option "MinSpeed" "0.06"
|
||||
Option "MaxSpeed" "0.12"
|
||||
Option "AccelFactor" "0.0010"
|
||||
Option "SHMConfig" "on"
|
||||
Option "Repeater" "/dev/input/mice"
|
||||
Option "TapButton1" "1"
|
||||
Option "TapButton2" "2"
|
||||
Option "TapButton3" "3"
|
||||
EndSection
|
||||
'' else "";
|
||||
|
||||
xkbOptions = if (cfg.xkbOptions) == "" then "" else
|
||||
" Option \"XkbOptions\" \"${cfg.xkbOptions}\"";
|
||||
xkbOptions = if cfg.xkbOptions == "" then "" else ''
|
||||
Option "XkbOptions" "${cfg.xkbOptions}"
|
||||
'';
|
||||
|
||||
layout = cfg.layout;
|
||||
|
||||
corePointer = if cfg.isSynaptics then "Touchpad[0]" else "Mouse[0]";
|
||||
|
||||
internalAGPGART =
|
||||
if (cfg.useInternalAGPGART) == "yes" then
|
||||
" Option \"UseInternalAGPGART\" \"yes\""
|
||||
else if (cfg.useInternalAGPGART) == "no" then
|
||||
" Option \"UseInternalAGPGART\" \"no\""
|
||||
else " ";
|
||||
if cfg.useInternalAGPGART == "yes" then
|
||||
'' Option "UseInternalAGPGART" "yes"''
|
||||
else if cfg.useInternalAGPGART == "no" then
|
||||
'' Option "UseInternalAGPGART" "no"''
|
||||
else "";
|
||||
|
||||
extraDeviceConfig = cfg.extraDeviceConfig;
|
||||
extraMonitorSettings = cfg.extraMonitorSettings;
|
||||
@ -123,17 +126,17 @@ let
|
||||
serverLayoutOptions = cfg.serverLayoutOptions;
|
||||
defaultDepth = cfg.defaultDepth;
|
||||
|
||||
xfs = (if cfg.useXFS == false then "" else
|
||||
"FontPath \"${toString cfg.useXFS}\"");
|
||||
xfs = if cfg.useXFS == false then "" else
|
||||
''FontPath "${toString cfg.useXFS}"'';
|
||||
|
||||
buildCommand = "
|
||||
buildCommand = ''
|
||||
buildCommand= # urgh, don't substitute this
|
||||
|
||||
export fontPaths=
|
||||
for i in $fontDirectories; do
|
||||
if test \"\${i:0:\${#NIX_STORE}}\" == \"$NIX_STORE\"; then
|
||||
if test "''${i:0:''${#NIX_STORE}}" == "$NIX_STORE"; then
|
||||
for j in $(find $i -name fonts.dir); do
|
||||
fontPaths=\"\${fontPaths}FontPath \\\"$(dirname $j)\\\"\n\"
|
||||
fontPaths="''${fontPaths}FontPath \"$(dirname $j)\"''\n"
|
||||
done
|
||||
fi
|
||||
done
|
||||
@ -141,56 +144,56 @@ let
|
||||
export modulePaths=
|
||||
for i in $(find ${toString modules} -type d); do
|
||||
if ls $i/*.so 2> /dev/null; then
|
||||
modulePaths=\"\${modulePaths}ModulePath \\\"$i\\\"\n\"
|
||||
modulePaths="''${modulePaths}ModulePath \"$i\"''\n"
|
||||
fi
|
||||
done
|
||||
|
||||
#if only my gf were this dirty
|
||||
if test \"${toString videoDriver}\" == \"nvidia\"; then
|
||||
if test "${toString videoDriver}" == "nvidia"; then
|
||||
export moduleSection='
|
||||
Load \"glx\"
|
||||
SubSection \"extmod\"
|
||||
Option \"omit xfree86-dga\"
|
||||
Load "glx"
|
||||
SubSection "extmod"
|
||||
Option "omit xfree86-dga"
|
||||
EndSubSection
|
||||
'
|
||||
|
||||
export screen='
|
||||
Option \"AddARGBGLXVisuals\" \"true\"
|
||||
Option \"DisableGLXRootClipping\" \"true\"
|
||||
Option "AddARGBGLXVisuals" "true"
|
||||
Option "DisableGLXRootClipping" "true"
|
||||
'
|
||||
|
||||
export device='
|
||||
Option \"RenderAccel\" \"true\"
|
||||
Option \"AllowGLXWithComposite\" \"true\"
|
||||
Option \"AddARGBGLXVisuals\" \"true\"
|
||||
Option "RenderAccel" "true"
|
||||
Option "AllowGLXWithComposite" "true"
|
||||
Option "AddARGBGLXVisuals" "true"
|
||||
'
|
||||
|
||||
export extensions='
|
||||
Option \"Composite\" \"Enable\"
|
||||
Option "Composite" "Enable"
|
||||
'
|
||||
|
||||
else
|
||||
export moduleSection='
|
||||
Load \"glx\"
|
||||
Load \"dri\"
|
||||
Load "glx"
|
||||
Load "dri"
|
||||
'
|
||||
export screen=
|
||||
export device=
|
||||
export extensions=
|
||||
fi
|
||||
|
||||
if [ \"${toString videoDriver}\" = i810 ]; then
|
||||
extensions='
|
||||
Option \"Composite\" \"Enable\"
|
||||
';
|
||||
fi;
|
||||
if [ "${toString videoDriver}" = i810 ]; then
|
||||
export extensions='
|
||||
Option "Composite" "Enable"
|
||||
';
|
||||
fi;
|
||||
|
||||
substituteAll $src $out
|
||||
";
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
clientScript = writeText "xclient" "
|
||||
clientScript = writeText "xclient" ''
|
||||
|
||||
source /etc/profile
|
||||
|
||||
@ -203,11 +206,11 @@ let
|
||||
fi
|
||||
|
||||
|
||||
${if cfg.startSSHAgent then "
|
||||
${if cfg.startSSHAgent then ''
|
||||
### Start the SSH agent.
|
||||
export SSH_ASKPASS=${x11_ssh_askpass}/libexec/x11-ssh-askpass
|
||||
eval $(${openssh}/bin/ssh-agent)
|
||||
" else ""}
|
||||
'' else ""}
|
||||
|
||||
### Allow user to override system-wide configuration
|
||||
if test -f ~/.xsession; then
|
||||
@ -217,60 +220,58 @@ let
|
||||
|
||||
### Start a window manager.
|
||||
|
||||
${if windowManager == "twm" then "
|
||||
${if windowManager == "twm" then ''
|
||||
${xorg.twm}/bin/twm &
|
||||
"
|
||||
''
|
||||
|
||||
else if windowManager == "metacity" then "
|
||||
else if windowManager == "metacity" then ''
|
||||
env LD_LIBRARY_PATH=${libX11}/lib:${libXext}/lib:/usr/lib/
|
||||
# !!! 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
|
||||
${gnome.metacity}/bin/metacity &
|
||||
"
|
||||
''
|
||||
|
||||
else if windowManager == "kwm" then "
|
||||
else if windowManager == "kwm" then ''
|
||||
${kdebase}/bin/kwin &
|
||||
"
|
||||
''
|
||||
|
||||
else if windowManager == "compiz" then "
|
||||
|
||||
else if windowManager == "compiz" then ''
|
||||
# !!! 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
|
||||
|
||||
# !!! Hack: turn on most Compiz modules.
|
||||
${gnome.GConf}/bin/gconftool-2 -t list --list-type=string \\
|
||||
--set /apps/compiz/general/allscreens/options/active_plugins \\
|
||||
${gnome.GConf}/bin/gconftool-2 -t list --list-type=string \
|
||||
--set /apps/compiz/general/allscreens/options/active_plugins \
|
||||
[gconf,png,decoration,wobbly,fade,minimize,move,resize,cube,switcher,rotate,place,scale,water]
|
||||
|
||||
# Start Compiz and the GTK-style window decorator.
|
||||
env LD_LIBRARY_PATH=${libX11}/lib:${libXext}/lib:/usr/lib/
|
||||
${compiz}/bin/compiz gconf ${renderingFlag}&
|
||||
${compiz}/bin/gtk-window-decorator --sync &
|
||||
"
|
||||
else if windowManager == "none" then "
|
||||
|
||||
''
|
||||
|
||||
else if windowManager == "none" then ''
|
||||
# The session starter will start the window manager.
|
||||
|
||||
"
|
||||
''
|
||||
|
||||
else abort ("unknown window manager " + windowManager)}
|
||||
|
||||
|
||||
### Show a background image.
|
||||
# (but not if we're starting a full desktop environment that does it for us)
|
||||
${if sessionType != "kde" then "
|
||||
${if sessionType != "kde" then ''
|
||||
|
||||
if test -e $HOME/.background-image; then
|
||||
${feh}/bin/feh --bg-scale $HOME/.background-image
|
||||
fi
|
||||
|
||||
" else ""}
|
||||
'' else ""}
|
||||
|
||||
|
||||
### Start the session.
|
||||
${if sessionType == "kde" then "
|
||||
${if sessionType == "kde" then ''
|
||||
|
||||
# Start KDE.
|
||||
export KDEDIRS=$HOME/.nix-profile:/nix/var/nix/profiles/default:${kdebase}:${kdelibs}
|
||||
@ -278,7 +279,7 @@ let
|
||||
export XDG_DATA_DIRS=${kdebase}/share
|
||||
exec ${kdebase}/bin/startkde
|
||||
|
||||
" else "
|
||||
'' else ''
|
||||
|
||||
# For all other session types, we currently just start a
|
||||
# terminal of the kind indicated by sessionCmd.
|
||||
@ -287,9 +288,9 @@ let
|
||||
sleep 1
|
||||
done
|
||||
|
||||
"}
|
||||
''}
|
||||
|
||||
"; # */ <- hack to fix syntax highlighting
|
||||
'';
|
||||
|
||||
|
||||
xserverArgs = [
|
||||
@ -301,17 +302,15 @@ let
|
||||
"-config ${configFile}"
|
||||
":${toString display}" "vt${toString tty}"
|
||||
"-xkbdir" "${xkeyboard_config}/etc/X11/xkb"
|
||||
] ++ (if ! config.services.xserver.tcpEnable
|
||||
then ["-nolisten tcp"] else []);
|
||||
] ++ optional (!config.services.xserver.tcpEnable) "-nolisten tcp";
|
||||
|
||||
|
||||
# Note: lines must not be indented.
|
||||
slimConfig = writeText "slim.cfg" "
|
||||
xauth_path ${xorg.xauth}/bin/xauth
|
||||
default_xserver ${xorg.xorgserver}/bin/X
|
||||
xserver_arguments ${toString xserverArgs}
|
||||
login_cmd exec ${stdenv.bash}/bin/sh ${clientScript}
|
||||
";
|
||||
slimConfig = writeText "slim.cfg" ''
|
||||
xauth_path ${xorg.xauth}/bin/xauth
|
||||
default_xserver ${xorg.xorgserver}/bin/X
|
||||
xserver_arguments ${toString xserverArgs}
|
||||
login_cmd exec ${stdenv.bash}/bin/sh ${clientScript}
|
||||
'';
|
||||
|
||||
|
||||
# Unpack the SLiM theme, or use the default.
|
||||
@ -319,12 +318,12 @@ login_cmd exec ${stdenv.bash}/bin/sh ${clientScript}
|
||||
let
|
||||
unpackedTheme = stdenv.mkDerivation {
|
||||
name = "slim-theme";
|
||||
buildCommand = "
|
||||
buildCommand = ''
|
||||
ensureDir $out
|
||||
cd $out
|
||||
unpackFile ${cfg.slim.theme}
|
||||
ln -s * default
|
||||
";
|
||||
'';
|
||||
};
|
||||
in if cfg.slim.theme == null then "${slim}/share/slim/themes" else unpackedTheme;
|
||||
|
||||
@ -374,14 +373,12 @@ rec {
|
||||
}
|
||||
++
|
||||
optional (exportConfiguration)
|
||||
{
|
||||
source = "${configFile}";
|
||||
target = "X11/xorg.conf";
|
||||
}
|
||||
;
|
||||
{ source = "${configFile}";
|
||||
target = "X11/xorg.conf";
|
||||
};
|
||||
|
||||
|
||||
job = "
|
||||
job = ''
|
||||
start on ${if autorun then "network-interfaces" else "never"}
|
||||
|
||||
start script
|
||||
@ -394,7 +391,7 @@ rec {
|
||||
else ""
|
||||
}
|
||||
|
||||
rm -f /var/log/slim.log
|
||||
rm -f /var/log/slim.log
|
||||
|
||||
end script
|
||||
|
||||
@ -412,6 +409,6 @@ rec {
|
||||
}
|
||||
|
||||
exec ${slim}/bin/slim
|
||||
";
|
||||
'';
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user