nixpkgs/upstart-jobs/xserver/desktopManager/default.nix
Nicolas Pierron b2b6f92d6b Split xserver upstart job into:
- xserver configuration & job
- display manager (slim)
- window manager (compiz, kwm, metacity, twm, wmii, xmonad)
- desktop manager (kde, gnome, xterm)

Added features:
- Add WM choice in slim (with F1)

svn path=/nixos/branches/fix-style/; revision=13857
2009-01-25 15:49:08 +00:00

77 lines
1.9 KiB
Nix

{pkgs, config, ...}:
let
inherit (builtins) head tail;
inherit (pkgs.lib) mkOption mkIf filter optionalString any;
cfg = config.services.xserver.desktopManager;
needBGCond = d: ! (d ? bgSupport && d.bgSupport);
in
{
require = [
(import ./kde.nix)
(import ./gnome.nix)
(import ./xterm.nix)
(import ./none.nix)
];
services = {
xserver = {
displayManager = {
session = cfg.session.list;
};
desktopManager = {
session = mkOption {
default = [];
example = [{
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 = "xterm";
example = "none";
description = "
Default desktop manager loaded if none have been chosen.
";
merge = name: list:
let defaultDM = head list; in
if tail list != [] then
throw "Only one default desktop manager is allowed."
else if any (w: w.name == defaultDM) cfg.session.list then
defaultDM
else
throw "Default desktop manager not found.";
};
};
};
};
environment = mkIf cfg.session.needBGPackages {
extraPackages = [ pkgs.feh ];
};
}