From 3ad2c9193968e2cbecaedb4869bba783baddb9c5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 25 Feb 2007 15:53:57 +0000 Subject: [PATCH] * Pure X server. All fonts are now in the Nix store. svn path=/nixos/trunk/; revision=8041 --- system/etc.nix | 18 +----------------- system/fonts.nix | 22 ++++++++++++++++++++++ system/upstart.nix | 3 ++- upstart-jobs/xserver.conf | 1 + upstart-jobs/xserver.nix | 24 ++++++++++++++++++++---- 5 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 system/fonts.nix diff --git a/system/etc.nix b/system/etc.nix index 792b6b6a489..420ff1ff5c3 100644 --- a/system/etc.nix +++ b/system/etc.nix @@ -88,23 +88,7 @@ import ../helpers/make-etc.nix { ++ (optional ["fonts" "enableFontConfig"] { source = pkgs.runCommand "fonts.conf" { - fontDirectories = [ - # - the user's .fonts directory - "~/.fonts" - # - the user's current profile - "~/.nix-profile/lib/X11/fonts" - "~/.nix-profile/share/fonts" - # - the default profile - "/nix/var/nix/profiles/default/lib/X11/fonts" - "/nix/var/nix/profiles/default/share/fonts" - # - a few statically built locations - pkgs.xorg.fontbhttf - pkgs.xorg.fontbh100dpi - pkgs.xorg.fontbhlucidatypewriter100dpi - pkgs.ttf_bitstream_vera - pkgs.corefonts - pkgs.freefont_ttf - ]; + fontDirectories = import ./fonts.nix {inherit pkgs;}; buildInputs = [pkgs.libxslt]; inherit (pkgs) fontconfig; } diff --git a/system/fonts.nix b/system/fonts.nix new file mode 100644 index 00000000000..a909ba6de5d --- /dev/null +++ b/system/fonts.nix @@ -0,0 +1,22 @@ +{pkgs}: + +[ + # - the user's .fonts directory + "~/.fonts" + # - the user's current profile + "~/.nix-profile/lib/X11/fonts" + "~/.nix-profile/share/fonts" + # - the default profile + "/nix/var/nix/profiles/default/lib/X11/fonts" + "/nix/var/nix/profiles/default/share/fonts" + # - a few statically built locations + pkgs.xorg.fontbhttf + pkgs.xorg.fontbhlucidatypewriter100dpi + pkgs.ttf_bitstream_vera + pkgs.corefonts + pkgs.freefont_ttf + pkgs.xorg.fontbh100dpi + pkgs.xorg.fontmiscmisc + pkgs.xorg.fontalias + pkgs.xorg.fontcursormisc +] diff --git a/system/upstart.nix b/system/upstart.nix index 68dc1e730c3..5f70d8e228f 100644 --- a/system/upstart.nix +++ b/system/upstart.nix @@ -118,8 +118,9 @@ import ../upstart-jobs/gather.nix { # X server. ++ optional ["services" "xserver" "enable"] (import ../upstart-jobs/xserver.nix { - inherit (pkgs) substituteAll; + inherit (pkgs) stdenv lib; inherit (pkgs.xorg) xorgserver xf86inputkeyboard xf86inputmouse xf86videovesa; + fontDirectories = import ./fonts.nix {inherit pkgs;}; }) # Apache httpd. diff --git a/upstart-jobs/xserver.conf b/upstart-jobs/xserver.conf index 48a89781ec5..b244530147a 100644 --- a/upstart-jobs/xserver.conf +++ b/upstart-jobs/xserver.conf @@ -1,4 +1,5 @@ Section "Files" + @fontPaths@ EndSection diff --git a/upstart-jobs/xserver.nix b/upstart-jobs/xserver.nix index 8979092cbc2..ffce0f74a6a 100644 --- a/upstart-jobs/xserver.nix +++ b/upstart-jobs/xserver.nix @@ -1,4 +1,6 @@ -{ substituteAll +{ stdenv + +, lib , xorgserver @@ -14,13 +16,29 @@ , # X display number. display ? 0 +, # List of font directories. + fontDirectories + }: let - config = substituteAll { + config = stdenv.mkDerivation { name = "xserver.conf"; src = ./xserver.conf; + inherit fontDirectories; + buildCommand = " + buildCommand= # urgh, don't substitute this + 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 + substituteAll $src $out + "; }; in @@ -39,11 +57,9 @@ end script 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} - "; }