From 539fb26791ccf879ad5fc9e2fc7ac4ee6e083fe1 Mon Sep 17 00:00:00 2001 From: "Finn@MiBook" Date: Mon, 27 Jul 2026 09:27:37 +0200 Subject: [PATCH 1/2] docs: spec for mibook boot-time terminal/desktop choice Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01CfozKLQdUh5TzqyjSigLUx --- ...07-27-mibook-boot-desktop-choice-design.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 docs/superpowers/specs/2026-07-27-mibook-boot-desktop-choice-design.md diff --git a/docs/superpowers/specs/2026-07-27-mibook-boot-desktop-choice-design.md b/docs/superpowers/specs/2026-07-27-mibook-boot-desktop-choice-design.md new file mode 100644 index 0000000..d12d7fb --- /dev/null +++ b/docs/superpowers/specs/2026-07-27-mibook-boot-desktop-choice-design.md @@ -0,0 +1,61 @@ +# 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 `desktop` in 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-desktop` profile 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 to + `true`. The default preserves the current behavior for every consumer. +- The existing `config` block (SDDM, Plasma 6, user packages) stays enabled + whenever the profile is enabled, regardless of `startOnBoot`. +- 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 `desktop` command provided via + `pkgs.writeShellScriptBin "desktop" "exec sudo systemctl start display-manager.service"`, + added to `environment.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 switch` on mibook: system boots to a TTY, no SDDM; + running `desktop` brings 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 + +- `desktop` relies on `sudo`; 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. From 7e4407a1f8865d0fb120d5dc951001761b012c18 Mon Sep 17 00:00:00 2001 From: "Finn@MiBook" Date: Mon, 27 Jul 2026 09:48:13 +0200 Subject: [PATCH 2/2] feat(mibook): boot to terminal, launch KDE on demand Add my.profiles.kde-desktop.startOnBoot (default true, no change for existing consumers). When false, boot to multi-user.target, keep SDDM out of any boot target's wants, and provide a 'desktop' command that starts the display manager on demand. Enable this on mibook. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01CfozKLQdUh5TzqyjSigLUx --- machines/mibook/environments.nix | 1 + modules/environments/kde-desktop/default.nix | 42 +++++++++++++++----- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/machines/mibook/environments.nix b/machines/mibook/environments.nix index 8581e93..51108b8 100644 --- a/machines/mibook/environments.nix +++ b/machines/mibook/environments.nix @@ -6,6 +6,7 @@ in { my.profiles = { kde-desktop.enable = true; + kde-desktop.startOnBoot = false; zsh.enable = true; apps = { desktop_apps = true; diff --git a/modules/environments/kde-desktop/default.nix b/modules/environments/kde-desktop/default.nix index fed26ef..1598ad7 100644 --- a/modules/environments/kde-desktop/default.nix +++ b/modules/environments/kde-desktop/default.nix @@ -11,17 +11,37 @@ in { options.my.profiles.kde-desktop = with lib; { enable = mkEnableOption "KDE Desktop Environment"; + startOnBoot = mkOption { + type = types.bool; + default = true; + description = '' + Whether the display manager (SDDM) starts automatically at boot. + When false, the system boots to a text console and KDE can be + launched on demand with the `desktop` command. + ''; + }; }; - config = lib.mkIf cfg.enable { - services = { - displayManager.sddm.enable = true; - displayManager.sddm.wayland.enable = true; - desktopManager.plasma6.enable = true; - }; - users.users.finn.packages = with pkgs; [ - # Programms can be added here... - numix-icon-theme - ]; - }; + config = lib.mkIf cfg.enable (lib.mkMerge [ + { + services = { + displayManager.sddm.enable = true; + displayManager.sddm.wayland.enable = true; + desktopManager.plasma6.enable = true; + }; + users.users.finn.packages = with pkgs; [ + # Programms can be added here... + numix-icon-theme + ]; + } + (lib.mkIf (!cfg.startOnBoot) { + # Boot to a text console; SDDM stays installed but is not pulled in + # by any boot target. Launch KDE on demand with `desktop`. + systemd.services.display-manager.wantedBy = lib.mkForce [ ]; + systemd.defaultUnit = lib.mkForce "multi-user.target"; + environment.systemPackages = [ + (pkgs.writeShellScriptBin "desktop" "exec sudo systemctl start display-manager.service") + ]; + }) + ]); } \ No newline at end of file