2009-08-21 10:13:27 +00:00
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2009-02-22 16:08:46 +00:00
|
|
|
|
|
|
|
|
|
let
|
2009-08-21 10:13:27 +00:00
|
|
|
|
|
2009-06-25 22:08:03 +00:00
|
|
|
|
xcfg = config.services.xserver;
|
|
|
|
|
cfg = xcfg.desktopManager.kde4;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
xorg = pkgs.xorg;
|
2009-02-22 16:08:46 +00:00
|
|
|
|
|
2011-07-25 00:52:59 +00:00
|
|
|
|
isKDE47 = !(pkgs.kde4 ? kdebase);
|
|
|
|
|
|
2009-08-21 10:13:27 +00:00
|
|
|
|
in
|
2009-02-22 16:08:46 +00:00
|
|
|
|
|
2009-08-21 10:13:27 +00:00
|
|
|
|
{
|
|
|
|
|
options = {
|
2009-02-22 16:08:46 +00:00
|
|
|
|
|
2009-08-21 10:13:27 +00:00
|
|
|
|
services.xserver.desktopManager.kde4.enable = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
example = true;
|
|
|
|
|
description = "Enable the KDE 4 desktop environment.";
|
|
|
|
|
};
|
2009-04-11 22:12:02 +00:00
|
|
|
|
|
2010-05-27 09:35:36 +00:00
|
|
|
|
environment.kdePackages = mkOption {
|
|
|
|
|
default = [];
|
2011-07-24 22:07:58 +00:00
|
|
|
|
example = "[ pkgs.kde4.kdesdk ]";
|
2010-05-27 09:35:36 +00:00
|
|
|
|
type = types.list types.package;
|
2010-10-14 14:57:38 +00:00
|
|
|
|
description = "This option is obsolete. Please use <option>environment.systemPackages</option> instead.";
|
2010-05-27 09:35:36 +00:00
|
|
|
|
};
|
|
|
|
|
|
2009-08-21 10:13:27 +00:00
|
|
|
|
};
|
2009-02-22 16:08:46 +00:00
|
|
|
|
|
2009-08-21 10:13:27 +00:00
|
|
|
|
|
|
|
|
|
config = mkIf (xcfg.enable && cfg.enable) {
|
2009-02-22 16:08:46 +00:00
|
|
|
|
|
2009-08-21 13:05:45 +00:00
|
|
|
|
# If KDE 4 is enabled, make it the default desktop manager (unless
|
2009-08-21 10:13:27 +00:00
|
|
|
|
# overriden by the user's configuration).
|
|
|
|
|
# !!! doesn't work yet ("Multiple definitions. Only one is allowed
|
|
|
|
|
# for this option.")
|
2010-09-03 19:10:59 +00:00
|
|
|
|
# services.xserver.desktopManager.default = mkOverrideTemplate 900 "kde4";
|
2009-08-21 10:13:27 +00:00
|
|
|
|
|
|
|
|
|
services.xserver.desktopManager.session = singleton
|
|
|
|
|
{ name = "kde4";
|
|
|
|
|
bgSupport = true;
|
|
|
|
|
start =
|
|
|
|
|
''
|
2011-07-21 11:16:46 +00:00
|
|
|
|
# The KDE icon cache is supposed to update itself
|
|
|
|
|
# automatically, but it uses the timestamp on the icon
|
|
|
|
|
# theme directory as a trigger. Since in Nix the
|
|
|
|
|
# timestamp is always the same, this doesn't work. So as
|
|
|
|
|
# a workaround, nuke the icon cache on login. This isn't
|
|
|
|
|
# perfect, since it may require logging out after
|
|
|
|
|
# installing new applications to update the cache.
|
|
|
|
|
# See http://lists-archives.org/kde-devel/26175-what-when-will-icon-cache-refresh.html
|
|
|
|
|
rm -fv $HOME/.kde/cache-*/icon-cache.kcache
|
|
|
|
|
|
2011-07-24 22:07:58 +00:00
|
|
|
|
# Qt writes a weird ‘libraryPath’ line to
|
|
|
|
|
# ~/.config/Trolltech.conf that causes the KDE plugin
|
|
|
|
|
# paths of previous KDE invocations to be searched.
|
|
|
|
|
# Obviously using mismatching KDE libraries is potentially
|
|
|
|
|
# disastrous, so here we nuke references to the Nix store
|
|
|
|
|
# in Trolltech.conf. A better solution would be to stop
|
|
|
|
|
# Qt from doing this wackiness in the first place.
|
|
|
|
|
if [ -e $HOME/.config/Trolltech.conf ]; then
|
|
|
|
|
sed -e '/nix\\store\|nix\/store/ d' -i $HOME/.config/Trolltech.conf
|
|
|
|
|
fi
|
|
|
|
|
|
2009-02-22 16:08:46 +00:00
|
|
|
|
# Start KDE.
|
2009-09-13 11:09:58 +00:00
|
|
|
|
exec ${pkgs.kde4.kdebase_workspace}/bin/startkde
|
2009-02-22 16:08:46 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2011-07-18 12:37:13 +00:00
|
|
|
|
security.setuidOwners = singleton
|
|
|
|
|
{ program = "kcheckpass";
|
|
|
|
|
source = "${pkgs.kde4.kdebase_workspace}/lib/kde4/libexec/kcheckpass";
|
|
|
|
|
owner = "root";
|
|
|
|
|
group = "root";
|
|
|
|
|
setuid = true;
|
|
|
|
|
};
|
2009-02-22 16:08:46 +00:00
|
|
|
|
|
2011-03-03 12:00:54 +00:00
|
|
|
|
environment.systemPackages =
|
2011-07-25 00:52:59 +00:00
|
|
|
|
(if !isKDE47 then
|
2011-07-18 12:37:13 +00:00
|
|
|
|
# KDE <= 4.6
|
|
|
|
|
[ # temporary workarounds
|
|
|
|
|
pkgs.shared_desktop_ontologies
|
|
|
|
|
pkgs.strigi
|
|
|
|
|
|
|
|
|
|
pkgs.kde4.kdelibs
|
|
|
|
|
pkgs.kde4.kdebase
|
|
|
|
|
pkgs.kde4.kdebase_runtime
|
|
|
|
|
pkgs.kde4.kdebase_workspace
|
|
|
|
|
pkgs.kde4.oxygen_icons
|
|
|
|
|
pkgs.kde4.qt4 # needed for qdbus
|
|
|
|
|
pkgs.shared_mime_info
|
|
|
|
|
pkgs.gst_all.gstreamer
|
|
|
|
|
pkgs.gst_all.gstPluginsBase
|
|
|
|
|
pkgs.gst_all.gstPluginsGood
|
|
|
|
|
pkgs.gst_all.gstFfmpeg # for mp3 playback
|
|
|
|
|
xorg.xmessage # so that startkde can show error messages
|
|
|
|
|
xorg.xset # used by startkde, non-essential
|
|
|
|
|
]
|
|
|
|
|
else
|
|
|
|
|
# KDE >= 4.7
|
|
|
|
|
[ pkgs.kde4.kdelibs
|
|
|
|
|
pkgs.kde4.kde_baseapps
|
|
|
|
|
pkgs.kde4.kde_runtime
|
|
|
|
|
pkgs.kde4.kde_workspace
|
|
|
|
|
pkgs.kde4.kde_wallpapers # contains kdm's default background
|
|
|
|
|
pkgs.kde4.oxygen_icons
|
|
|
|
|
pkgs.kde4.konsole
|
|
|
|
|
pkgs.kde4.kcolorchooser
|
|
|
|
|
pkgs.kde4.ksnapshot
|
|
|
|
|
pkgs.kde4.kate
|
|
|
|
|
pkgs.kde4.okular
|
|
|
|
|
pkgs.kde4.gwenview
|
|
|
|
|
|
|
|
|
|
# Phonon backends.
|
|
|
|
|
pkgs.kde4.phonon_backend_gstreamer
|
|
|
|
|
pkgs.gst_all.gstPluginsBase
|
|
|
|
|
|
|
|
|
|
# Miscellaneous runtime dependencies.
|
|
|
|
|
pkgs.kde4.qt4 # needed for qdbus
|
|
|
|
|
pkgs.shared_mime_info
|
|
|
|
|
xorg.xmessage # so that startkde can show error messages
|
|
|
|
|
xorg.xset # used by startkde, non-essential
|
2011-07-24 22:07:58 +00:00
|
|
|
|
xorg.xauth # used by kdesu
|
2011-07-18 12:37:13 +00:00
|
|
|
|
]
|
|
|
|
|
) ++ config.environment.kdePackages;
|
2010-05-27 09:35:36 +00:00
|
|
|
|
|
2011-03-03 12:00:54 +00:00
|
|
|
|
environment.pathsToLink = [ "/share" ];
|
2010-05-27 09:35:36 +00:00
|
|
|
|
|
2011-03-03 12:00:54 +00:00
|
|
|
|
environment.etc = singleton
|
2009-02-22 16:08:46 +00:00
|
|
|
|
{ source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
|
|
|
|
|
target = "X11/xkb";
|
2009-08-21 10:13:27 +00:00
|
|
|
|
};
|
2011-03-03 12:00:54 +00:00
|
|
|
|
|
2011-07-25 00:52:59 +00:00
|
|
|
|
# Enable required DBus services.
|
|
|
|
|
services.hal = mkIf (!isKDE47) { enable = true; };
|
|
|
|
|
services.udisks = mkIf isKDE47 { enable = true; };
|
|
|
|
|
services.upower = mkIf isKDE47 { enable = true; };
|
|
|
|
|
|
2009-02-22 16:08:46 +00:00
|
|
|
|
};
|
2009-08-21 10:13:27 +00:00
|
|
|
|
|
2009-02-22 16:08:46 +00:00
|
|
|
|
}
|