539fb26791
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CfozKLQdUh5TzqyjSigLUx
2.5 KiB
2.5 KiB
mibook: choose terminal-only vs desktop at boot
Goal
Let mibook boot to a text console by default, with KDE fully installed and launchable on demand. The user decides after boot whether they need the graphical desktop, without rebuilding the system.
Behavior
- mibook boots to a text console (
multi-user.target). SDDM and Plasma do not start automatically. - KDE (SDDM + Plasma 6) remains fully installed.
- Running
desktopin the terminal starts the SDDM display manager, which presents the graphical login screen; logging in there enters a Plasma 6 session. - No reverse command. To return to a text console, stop the display manager
(
sudo systemctl stop display-manager) or reboot. - Other machines that enable the
kde-desktopprofile are unaffected; their desktop still starts on boot.
Implementation
modules/environments/kde-desktop/default.nix
Add an opt-out option to the existing profile:
- New option
my.profiles.kde-desktop.startOnBoot, a boolean defaulting totrue. The default preserves the current behavior for every consumer. - The existing
configblock (SDDM, Plasma 6, user packages) stays enabled whenever the profile is enabled, regardless ofstartOnBoot. - When
startOnBoot = false, additionally apply:systemd.services.display-manager.wantedBy = lib.mkForce [ ];so SDDM is defined but not pulled in by any boot target.systemd.defaultUnit = "multi-user.target";so the boot target is the text console.- A
desktopcommand provided viapkgs.writeShellScriptBin "desktop" "exec sudo systemctl start display-manager.service", added toenvironment.systemPackages.
machines/mibook/environments.nix
Set kde-desktop.startOnBoot = false; alongside the existing
kde-desktop.enable = true;.
Testing / verification
nix build '.#nixosConfigurations.mibook.config.system.build.toplevel'builds without error.- After
nixos-rebuild switchon mibook: system boots to a TTY, no SDDM; runningdesktopbrings up the SDDM login and a working Plasma session. - Confirm jupiter (or any non-mibook consumer) is unchanged: its evaluated
systemd.defaultUnit/ display-manager wantedBy are not altered.
Trade-offs
desktoprelies onsudo; the user has sudo access, so no extra configuration is required.- Chose "boot to terminal, launch on demand" over a GRUB boot-menu entry because it is more robust across NixOS generations and needs no fragile static kernel entries.