nixos/displayManager: introduce defaultSession
There's two ways of providing graphical sessions now: - `displayManager.session` via. `desktopManager.session` and `windowManager.session` - `displayManager.sessionPackages` `sessionPackages` doesn't make a distinction between desktop and window managers. This makes selecting a session provided by a package using `desktopManager.default` nonsensical. We therefor introduce `displayManager.defaultSession` which can select a session from either `displayManager.session` or `displayManager.sessionPackages`. It will default to `desktopManager.default + windowManager.default` as before. If the dm default is "none" it will select the first provided session from `sessionPackages`.
This commit is contained in:
parent
58e5290fce
commit
d25365c3c1
|
@ -96,13 +96,13 @@ in
|
||||||
else if any (w: w.name == defaultDM) cfg.session.list then
|
else if any (w: w.name == defaultDM) cfg.session.list then
|
||||||
defaultDM
|
defaultDM
|
||||||
else
|
else
|
||||||
builtins.trace ''
|
throw ''
|
||||||
Default desktop manager (${defaultDM}) not found at evaluation time.
|
Default desktop manager (${defaultDM}) not found.
|
||||||
These are the known valid session names:
|
Probably you want to change
|
||||||
|
services.xserver.desktopManager.default = "${defaultDM}";
|
||||||
|
to one of
|
||||||
${concatMapStringsSep "\n " (w: "services.xserver.desktopManager.default = \"${w.name}\";") cfg.session.list}
|
${concatMapStringsSep "\n " (w: "services.xserver.desktopManager.default = \"${w.name}\";") cfg.session.list}
|
||||||
It's also possible the default can be found in one of these packages:
|
'';
|
||||||
${concatMapStringsSep "\n " (p: p.name) config.services.xserver.displayManager.sessionPackages}
|
|
||||||
'' defaultDM;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,9 +81,7 @@ in
|
||||||
|
|
||||||
services.xserver.displayManager.lightdm.greeters.pantheon.enable = mkDefault true;
|
services.xserver.displayManager.lightdm.greeters.pantheon.enable = mkDefault true;
|
||||||
|
|
||||||
# If not set manually Pantheon session cannot be started
|
services.xserver.displayManager.defaultSession = "pantheon";
|
||||||
# Known issue of https://github.com/NixOS/nixpkgs/pull/43992
|
|
||||||
services.xserver.desktopManager.default = mkForce "pantheon";
|
|
||||||
|
|
||||||
services.xserver.displayManager.sessionCommands = ''
|
services.xserver.displayManager.sessionCommands = ''
|
||||||
if test "$XDG_CURRENT_DESKTOP" = "Pantheon"; then
|
if test "$XDG_CURRENT_DESKTOP" = "Pantheon"; then
|
||||||
|
|
|
@ -327,6 +327,37 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defaultSession = mkOption {
|
||||||
|
type = with types; str // {
|
||||||
|
description = "session name";
|
||||||
|
check = d: let
|
||||||
|
sessionNames = cfg.displayManager.session.names ++
|
||||||
|
(concatMap (p: p.providedSessions) cfg.displayManager.sessionPackages);
|
||||||
|
in
|
||||||
|
assertMsg (str.check d && (d == "none" || (elem d sessionNames))) ''
|
||||||
|
Default graphical session, '${d}', not found.
|
||||||
|
Valid names for 'services.xserver.displayManager.defaultSession' are:
|
||||||
|
${concatStringsSep "\n " sessionNames}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
default = let
|
||||||
|
dmDefault = cfg.desktopManager.default;
|
||||||
|
wmDefault = cfg.windowManager.default;
|
||||||
|
defaultPackage =
|
||||||
|
if cfg.displayManager.sessionPackages != [] then
|
||||||
|
(head (head cfg.displayManager.sessionPackages).providedSessions)
|
||||||
|
else
|
||||||
|
null;
|
||||||
|
defaultDmWm = dmDefault + optionalString (wmDefault != "none") ("+" + wmDefault);
|
||||||
|
in
|
||||||
|
if defaultDmWm == "none" && isString defaultPackage then
|
||||||
|
defaultPackage
|
||||||
|
else
|
||||||
|
defaultDmWm;
|
||||||
|
example = "gnome";
|
||||||
|
description = "Default graphical session (only effective for LightDM and SDDM).";
|
||||||
|
};
|
||||||
|
|
||||||
job = {
|
job = {
|
||||||
|
|
||||||
preStart = mkOption {
|
preStart = mkOption {
|
||||||
|
|
|
@ -9,9 +9,8 @@ let
|
||||||
xEnv = config.systemd.services.display-manager.environment;
|
xEnv = config.systemd.services.display-manager.environment;
|
||||||
cfg = dmcfg.lightdm;
|
cfg = dmcfg.lightdm;
|
||||||
|
|
||||||
dmDefault = xcfg.desktopManager.default;
|
defaultSessionName = dmcfg.defaultSession;
|
||||||
wmDefault = xcfg.windowManager.default;
|
hasDefaultUserSession = defaultSessionName != "none";
|
||||||
hasDefaultUserSession = dmDefault != "none" || wmDefault != "none";
|
|
||||||
|
|
||||||
inherit (pkgs) lightdm writeScript writeText;
|
inherit (pkgs) lightdm writeScript writeText;
|
||||||
|
|
||||||
|
@ -71,7 +70,6 @@ let
|
||||||
${cfg.extraSeatDefaults}
|
${cfg.extraSeatDefaults}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
defaultSessionName = dmDefault + optionalString (wmDefault != "none") ("+" + wmDefault);
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Note: the order in which lightdm greeter modules are imported
|
# Note: the order in which lightdm greeter modules are imported
|
||||||
|
@ -199,7 +197,7 @@ in
|
||||||
LightDM auto-login requires services.xserver.displayManager.lightdm.autoLogin.user to be set
|
LightDM auto-login requires services.xserver.displayManager.lightdm.autoLogin.user to be set
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{ assertion = cfg.autoLogin.enable -> dmDefault != "none" || wmDefault != "none";
|
{ assertion = cfg.autoLogin.enable -> hasDefaultUserSession;
|
||||||
message = ''
|
message = ''
|
||||||
LightDM auto-login requires that services.xserver.desktopManager.default and
|
LightDM auto-login requires that services.xserver.desktopManager.default and
|
||||||
services.xserver.windowManager.default are set to valid values. The current
|
services.xserver.windowManager.default are set to valid values. The current
|
||||||
|
|
|
@ -71,11 +71,7 @@ let
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
defaultSessionName =
|
defaultSessionName = dmcfg.defaultSession;
|
||||||
let
|
|
||||||
dm = xcfg.desktopManager.default;
|
|
||||||
wm = xcfg.windowManager.default;
|
|
||||||
in dm + optionalString (wm != "none") ("+" + wm);
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -210,7 +206,7 @@ in
|
||||||
SDDM auto-login requires services.xserver.displayManager.sddm.autoLogin.user to be set
|
SDDM auto-login requires services.xserver.displayManager.sddm.autoLogin.user to be set
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{ assertion = cfg.autoLogin.enable -> elem defaultSessionName dmcfg.session.names;
|
{ assertion = cfg.autoLogin.enable -> defaultSessionName != "none";
|
||||||
message = ''
|
message = ''
|
||||||
SDDM auto-login requires that services.xserver.desktopManager.default and
|
SDDM auto-login requires that services.xserver.desktopManager.default and
|
||||||
services.xserver.windowManager.default are set to valid values. The current
|
services.xserver.windowManager.default are set to valid values. The current
|
||||||
|
|
|
@ -16,7 +16,7 @@ import ./make-test.nix ({ pkgs, ...} : {
|
||||||
services.xserver.displayManager.lightdm.autoLogin.enable = true;
|
services.xserver.displayManager.lightdm.autoLogin.enable = true;
|
||||||
services.xserver.displayManager.lightdm.autoLogin.user = "alice";
|
services.xserver.displayManager.lightdm.autoLogin.user = "alice";
|
||||||
services.xserver.desktopManager.gnome3.enable = true;
|
services.xserver.desktopManager.gnome3.enable = true;
|
||||||
services.xserver.desktopManager.default = "gnome-xorg";
|
services.xserver.displayManager.defaultSession = "gnome-xorg";
|
||||||
|
|
||||||
virtualisation.memorySize = 1024;
|
virtualisation.memorySize = 1024;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue