diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index 34c9a73079f6..cc7dd45bc10e 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -135,6 +135,12 @@ rec { inherit (pkgs) openssh; }) + # X server. + (import ../upstart-jobs/xserver.nix { + inherit (pkgs) genericSubstituter; + inherit (pkgs.xorg) xorgserver xf86inputkeyboard xf86inputmouse xf86videovesa; + }) + # Transparent TTY backgrounds. (import ../upstart-jobs/tty-backgrounds.nix { inherit (pkgs) stdenv splashutils; diff --git a/configuration/system-configuration.nix b/configuration/system-configuration.nix index db4482306e41..f080e61078a4 100644 --- a/configuration/system-configuration.nix +++ b/configuration/system-configuration.nix @@ -31,6 +31,8 @@ with bootEnv; rec { + inherit upstartJobs; + systemConfiguration = pkgs.stdenv.mkDerivation { name = "system-configuration"; diff --git a/upstart-jobs/xserver.conf b/upstart-jobs/xserver.conf new file mode 100644 index 000000000000..48a89781ec58 --- /dev/null +++ b/upstart-jobs/xserver.conf @@ -0,0 +1,68 @@ +Section "Files" +EndSection + + +Section "ServerFlags" + Option "AllowMouseOpenFail" "on" + Option "DontVTSwitch" "off" +EndSection + + +Section "Module" +EndSection + + +Section "InputDevice" + Driver "kbd" + Identifier "Keyboard[0]" + Option "Protocol" "Standard" + Option "XkbLayout" "us" + Option "XkbModel" "pc104" + Option "XkbRules" "xfree86" +EndSection + + +Section "InputDevice" + Driver "mouse" + Identifier "Mouse[0]" + Option "Device" "/dev/mice" +EndSection + + +Section "Monitor" + Identifier "Monitor[0]" + Option "DPMS" + UseModes "Modes[0]" +EndSection + + +Section "Modes" + Identifier "Modes[0]" +EndSection + + +Section "Screen" + Identifier "Screen[0]" + Device "Device[0]" + Monitor "Monitor[0]" + DefaultDepth 16 + SubSection "Display" + Depth 16 + Modes "1024x768" + EndSubSection +EndSection + + +Section "Device" + Identifier "Device[0]" + Driver "vesa" +EndSection + + +Section "ServerLayout" + Identifier "Layout[all]" + InputDevice "Keyboard[0]" "CoreKeyboard" + InputDevice "Mouse[0]" "CorePointer" + Screen "Screen[0]" +EndSection + diff --git a/upstart-jobs/xserver.nix b/upstart-jobs/xserver.nix new file mode 100644 index 000000000000..d654dcffa7ee --- /dev/null +++ b/upstart-jobs/xserver.nix @@ -0,0 +1,49 @@ +{ genericSubstituter + +, xorgserver + +, xf86inputkeyboard + +, xf86inputmouse + +, xf86videovesa + +, # Virtual console for the X server. + tty ? 7 + +, # X display number. + display ? 0 + +}: + +let + + config = genericSubstituter { + name = "xserver.conf"; + src = ./xserver.conf; + }; + +in + +rec { + name = "xserver"; + + job = " +start on network-interfaces + +start script + +end script + +# !!! -ac is a bad idea. +exec ${xorgserver}/bin/X \\ + -ac -nolisten tcp -terminate \\ + -logfile /var/log/X.${toString display}.log \\ + -fp /var/fonts \\ + -modulepath ${xorgserver}/lib/xorg/modules,${xf86inputkeyboard}/lib/xorg/modules/input,${xf86inputmouse}/lib/xorg/modules/input,${xf86videovesa}/lib/xorg/modules/drivers \\ + -config ${config} \\ + :${toString display} vt${toString tty} + + "; + +}