refactor(system): fix conflicts between desktop environment login managers

This commit is contained in:
Andre 2024-06-29 12:23:26 -04:00
parent 934ad9f7d7
commit 3b0a0ef579
8 changed files with 61 additions and 33 deletions

View file

@ -116,7 +116,7 @@ in
# Enable the KDE desktop environment. # Enable the KDE desktop environment.
# https://kde.org/ # https://kde.org/
kde.enable = false; kde.useX11 = false;
# Enable the XFCE desktop environment. # Enable the XFCE desktop environment.
# https://xfce.org/ # https://xfce.org/

View file

@ -49,8 +49,8 @@ in
# Enable systemd for TPM auto-unlocking # Enable systemd for TPM auto-unlocking
systemd.enable = true; systemd.enable = true;
availableKernelModules = [ "tpm_crb"]; availableKernelModules = [ "tpm_crb" ];
kernelModules = ["tpm_crb"]; kernelModules = [ "tpm_crb" ];
}; };
# After installing and rebooting, set it up via https://wiki.archlinux.org/title/Systemd-cryptenroll#Trusted_Platform_Module # After installing and rebooting, set it up via https://wiki.archlinux.org/title/Systemd-cryptenroll#Trusted_Platform_Module
environment.systemPackages = with pkgs; [ tpm2-tss ]; environment.systemPackages = with pkgs; [ tpm2-tss ];

View file

@ -18,6 +18,9 @@ in
}; };
}; };
config = { config = {
# Install the latest kernel
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
# Set up the environment # Set up the environment
environment = { environment = {
# Install base packages # Install base packages

View file

@ -16,17 +16,18 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
aux.system.ui.desktops.enable = true; aux.system.ui.desktops = {
enable = true;
displayManager = lib.mkOptionDefault "lightdm";
};
services.xserver = { services.xserver = {
enable = true; enable = true;
desktopManager.budgie.enable = true; desktopManager.budgie.enable =
displayManager.lightdm.enable = lib.mkIf ( if config.services.xserver.desktopManager.gnome.enable then
!( builtins.abort "Budgie and Gnome cannot be enabled at the same time due to a bug. For details and a possible workaround, please see https://discourse.nixos.org/t/help-i-cant-have-pantheon-gnome-and-plasma-installed-on-my-system-at-the-same-time/47346"
config.services.xserver.displayManager.gdm.enable else
|| config.services.xserver.displayManager.sddm.enable true;
)
) true;
}; };
}; };
} }

View file

@ -21,6 +21,15 @@ in
variant = ""; variant = "";
}; };
}; };
displayManager = lib.mkOption {
description = "The display manager to use to start a desktop session.";
type = lib.types.enum [
"gdm"
"lightdm"
"sddm"
"sddm_wayland"
];
};
}; };
}; };
@ -49,6 +58,17 @@ in
# Configure keymap in X11 # Configure keymap in X11
xkb = config.aux.system.ui.desktops.xkb; xkb = config.aux.system.ui.desktops.xkb;
# Set the display manager
displayManager = {
gdm.enable = (cfg.displayManager == "gdm");
lightdm.enable = (cfg.displayManager == "lightdm");
};
};
displayManager = {
sddm.enable = (cfg.displayManager == "sddm");
sddm.wayland.enable = (cfg.displayManager == "sddm_wayland");
}; };
# Enable touchpad support (enabled by default in most desktop managers, buuuut just in case). # Enable touchpad support (enabled by default in most desktop managers, buuuut just in case).

View file

@ -16,15 +16,17 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
aux.system.ui.desktops.enable = true; aux.system.ui.desktops = {
enable = true;
displayManager = lib.mkOverride 500 "gdm";
};
# Enable Gnome # Enable Gnome
services.xserver = { services.xserver = {
# Remove default packages that came with the install # Remove default packages that came with the install
excludePackages = [ pkgs.xterm ]; excludePackages = [ pkgs.xterm ];
desktopManager.gnome.enable = true; desktopManager.gnome.enable = lib.mkDefault true;
displayManager.gdm.enable = true;
}; };
environment = { environment = {
@ -44,6 +46,9 @@ in
]; ];
}; };
# Manually set askPassword to avoid a conflict with KDE
programs.ssh.askPassword = "${pkgs.gnome.seahorse}/libexec/seahorse/ssh-askpass";
# Gnome UI integration for KDE apps # Gnome UI integration for KDE apps
qt = { qt = {
enable = true; enable = true;

View file

@ -18,7 +18,10 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
aux.system.ui.desktops.enable = true; aux.system.ui.desktops = {
enable = true;
displayManager = if cfg.useX11 then lib.mkDefault "sddm" else lib.mkDefault "sddm_wayland";
};
programs.dconf.enable = true; programs.dconf.enable = true;
@ -30,18 +33,9 @@ in
}; };
services = { services = {
displayManager.sddm.enable = true;
desktopManager.plasma6.enable = true; desktopManager.plasma6.enable = true;
xserver.displayManager = lib.mkIf cfg.useX11 { xserver.displayManager = lib.mkIf cfg.useX11 { defaultSession = "plasmaX11"; };
defaultSession = "plasmaX11";
sddm.wayland.enable = lib.mkIf (
!(
config.services.xserver.displayManager.gdm.enable
|| config.services.xserver.displayManager.lightdm.enable
)
) true;
};
}; };
# Enable Gnome integration # Enable Gnome integration

View file

@ -16,15 +16,20 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
aux.system.ui.desktops.enable = true; aux.system.ui.desktops = {
services.xserver = {
enable = true; enable = true;
desktopManager = { displayManager = lib.mkOptionDefault "lightdm";
xterm.enable = false; };
xfce.enable = true;
}; services = {
displayManager.defaultSession = "xfce"; displayManager.defaultSession = "xfce";
xserver = {
enable = true;
desktopManager = {
xterm.enable = false;
xfce.enable = true;
};
};
}; };
}; };
} }