From d5e97ab056011031be29e760c3e63ecf36371679 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 5 Apr 2009 18:30:39 +0000 Subject: [PATCH] * Let KDEDIRS, XDG_CONFIG_DIRS and XDG_DATA_DIRS contain the KDE packages that we need rather than just /var/run/current-system/sw. This ensures consistency when upgrading a system (e.g. you don't end up with a mix of KDE versions at runtime). This partially reverts r14148 (in particular the update-mime-database hack in the systemPath post-build). svn path=/nixos/trunk/; revision=14887 --- etc/bashrc.sh | 12 ++++++------ etc/default.nix | 8 +++++++- system/system.nix | 31 ++++++++++++++++++++----------- upstart-jobs/default.nix | 6 ++++-- upstart-jobs/xserver.nix | 33 ++++++++++++--------------------- 5 files changed, 49 insertions(+), 41 deletions(-) diff --git a/etc/bashrc.sh b/etc/bashrc.sh index baaed726ee1..1a2b45794d9 100644 --- a/etc/bashrc.sh +++ b/etc/bashrc.sh @@ -15,9 +15,9 @@ export LANG=@defaultLocale@ export EDITOR=nano export INFOPATH=/var/run/current-system/sw/info:/var/run/current-system/sw/share/info export LOCATE_PATH=/var/cache/locatedb -export KDEDIRS=/var/run/current-system/sw -export XDG_CONFIG_DIRS=/var/run/current-system/sw/etc/xdg -export XDG_DATA_DIRS=/var/run/current-system/sw/share +export KDEDIRS=@kdeDirs@ +export XDG_CONFIG_DIRS=@xdgConfigDirs@ +export XDG_DATA_DIRS=@xdgDataDirs@ # Set up secure multi-user builds: non-root users build through the @@ -44,11 +44,11 @@ for i in $NIX_PROFILES; do # !!! reverse export PKG_CONFIG_PATH="$i/lib/pkgconfig:$PKG_CONFIG_PATH" # Automake's `aclocal' bails out if it finds non-existent directories - # in its path. !!! We should fix aclocal instead. - if [ -d "$i/share/aclocal" ] - then + # in its path. !!! This has been fixed in the stdenv branch. + if [ -d "$i/share/aclocal" ]; then export ACLOCAL_PATH="$i/share/aclocal:$ACLOCAL_PATH" fi + export PERL5LIB="$i/lib/site_perl:$PERL5LIB" # GStreamer. diff --git a/etc/default.nix b/etc/default.nix index b9411117971..656e197eca5 100644 --- a/etc/default.nix +++ b/etc/default.nix @@ -1,5 +1,6 @@ { config, pkgs, upstartJobs, systemPath, wrapperDir , defaultShell, extraEtc, nixEnvVars, modulesTree, nssModulesPath, binsh +, kdePackages }: let @@ -19,7 +20,7 @@ let pamConsolePerms = ./security/console.perms; - + in @@ -108,6 +109,11 @@ import ../helpers/make-etc.nix { timeZone = config.time.timeZone; defaultLocale = config.i18n.defaultLocale; inherit nixEnvVars; + # !!! in the modular NixOS these should be declared by the KDE + # component. + kdeDirs = pkgs.lib.concatStringsSep ":" kdePackages; + xdgConfigDirs = pkgs.lib.makeSearchPath "etc/xdg" kdePackages; + xdgDataDirs = pkgs.lib.makeSearchPath "share" kdePackages; }; target = "bashrc"; } diff --git a/system/system.nix b/system/system.nix index 75c64ab7e1a..7fc5974cc39 100644 --- a/system/system.nix +++ b/system/system.nix @@ -117,14 +117,15 @@ rec { # The services (Upstart) configuration for the system. upstartJobs = import ../upstart-jobs/default.nix { inherit config pkgs nix modprobe nssModulesPath nixEnvVars - optionDeclarations kernelPackages mount; + optionDeclarations kernelPackages mount kdePackages; }; # The static parts of /etc. etc = import ../etc/default.nix { inherit config pkgs upstartJobs systemPath wrapperDir - defaultShell nixEnvVars modulesTree nssModulesPath binsh; + defaultShell nixEnvVars modulesTree nssModulesPath binsh + kdePackages; extraEtc = (pkgs.lib.concatLists (map (job: job.extraEtc) upstartJobs.jobs)) ++ config.environment.etc; @@ -262,18 +263,26 @@ rec { inherit (config.environment) pathsToLink; ignoreCollisions = true; - - postBuild = - if config.services.xserver.sessionType == "kde4" then - # Rebuild the MIME database. Otherwise KDE won't be able to - # find many MIME types. - '' - ${pkgs.shared_mime_info}/bin/update-mime-database $out/share/mime - '' - else ""; }; + # The list of packages that need to appear in KDEDIRS, + # XDG_CONFIG_DIRS and XDG_DATA_DIRS. + # !!! This should be defined somewhere else. + kdePackages = + pkgs.lib.optionals (config.services.xserver.sessionType == "kde4") + [ pkgs.kde42.kdelibs + pkgs.kde42.kdebase + pkgs.kde42.kdebase_runtime + pkgs.kde42.kdebase_workspace + pkgs.shared_mime_info + ] + ++ pkgs.lib.optionals (config.services.xserver.sessionType == "kde") + [ pkgs.kdebase + pkgs.kdelibs + ]; + + usersGroups = import ./users-groups.nix { inherit pkgs config upstartJobs defaultShell; }; diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index 95dbb320ea9..3ecd007dc1c 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -1,4 +1,6 @@ -{config, pkgs, nix, modprobe, nssModulesPath, nixEnvVars, optionDeclarations, kernelPackages, mount}: +{ config, pkgs, nix, modprobe, nssModulesPath, nixEnvVars, optionDeclarations +, kernelPackages, mount, kdePackages +}: let @@ -230,7 +232,7 @@ let # X server. ++ optional config.services.xserver.enable (import ../upstart-jobs/xserver.nix { - inherit config pkgs kernelPackages; + inherit config pkgs kernelPackages kdePackages; fontDirectories = import ../system/fonts.nix {inherit pkgs config;}; }) diff --git a/upstart-jobs/xserver.nix b/upstart-jobs/xserver.nix index ff6f34e5de7..772b8f214f0 100644 --- a/upstart-jobs/xserver.nix +++ b/upstart-jobs/xserver.nix @@ -1,4 +1,4 @@ -{ config, pkgs, kernelPackages +{ config, pkgs, kernelPackages, kdePackages , # List of font directories. fontDirectories @@ -7,6 +7,7 @@ let inherit (pkgs.lib) optional isInList getAttr; + # Abbreviations. cfg = config.services.xserver; xorg = cfg.package; @@ -15,14 +16,14 @@ let knownVideoDrivers = { nvidia = { modulesFirst = [ kernelPackages.nvidia_x11 ]; }; #make sure it first loads the nvidia libs - vesa = { modules = [xorg.xf86videovesa]; }; - vga = { modules = [xorg.xf86videovga]; }; - sis = { modules = [xorg.xf86videosis]; }; - i810 = { modules = [xorg.xf86videoi810]; }; - intel = { modules = [xorg.xf86videointel]; }; - nv = { modules = [xorg.xf86videonv]; }; - ati = { modules = [xorg.xf86videoati]; }; - via = { modules = [xorg.xf86videovia]; }; + vesa = { modules = [xorg.xf86videovesa]; }; + vga = { modules = [xorg.xf86videovga]; }; + sis = { modules = [xorg.xf86videosis]; }; + i810 = { modules = [xorg.xf86videoi810]; }; + intel = { modules = [xorg.xf86videointel]; }; + nv = { modules = [xorg.xf86videonv]; }; + ati = { modules = [xorg.xf86videoati]; }; + via = { modules = [xorg.xf86videovia]; }; cirrus = { modules = [xorg.xf86videocirrus]; }; }; @@ -289,9 +290,6 @@ let ${if sessionType == "kde" then '' # Start KDE. - export KDEDIRS=$HOME/.nix-profile:/nix/var/nix/profiles/default:${pkgs.kdebase}:${pkgs.kdelibs} - export XDG_CONFIG_DIRS=${pkgs.kdebase}/etc/xdg:${pkgs.kdelibs}/etc/xdg - export XDG_DATA_DIRS=${pkgs.kdebase}/share exec ${pkgs.kdebase}/bin/startkde '' else if sessionType == "kde4" then '' @@ -384,24 +382,17 @@ rec { gnome.gconfeditor ] ++ optional (sessionType == "kde") [ - pkgs.kdelibs - pkgs.kdebase xorg.xset # used by startkde, non-essential ] ++ optional (sessionType == "kde4") [ xorg.xmessage # so that startkde can show error messages pkgs.qt4 # needed for qdbus - pkgs.kde42.kdelibs - pkgs.kde42.kdebase - pkgs.kde42.kdebase_runtime - pkgs.kde42.kdebase_workspace - pkgs.kde42.kdegames - pkgs.shared_mime_info xorg.xset # used by startkde, non-essential ] ++ optional (videoDriver == "nvidia") [ kernelPackages.nvidia_x11 - ]; + ] + ++ kdePackages; extraEtc =