2014-04-14 16:26:48 +02:00
|
|
|
|
{ config, lib, pkgs, ... }:
|
2009-08-21 12:13:27 +02:00
|
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
|
with lib;
|
2009-02-22 17:08:46 +01:00
|
|
|
|
|
|
|
|
|
let
|
2009-08-21 12:13:27 +02:00
|
|
|
|
|
2009-06-26 00:08:03 +02:00
|
|
|
|
xcfg = config.services.xserver;
|
|
|
|
|
cfg = xcfg.desktopManager.kde4;
|
2009-09-10 14:37:33 +02:00
|
|
|
|
xorg = pkgs.xorg;
|
2014-10-23 18:14:41 +02:00
|
|
|
|
kde_workspace = config.services.xserver.desktopManager.kde4.kdeWorkspacePackage;
|
2009-02-22 17:08:46 +01:00
|
|
|
|
|
2011-10-31 22:04:39 +01:00
|
|
|
|
# Disable Nepomuk and Strigi by default. As of KDE 4.7, they don't
|
|
|
|
|
# really work very well (e.g. searching files often fails to find
|
|
|
|
|
# files), segfault sometimes and consume significant resources.
|
|
|
|
|
# They can be re-enabled in the KDE System Settings under "Desktop
|
|
|
|
|
# Search".
|
|
|
|
|
nepomukConfig = pkgs.writeTextFile
|
|
|
|
|
{ name = "nepomuk-config";
|
|
|
|
|
destination = "/share/config/nepomukserverrc";
|
2013-04-01 12:15:36 +02:00
|
|
|
|
text =
|
2011-10-31 22:04:39 +01:00
|
|
|
|
''
|
|
|
|
|
[Basic Settings]
|
|
|
|
|
Start Nepomuk=false
|
|
|
|
|
|
|
|
|
|
[Service-nepomukstrigiservice]
|
|
|
|
|
autostart=false
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2012-02-22 21:29:00 +01:00
|
|
|
|
phononBackends = {
|
|
|
|
|
gstreamer = [
|
2016-04-22 15:11:10 +02:00
|
|
|
|
pkgs.phonon-backend-gstreamer
|
2012-02-22 21:29:00 +01:00
|
|
|
|
pkgs.gst_all.gstPluginsBase
|
|
|
|
|
pkgs.gst_all.gstPluginsGood
|
|
|
|
|
pkgs.gst_all.gstPluginsUgly
|
|
|
|
|
pkgs.gst_all.gstPluginsBad
|
|
|
|
|
pkgs.gst_all.gstFfmpeg # for mp3 playback
|
|
|
|
|
pkgs.gst_all.gstreamer # needed?
|
|
|
|
|
];
|
|
|
|
|
|
2016-04-22 15:11:10 +02:00
|
|
|
|
vlc = [pkgs.phonon-backend-vlc];
|
2012-02-22 21:29:00 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
phononBackendPackages = flip concatMap cfg.phononBackends
|
|
|
|
|
(name: attrByPath [name] (throw "unknown phonon backend `${name}'") phononBackends);
|
2013-05-15 00:47:57 +02:00
|
|
|
|
|
2009-08-21 12:13:27 +02:00
|
|
|
|
in
|
2009-02-22 17:08:46 +01:00
|
|
|
|
|
2009-08-21 12:13:27 +02:00
|
|
|
|
{
|
|
|
|
|
options = {
|
2009-02-22 17:08:46 +01:00
|
|
|
|
|
2012-02-22 21:29:00 +01:00
|
|
|
|
services.xserver.desktopManager.kde4 = {
|
|
|
|
|
enable = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.bool;
|
2012-02-22 21:29:00 +01:00
|
|
|
|
default = false;
|
|
|
|
|
description = "Enable the KDE 4 desktop environment.";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
phononBackends = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.listOf types.str;
|
2012-02-22 21:29:00 +01:00
|
|
|
|
default = ["gstreamer"];
|
|
|
|
|
example = ["gstreamer" "vlc"];
|
|
|
|
|
description = "Which phonon multimedia backend kde should use";
|
|
|
|
|
};
|
2014-10-23 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
kdeWorkspacePackage = mkOption {
|
|
|
|
|
internal = true;
|
|
|
|
|
default = pkgs.kde4.kde_workspace;
|
2016-01-17 19:34:55 +01:00
|
|
|
|
defaultText = "pkgs.kde4.kde_workspace";
|
2014-10-23 18:14:41 +02:00
|
|
|
|
type = types.package;
|
|
|
|
|
description = "Custom kde-workspace, used for NixOS rebranding.";
|
|
|
|
|
};
|
2009-08-21 12:13:27 +02:00
|
|
|
|
};
|
|
|
|
|
};
|
2009-02-22 17:08:46 +01:00
|
|
|
|
|
2011-09-14 20:20:50 +02:00
|
|
|
|
|
2009-08-21 12:13:27 +02:00
|
|
|
|
config = mkIf (xcfg.enable && cfg.enable) {
|
2009-02-22 17:08:46 +01:00
|
|
|
|
|
2009-08-21 15:05:45 +02:00
|
|
|
|
# If KDE 4 is enabled, make it the default desktop manager (unless
|
2013-08-10 23:07:13 +02:00
|
|
|
|
# overridden by the user's configuration).
|
2009-08-21 12:13:27 +02:00
|
|
|
|
# !!! doesn't work yet ("Multiple definitions. Only one is allowed
|
|
|
|
|
# for this option.")
|
2013-10-28 20:08:28 +01:00
|
|
|
|
# services.xserver.desktopManager.default = mkOverride 900 "kde4";
|
2009-08-21 12:13:27 +02:00
|
|
|
|
|
|
|
|
|
services.xserver.desktopManager.session = singleton
|
|
|
|
|
{ name = "kde4";
|
|
|
|
|
bgSupport = true;
|
|
|
|
|
start =
|
|
|
|
|
''
|
2011-07-21 13:16:46 +02: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-25 00:07:58 +02: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
|
|
|
|
|
|
2016-02-04 11:14:14 +01:00
|
|
|
|
# Load PulseAudio module for routing support.
|
|
|
|
|
# See http://colin.guthr.ie/2009/10/so-how-does-the-kde-pulseaudio-support-work-anyway/
|
|
|
|
|
${optionalString config.hardware.pulseaudio.enable ''
|
2016-04-28 15:42:16 +02:00
|
|
|
|
${getBin config.hardware.pulseaudio.package}/bin/pactl load-module module-device-manager "do_routing=1"
|
2016-02-04 11:14:14 +01:00
|
|
|
|
''}
|
|
|
|
|
|
2009-02-22 17:08:46 +01:00
|
|
|
|
# Start KDE.
|
2014-10-23 18:14:41 +02:00
|
|
|
|
exec ${kde_workspace}/bin/startkde
|
2009-02-22 17:08:46 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2011-07-18 14:37:13 +02:00
|
|
|
|
security.setuidOwners = singleton
|
|
|
|
|
{ program = "kcheckpass";
|
2014-10-23 18:14:41 +02:00
|
|
|
|
source = "${kde_workspace}/lib/kde4/libexec/kcheckpass";
|
2011-07-18 14:37:13 +02:00
|
|
|
|
owner = "root";
|
|
|
|
|
group = "root";
|
|
|
|
|
setuid = true;
|
|
|
|
|
};
|
2009-02-22 17:08:46 +01:00
|
|
|
|
|
2011-03-03 13:00:54 +01:00
|
|
|
|
environment.systemPackages =
|
2011-07-18 14:37:13 +02:00
|
|
|
|
[ pkgs.kde4.kdelibs
|
2011-09-11 14:44:54 +02:00
|
|
|
|
|
|
|
|
|
pkgs.kde4.kde_baseapps # Splitted kdebase
|
2014-10-23 18:14:41 +02:00
|
|
|
|
kde_workspace
|
2011-09-11 14:44:54 +02:00
|
|
|
|
pkgs.kde4.kde_runtime
|
|
|
|
|
pkgs.kde4.konsole
|
|
|
|
|
pkgs.kde4.kate
|
|
|
|
|
|
2011-07-18 14:37:13 +02:00
|
|
|
|
pkgs.kde4.kde_wallpapers # contains kdm's default background
|
|
|
|
|
pkgs.kde4.oxygen_icons
|
2011-09-05 19:55:53 +02:00
|
|
|
|
pkgs.virtuoso # to enable Nepomuk to find Virtuoso
|
2011-07-18 14:37:13 +02:00
|
|
|
|
|
2011-08-22 13:51:03 +02:00
|
|
|
|
# Starts KDE's Polkit authentication agent.
|
2011-08-26 15:50:03 +02:00
|
|
|
|
pkgs.kde4.polkit_kde_agent
|
2011-08-22 13:51:03 +02:00
|
|
|
|
|
2011-07-18 14:37:13 +02:00
|
|
|
|
# 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-25 00:07:58 +02:00
|
|
|
|
xorg.xauth # used by kdesu
|
2011-08-15 20:08:12 +02:00
|
|
|
|
pkgs.shared_desktop_ontologies # used by nepomuk
|
|
|
|
|
pkgs.strigi # used by nepomuk
|
2014-12-19 07:57:59 +01:00
|
|
|
|
pkgs.kde4.akonadi
|
2013-10-08 16:46:25 +02:00
|
|
|
|
pkgs.mysql # used by akonadi
|
2014-12-19 07:57:59 +01:00
|
|
|
|
pkgs.kde4.kdepim_runtime
|
2011-07-18 14:37:13 +02:00
|
|
|
|
]
|
2014-10-21 14:02:13 +02:00
|
|
|
|
++ lib.optional config.hardware.pulseaudio.enable pkgs.kde4.kmix # Perhaps this should always be enabled
|
|
|
|
|
++ lib.optional config.hardware.bluetooth.enable pkgs.kde4.bluedevil
|
2014-10-22 13:27:19 +02:00
|
|
|
|
++ lib.optional config.networking.networkmanager.enable pkgs.kde4.plasma-nm
|
2014-10-21 14:02:13 +02:00
|
|
|
|
++ [ nepomukConfig ] ++ phononBackendPackages;
|
2010-05-27 11:35:36 +02:00
|
|
|
|
|
2011-03-03 13:00:54 +01:00
|
|
|
|
environment.pathsToLink = [ "/share" ];
|
2010-05-27 11:35:36 +02:00
|
|
|
|
|
2014-11-15 19:31:43 +01:00
|
|
|
|
environment.profileRelativeEnvVars = mkIf (lib.elem "gstreamer" cfg.phononBackends) {
|
|
|
|
|
GST_PLUGIN_SYSTEM_PATH = [ "/lib/gstreamer-0.10" ];
|
|
|
|
|
};
|
|
|
|
|
|
2011-03-03 13:00:54 +01:00
|
|
|
|
environment.etc = singleton
|
2009-02-22 17:08:46 +01:00
|
|
|
|
{ source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
|
|
|
|
|
target = "X11/xkb";
|
2009-08-21 12:13:27 +02:00
|
|
|
|
};
|
2011-03-03 13:00:54 +01:00
|
|
|
|
|
2011-08-23 01:10:24 +02:00
|
|
|
|
# Enable helpful DBus services.
|
2014-04-20 01:53:11 +02:00
|
|
|
|
services.udisks2.enable = true;
|
2013-04-01 12:15:36 +02:00
|
|
|
|
services.upower.enable = config.powerManagement.enable;
|
2011-07-26 03:51:56 +02:00
|
|
|
|
|
2013-10-15 14:47:51 +02:00
|
|
|
|
security.pam.services.kde = { allowNullPassword = true; };
|
2011-10-26 23:47:03 +02:00
|
|
|
|
|
2009-02-22 17:08:46 +01:00
|
|
|
|
};
|
2009-08-21 12:13:27 +02:00
|
|
|
|
|
2009-02-22 17:08:46 +01:00
|
|
|
|
}
|