Replace extraPackages by x11Packages for all windows/desktop managers.

-> No longer install graphical packages if the xserver is disabled.
-> avoid duplication of "mkIf config.services.xserver.enable".

svn path=/nixos/branches/modular-nixos/; revision=16044
This commit is contained in:
Nicolas Pierron 2009-06-25 22:08:03 +00:00
parent b701207ead
commit 6e802e5d75
12 changed files with 38 additions and 23 deletions

View File

@ -277,6 +277,15 @@ let
}; };
}; };
environment.x11Packages = mkOption {
default = [];
type = types.list types.packages;
description = "
List of packages added to the system when the xserver is
activated. (<option>services.xserver.enable</option>).
";
};
}; };
in in
@ -505,7 +514,7 @@ mkIf cfg.enable {
} }
]; ];
extraPackages = [ x11Packages = [
xorg.xrandr xorg.xrandr
xorg.xrdb xorg.xrdb
xorg.setxkbmap xorg.setxkbmap
@ -514,6 +523,8 @@ mkIf cfg.enable {
++ optional (videoDriver == "nvidia") [ ++ optional (videoDriver == "nvidia") [
kernelPackages.nvidia_x11 kernelPackages.nvidia_x11
]; ];
extraPackages = config.environment.x11Packages;
}; };
services = { services = {

View File

@ -2,7 +2,8 @@
let let
inherit (pkgs.lib) mkOption mergeOneOption mkIf filter optionalString any; inherit (pkgs.lib) mkOption mergeOneOption mkIf filter optionalString any;
cfg = config.services.xserver.desktopManager; xcfg = config.services.xserver;
cfg = xcfg.desktopManager;
# Whether desktop manager `d' is capable of setting a background. # Whether desktop manager `d' is capable of setting a background.
# If it isn't, the `feh' program is used as a fallback. # If it isn't, the `feh' program is used as a fallback.
@ -69,7 +70,7 @@ in
}; };
}; };
environment = mkIf (config.services.xserver.enable && cfg.session.needBGPackages) { environment = mkIf cfg.session.needBGPackages {
extraPackages = [ pkgs.feh ]; x11Packages = [ pkgs.feh ];
}; };
} }

View File

@ -38,7 +38,7 @@ mkIf cfg.enable {
}; };
environment = { environment = {
extraPackages = [ x11Packages = [
gnome.gnometerminal gnome.gnometerminal
gnome.GConf gnome.GConf
gnome.gconfeditor gnome.gconfeditor

View File

@ -1,7 +1,7 @@
{pkgs, config, ...}: {pkgs, config, ...}:
let let
inherit (pkgs.lib) mkOption mkIf; inherit (pkgs.lib) mkOption mkIf types;
kdePackages = config.environment.kdePackages; kdePackages = config.environment.kdePackages;
options = { options = {
@ -25,6 +25,7 @@ let
kdePackages = mkOption { kdePackages = mkOption {
default = []; default = [];
example = [ pkgs.kde42.kdegames ]; example = [ pkgs.kde42.kdegames ];
type = types.list types.packages;
description = '' description = ''
Additional KDE packages to be used when you use KDE as a desktop Additional KDE packages to be used when you use KDE as a desktop
manager. By default, you only get the KDE base packages. manager. By default, you only get the KDE base packages.
@ -36,11 +37,11 @@ let
}; };
in in
mkIf (kdePackages != []) { mkIf (kdePackages != [] && config.services.xserver.enable) {
require = options; require = options;
environment = { environment = {
extraPackages = kdePackages; x11Packages = kdePackages;
shellInit = '' shellInit = ''
export KDEDIRS="${pkgs.lib.concatStringsSep ":" kdePackages}" export KDEDIRS="${pkgs.lib.concatStringsSep ":" kdePackages}"

View File

@ -2,8 +2,9 @@
let let
inherit (pkgs.lib) mkOption mkIf; inherit (pkgs.lib) mkOption mkIf;
cfg = config.services.xserver.desktopManager.kde; xcfg = config.services.xserver;
xorg = config.services.xserver.package; cfg = xcfg.desktopManager.kde;
xorg = xcfg.package;
options = { services = { xserver = { desktopManager = { options = { services = { xserver = { desktopManager = {
@ -18,7 +19,7 @@ let
}; }; }; }; }; }; }; };
in in
mkIf cfg.enable { mkIf (xcfg.enable && cfg.enable) {
require = [ require = [
options options
@ -63,7 +64,7 @@ mkIf cfg.enable {
pkgs.kdebase pkgs.kdebase
]; ];
extraPackages = [ x11Packages = [
xorg.xset # used by startkde, non-essential xorg.xset # used by startkde, non-essential
]; ];

View File

@ -2,8 +2,9 @@
let let
inherit (pkgs.lib) mkOption mkIf; inherit (pkgs.lib) mkOption mkIf;
cfg = config.services.xserver.desktopManager.kde4; xcfg = config.services.xserver;
xorg = config.services.xserver.package; cfg = xcfg.desktopManager.kde4;
xorg = xcfg.package;
options = { services = { xserver = { desktopManager = { options = { services = { xserver = { desktopManager = {
@ -18,7 +19,7 @@ let
}; }; }; }; }; }; }; };
in in
mkIf cfg.enable { mkIf (xcfg.enable && cfg.enable) {
require = [ require = [
options options
@ -57,7 +58,7 @@ mkIf cfg.enable {
pkgs.shared_mime_info pkgs.shared_mime_info
]; ];
extraPackages = [ x11Packages = [
xorg.xmessage # so that startkde can show error messages xorg.xmessage # so that startkde can show error messages
pkgs.qt4 # needed for qdbus pkgs.qt4 # needed for qdbus
xorg.xset # used by startkde, non-essential xorg.xset # used by startkde, non-essential

View File

@ -17,7 +17,7 @@ let
in in
mkIf (config.services.xserver.enable && cfg.enable) { mkIf cfg.enable {
require = options; require = options;
services = { services = {
@ -37,7 +37,7 @@ mkIf (config.services.xserver.enable && cfg.enable) {
}; };
environment = { environment = {
extraPackages = [ x11Packages = [
pkgs.xterm pkgs.xterm
]; ];
}; };

View File

@ -59,6 +59,6 @@ mkIf cfg.enable {
}; };
environment = { environment = {
extraPackages = [ pkgs.compiz ]; x11Packages = [ pkgs.compiz ];
}; };
} }

View File

@ -38,7 +38,7 @@ mkIf cfg.enable {
}; };
environment = { environment = {
extraPackages = [ x11Packages = [
pkgs.kdelibs pkgs.kdelibs
pkgs.kdebase pkgs.kdebase
]; ];

View File

@ -44,6 +44,6 @@ mkIf cfg.enable {
}; };
environment = { environment = {
extraPackages = [ gnome.metacity ]; x11Packages = [ gnome.metacity ];
}; };
} }

View File

@ -39,6 +39,6 @@ mkIf cfg.enable {
}; };
environment = { environment = {
extraPackages = [ xorg.twm ]; x11Packages = [ xorg.twm ];
}; };
} }

View File

@ -47,7 +47,7 @@ mkIf cfg.enable {
}; };
environment = { environment = {
extraPackages = [ x11Packages = [
pkgs.wmiiSnap pkgs.wmiiSnap
]; ];
}; };