nixpkgs/modules/services/x11/desktop-managers/default.nix
Eelco Dolstra 6e118cd66b * Change the default desktop manager from "xterm" to the last imported
and enabled desktop manager (e.g. "kde" if KDE is enabled, and
  "xterm" if nothing is explicitly enabled).  This means that you
  don't have to write

    services.xserver.desktopManager.default = "kde4";

  anymore in addition to

    services.xserver.desktopManager.kde4.enable = true;

  to make KDE the default desktop environment.
  
* Remove the "none + none" session type.

* Remove the "+ none" string at the end of session types.  I.e. now
  it's "kde", not "kde + none".

* In kdm, add coreutils to its SystemPath so that it can remove the
  temporary directories in /tmp that it creates.

svn path=/nixos/trunk/; revision=23036
2010-08-08 14:05:32 +00:00

76 lines
2.0 KiB
Nix

{ config, pkgs, ... }:
with pkgs.lib;
let
xcfg = config.services.xserver;
cfg = xcfg.desktopManager;
# Whether desktop manager `d' is capable of setting a background.
# If it isn't, the `feh' program is used as a fallback.
needBGCond = d: ! (d ? bgSupport && d.bgSupport);
in
{
# Note: the order in which desktop manager modules are imported here
# determines the default: later modules (if enabled) are preferred.
# E.g., if KDE is enabled, it supersedes xterm.
imports = [ ./none.nix ./xterm.nix ./gnome.nix ./kde4.nix ];
options = {
services.xserver.desktopManager = {
session = mkOption {
default = [];
example = singleton
{ name = "kde";
bgSupport = true;
start = "...";
};
description = "
Internal option used to add some common line to desktop manager
scripts before forwarding the value to the
<varname>displayManager</varname>.
";
apply = list: {
list = map (d: d // {
manage = "desktop";
start = d.start
+ optionalString (needBGCond d) ''
if test -e $HOME/.background-image; then
${pkgs.feh}/bin/feh --bg-scale $HOME/.background-image
fi
'';
}) list;
needBGPackages = [] != filter needBGCond list;
};
};
default = mkOption {
default = "";
example = "none";
description = "Default desktop manager loaded if none have been chosen.";
merge = mergeOneOption;
apply = defaultDM:
if defaultDM == "" && cfg.session.list != [] then
(head cfg.session.list).name
else if any (w: w.name == defaultDM) cfg.session.list then
defaultDM
else
throw "Default desktop manager ($(defaultDM)) not found.";
};
};
};
config = {
services.xserver.displayManager.session = cfg.session.list;
environment.x11Packages =
mkIf cfg.session.needBGPackages [ pkgs.feh ];
};
}