diff --git a/modules/misc/check-config.nix b/modules/misc/check-config.nix index e2cd2c06d6a..28f36ad9ae5 100644 --- a/modules/misc/check-config.nix +++ b/modules/misc/check-config.nix @@ -1,11 +1,13 @@ {pkgs, ...}: { - environment.checkConfigurationOptions = pkgs.lib.mkOption { - default = true; - example = false; - description = '' - Whether to check the validity of the entire configuration. - ''; + options = { + environment.checkConfigurationOptions = pkgs.lib.mkOption { + default = true; + example = false; + description = '' + Whether to check the validity of the entire configuration. + ''; + }; }; -} \ No newline at end of file +} diff --git a/modules/services/x11/desktop-managers/default.nix b/modules/services/x11/desktop-managers/default.nix index c40266f99d7..a775684b47d 100644 --- a/modules/services/x11/desktop-managers/default.nix +++ b/modules/services/x11/desktop-managers/default.nix @@ -11,7 +11,7 @@ let in { - require = [ + imports = [ ./kde.nix ./kde4.nix ./gnome.nix @@ -19,58 +19,56 @@ in ./none.nix ]; - services = { - xserver = { - displayManager = { - session = cfg.session.list; - }; + options = { + services.xserver.desktopManager = { - 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 - displayManager. - "; - 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 = mergeOneOption; - apply = defaultDM: - if any (w: w.name == defaultDM) cfg.session.list then - defaultDM - else - throw "Default desktop manager ($(defaultDM)) not found."; + 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 + displayManager. + "; + 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 = mergeOneOption; + apply = defaultDM: + if any (w: w.name == defaultDM) cfg.session.list then + defaultDM + else + throw "Default desktop manager ($(defaultDM)) not found."; + }; + }; }; - environment = mkIf cfg.session.needBGPackages { - x11Packages = [ pkgs.feh ]; + config = { + services.xserver.displayManager.session = cfg.session.list; + environment.x11Packages = + mkIf cfg.session.needBGPackages [ pkgs.feh ]; }; } diff --git a/modules/services/x11/window-managers/default.nix b/modules/services/x11/window-managers/default.nix index 0295d9893d8..801517fdd98 100644 --- a/modules/services/x11/window-managers/default.nix +++ b/modules/services/x11/window-managers/default.nix @@ -6,7 +6,7 @@ let in { - require = [ + imports = [ ./compiz.nix ./kwm.nix ./metacity.nix @@ -16,43 +16,43 @@ in ./xmonad.nix ]; - services = { - xserver = { - displayManager = { - session = cfg.session; + options = { + services.xserver.windowManager = { + + session = mkOption { + default = []; + example = [{ + name = "wmii"; + start = "..."; + }]; + description = " + Internal option used to add some common line to window manager + scripts before forwarding the value to the + displayManager. + "; + apply = map (d: d // { + manage = "window"; + }); }; - windowManager = { - session = mkOption { - default = []; - example = [{ - name = "wmii"; - start = "..."; - }]; - description = " - Internal option used to add some common line to window manager - scripts before forwarding the value to the - displayManager. - "; - apply = map (d: d // { - manage = "window"; - }); - }; - - default = mkOption { - default = "none"; - example = "wmii"; - description = " - Default window manager loaded if none have been chosen. - "; - merge = mergeOneOption; - apply = defaultWM: - if any (w: w.name == defaultWM) cfg.session then - defaultWM - else - throw "Default window manager (${defaultWM}) not found."; - }; + default = mkOption { + default = "none"; + example = "wmii"; + description = " + Default window manager loaded if none have been chosen. + "; + merge = mergeOneOption; + apply = defaultWM: + if any (w: w.name == defaultWM) cfg.session then + defaultWM + else + throw "Default window manager (${defaultWM}) not found."; }; + }; }; + + config = { + services.xserver.displayManager.session = cfg.session; + }; } diff --git a/modules/services/x11/window-managers/xmonad.nix b/modules/services/x11/window-managers/xmonad.nix index 3d2df59655a..2cbb5002d6c 100644 --- a/modules/services/x11/window-managers/xmonad.nix +++ b/modules/services/x11/window-managers/xmonad.nix @@ -6,27 +6,25 @@ let in { - services = { - xserver = { - - windowManager = { - xmonad = { - enable = mkOption { - default = false; - example = true; - description = "Enable the xmonad window manager."; - }; - }; - - session = mkIf cfg.enable [{ - name = "xmonad"; - start = " - ${pkgs.haskellPackages.xmonad}/bin/xmonad & - waitPID=$! - "; - }]; + options = { + services.xserver.windowManager.xmonad = { + enable = mkOption { + default = false; + example = true; + description = "Enable the xmonad window manager."; }; + }; + }; + config = { + services.xserver.windowManager = { + session = mkIf cfg.enable [{ + name = "xmonad"; + start = " + ${pkgs.haskellPackages.xmonad}/bin/xmonad & + waitPID=$! + "; + }]; }; }; }