From ed9d512d093735f5d35d21424fdf987b85cba969 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Tue, 8 Sep 2026 16:06:49 -0400 Subject: [PATCH] slim down --- hosts/fwbook.nix | 10 ++- hosts/hl-fwdesk.nix | 1 + hosts/hl-fws1.nix | 47 +++++++++---- hosts/hl-pi1.nix | 1 + modules/nixos/desktop/ABOUTME.md | 25 ++++--- modules/nixos/desktop/default.nix | 81 +++++++++++++++++------ modules/nixos/desktop/packages.nix | 38 ----------- modules/nixos/desktop/tiler/ABOUTME.md | 20 +++++- modules/nixos/desktop/tiler/default.nix | 68 +++++++++++-------- modules/nixos/desktop/tiler/hyprland.nix | 14 ++-- modules/nixos/desktop/wayland.nix | 20 ------ modules/nixos/desktop/x11/ABOUTME.md | 30 --------- modules/nixos/desktop/x11/default.nix | 16 ----- modules/nixos/desktop/x11/lib-gesture.nix | 24 ------- modules/openwrt-routers/ABOUTME.md | 33 +++++++++ modules/openwrt-routers/glmain.nix | 8 +++ 16 files changed, 228 insertions(+), 208 deletions(-) delete mode 100644 modules/nixos/desktop/packages.nix delete mode 100644 modules/nixos/desktop/wayland.nix delete mode 100644 modules/nixos/desktop/x11/ABOUTME.md delete mode 100644 modules/nixos/desktop/x11/default.nix delete mode 100644 modules/nixos/desktop/x11/lib-gesture.nix create mode 100644 modules/openwrt-routers/ABOUTME.md create mode 100644 modules/openwrt-routers/glmain.nix diff --git a/hosts/fwbook.nix b/hosts/fwbook.nix index d9e3e21..f82ba2c 100644 --- a/hosts/fwbook.nix +++ b/hosts/fwbook.nix @@ -43,7 +43,15 @@ in }; tiler = { enable = true; - hyprland.enable = true; + apps = { + control.enable = true; + gnome.enable = true; + media.enable = true; + }; + hyprland = { + enable = true; + tools.enable = true; + }; noctalia.enable = true; quickshell.enable = true; niri = { diff --git a/hosts/hl-fwdesk.nix b/hosts/hl-fwdesk.nix index b49b88b..fbc0497 100644 --- a/hosts/hl-fwdesk.nix +++ b/hosts/hl-fwdesk.nix @@ -54,6 +54,7 @@ in enable = true; hyprland = { enable = true; + tools.enable = true; configLink = { enable = true; mountAsSource = true; diff --git a/hosts/hl-fws1.nix b/hosts/hl-fws1.nix index 49d8787..2d02ec2 100644 --- a/hosts/hl-fws1.nix +++ b/hosts/hl-fws1.nix @@ -1,16 +1,26 @@ -{ pkgs, ... }: +{ pkgs, config, ... }: { - skyg.user.enable = true; - skyg.nixos.common.ssh-server.enable = true; - skyg.server.dns.routing = { - enable = true; - openFirewall = true; - addressesSecretName = "dns-addresses.conf"; - }; - skyg.nixos.server.k3s.enable = true; - skyg.server.admin.enable = true; - skyg.networkDrives = { - enable = true; + skyg = { + user.enable = true; + nixos = { + common.ssh-server.enable = true; + common.hardware = { + sound.enable = true; + pipewire.enable = true; + }; + desktop = { + enable = true; + slimMode = true; + tiler = { + enable = true; + hyprland.enable = true; + hyprland.configLink = { + enable = false; + mountAsSource = true; + }; + }; + }; + }; }; # firmware updater services.fwupd.enable = true; @@ -21,6 +31,15 @@ boot.loader.efi.canTouchEfiVariables = true; boot.tmp.useTmpfs = true; - # Kernel - boot.kernelPackages = pkgs.linuxPackages_zen; + # Greeter + programs.dank-material-shell.greeter = { + enable = true; + compositor.name = "hyprland"; + configHome = "/home/${config.skyg.user.name}"; + }; + services.displayManager.autoLogin = { + enable = true; + user = config.skyg.user.name; + }; + services.displayManager.defaultSession = "hyprland"; } diff --git a/hosts/hl-pi1.nix b/hosts/hl-pi1.nix index 5558074..d9fc9ae 100644 --- a/hosts/hl-pi1.nix +++ b/hosts/hl-pi1.nix @@ -10,6 +10,7 @@ }; desktop = { enable = true; + slimMode = true; tiler = { enable = true; hyprland.enable = true; diff --git a/modules/nixos/desktop/ABOUTME.md b/modules/nixos/desktop/ABOUTME.md index 1e4fa8f..20634e5 100644 --- a/modules/nixos/desktop/ABOUTME.md +++ b/modules/nixos/desktop/ABOUTME.md @@ -8,12 +8,10 @@ have their own sub-options so a host enables only the stack it actually uses. ``` desktop/ -├── default.nix # skyg.nixos.desktop.enable — display manager, dbus, libinput, pipewire, xdg portals -├── wayland.nix # Wayland session vars (NIXOS_OZONE_WL) + clipboard/utils -├── x11/ # X11 server + libinput-gestures (skyg.nixos.desktop.x11.*) +├── default.nix # skyg.nixos.desktop.enable — display manager, dbus, pipewire, xdg portals +│ # slimMode — skip Xorg/browser/heavy desktop apps ├── tiler/ # Tiling WMs (niri / hyprland) + DankMaterialShell + swww ├── stylix/ # System-wide theming via Stylix (gruvbox-dark-hard) -├── packages.nix # Desktop apps: chromium, flatpak, vlc, ghostty, clipboard tools ├── crypto.nix # skyg.nixos.desktop.crypto — hardware wallet apps + udev rules ├── printers.nix # CUPS printing + drivers (always on when desktop enabled) ├── gnome.nix # skyg.nixos.desktop.gnome — GNOME + pop-shell @@ -25,26 +23,37 @@ desktop/ ## How it composes - `default.nix` (`skyg.nixos.desktop.enable`) provides the shared desktop substrate: display - manager, dbus, libinput, PipeWire (pulse/jack), upower, avahi, and the full xdg portal set. + manager, dbus, PipeWire (only when enabled), upower, avahi, and the XDG portal set. + Everything else is opt-in. +- `slimMode` keeps the core substrate + tiler but skips the heavy desktop apps and Xorg + (`packages.nix`/`wayland.nix`/`x11` were folded into `default.nix`; slim hosts use a + headless-style desktop such as a clock box). - The DE/WM modules (`gnome`, `kde`, `cosmic`, `tiler`) are independent enables — pick the one(s) a host should offer. -- `packages.nix`, `wayland.nix`, and `printers.nix` activate automatically with the master - desktop enable; `crypto` is a separate opt-in. +- `printers.nix` activates automatically with the master desktop enable; `crypto` is a + separate opt-in. ## Option Namespace ``` skyg.nixos.desktop.enable → default.nix (master switch) +skyg.nixos.desktop.slimMode → default.nix (minimal desktop, no Xorg/heavy apps) skyg.nixos.desktop.gnome.enable → gnome.nix skyg.nixos.desktop.kde.enable → kde.nix skyg.nixos.desktop.cosmic.enable → cosmic.nix skyg.nixos.desktop.tiler.* → tiler/ skyg.nixos.desktop.stylix.enable → stylix/ (default true) skyg.nixos.desktop.crypto.enable → crypto.nix -skyg.nixos.desktop.x11.* → x11/ skyg.nixos.desktop.fixes.* → fixes/ ``` +## Notes + +- The old `packages.nix`, `wayland.nix`, and `x11/` modules were folded into `default.nix`: + the desktop apps and Xorg/XWayland now install only in full (non-slim) mode. +- Tiler app groups (`control`, `gnome`, `media`) and Hyprland shell `tools` are opt-in — see + `tiler/ABOUTME.md`. + ## Conventions - Nothing in this tree should activate unless `skyg.nixos.desktop.enable` is set — gate new diff --git a/modules/nixos/desktop/default.nix b/modules/nixos/desktop/default.nix index b27f750..29ac9de 100644 --- a/modules/nixos/desktop/default.nix +++ b/modules/nixos/desktop/default.nix @@ -6,28 +6,8 @@ let cfg = config.skyg.nixos; skygUser = config.skyg.user; -in -{ - imports = [ - ./cosmic.nix - ./kde.nix - ./wayland.nix - ./x11 - ./packages.nix - ./crypto.nix - ./gnome.nix - ./tiler - ./stylix - ./printers.nix - ./fixes - ]; - - options = { - skyg.nixos.desktop = { - enable = lib.mkEnableOption "Enable Desktop"; - }; - }; - config = lib.mkIf cfg.desktop.enable { + coreSettings = { + environment.sessionVariables.NIXOS_OZONE_WL = "1"; users.users.${skygUser.name}.extraGroups = [ "input" "disk" @@ -39,10 +19,44 @@ in ]; services.dbus.enable = true; services.displayManager.enable = true; + }; + nonSlimSettings = { + programs.xwayland.enable = true; + services.xserver = { + enable = true; + xkb.layout = "us"; + xkb.variant = ""; + }; services.libinput.enable = true; environment.systemPackages = with pkgs; [ + # Browser + chromium + # General utils libinput + busybox + gcc + eog # image viewer + # copy to clipboard + wl-clipboard-x11 + xclip + # video + vlc + # terminal + ghostty + # useful + wayland-utils + wofi-emoji + wl-clipboard ]; + programs.chromium = { + enable = true; + enablePlasmaBrowserIntegration = true; + extensions = [ + "nngceckbapebfimnlniiiahkandclblb" # bitwarden + "gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere + "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin + ]; + }; services.avahi = { enable = true; nssmdns4 = true; @@ -69,4 +83,27 @@ in }; }; }; +in +{ + imports = [ + ./cosmic.nix + ./kde.nix + ./crypto.nix + ./gnome.nix + ./tiler + ./stylix + ./printers.nix + ./fixes + ]; + + options = { + skyg.nixos.desktop = { + enable = lib.mkEnableOption "Enable Desktop"; + slimMode = lib.mkEnableOption "Enable slim mode: skip Xorg, browsers, and heavy desktop apps."; + }; + }; + config = lib.mkMerge [ + (lib.mkIf cfg.desktop.enable coreSettings) + (lib.mkIf (cfg.desktop.enable && !cfg.desktop.slimMode) nonSlimSettings) + ]; } diff --git a/modules/nixos/desktop/packages.nix b/modules/nixos/desktop/packages.nix deleted file mode 100644 index 2cfada2..0000000 --- a/modules/nixos/desktop/packages.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.skyg.nixos.desktop; -in -{ - config = lib.mkIf cfg.enable { - # Chrome - programs.chromium = { - enable = true; - enablePlasmaBrowserIntegration = true; - extensions = [ - "nngceckbapebfimnlniiiahkandclblb" # bitwarden - "gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere - "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin - ]; - }; - # Flatpak - environment.systemPackages = (with pkgs; [ - # Browser - chromium - # General utils - busybox - gcc - eog # image viewer - - # copy to clipboard - wl-clipboard-x11 - xclip - - # video - vlc - - # terminal - ghostty - - ]); - }; -} diff --git a/modules/nixos/desktop/tiler/ABOUTME.md b/modules/nixos/desktop/tiler/ABOUTME.md index 1744d6f..c1da08a 100644 --- a/modules/nixos/desktop/tiler/ABOUTME.md +++ b/modules/nixos/desktop/tiler/ABOUTME.md @@ -23,19 +23,25 @@ tiler/ pulls in the shared substrate. You normally enable only the compositor option. - Both compositors can be enabled at once (pick the session at the greeter). - The shared substrate configures **gnome-keyring as the SSH agent** (so - `programs.ssh.startAgent = false`), enables polkit, and installs control tools - (pavucontrol, playerctl, brightnessctl, blueman) and screen-capture tools - (slurp, satty, wf-recorder). + `programs.ssh.startAgent = false`), enables polkit, and installs only the always-needed + plumbing (xwayland-satellite, libnotify, qtwebsockets, libsecret). The control apps + (pavucontrol, playerctl, brightnessctl, blueman), GNOME apps (nautilus, gnome-calendar, + seahorse, gcr), and media/capture apps (wf-recorder, mpv, mpvpaper) are opt-in via + `apps.*` so slim hosts (e.g. hl-pi1) don't pull them in. - `background` is an independent opt-in for swww + waypaper wallpaper management. ## Option Namespace ``` skyg.nixos.desktop.tiler.enable → default.nix (usually set indirectly) +skyg.nixos.desktop.tiler.apps.control.enable → default.nix (pavucontrol, playerctl, brightnessctl, blueman) +skyg.nixos.desktop.tiler.apps.gnome.enable → default.nix (nautilus, gnome-calendar, seahorse, gcr) +skyg.nixos.desktop.tiler.apps.media.enable → default.nix (wf-recorder, mpv, mpvpaper) skyg.nixos.desktop.tiler.niri.enable skyg.nixos.desktop.tiler.niri.touchscreen-gestures.enable # 3/4-finger swipes → niri actions skyg.nixos.desktop.tiler.hyprland.enable skyg.nixos.desktop.tiler.hyprland.configName # per-host config dir (default: hostName) +skyg.nixos.desktop.tiler.hyprland.tools.enable # hypridle, wofi, rofi, grim, slurp, satty skyg.nixos.desktop.tiler.noctalia.enable # standalone noctalia + config symlink skyg.nixos.desktop.tiler.noctalia.configName # per-host config dir (default: hostName) skyg.nixos.desktop.tiler.quickshell.enable # qs package + config symlink (e.g. fwbook's overview) @@ -75,6 +81,14 @@ independent of noctalia/DMS. We previously tried Hyprland overview plugins dropped as moving targets that chased Hyprland `main` and failed to build against tagged releases. Quickshell avoids the plugin-ABI churn entirely. +### Hyprland shell tools (opt-in) + +The shell/utility apps that were previously installed unconditionally with Hyprland +(hypridle, wofi, rofi, grim, slurp, satty) are now gated behind +`skyg.nixos.desktop.tiler.hyprland.tools.enable`. `wl-clipboard` stays always-on. Hosts +whose Hyprland config actually invokes these (e.g. `fwbook`) enable the flag; a pure +clock box (`hl-pi1`) does not. + ## Conventions - Don't set `tiler.enable` directly — enable a compositor and let it flip the shared switch. diff --git a/modules/nixos/desktop/tiler/default.nix b/modules/nixos/desktop/tiler/default.nix index 542c6d6..e3754c0 100644 --- a/modules/nixos/desktop/tiler/default.nix +++ b/modules/nixos/desktop/tiler/default.nix @@ -18,6 +18,17 @@ in options = { skyg.nixos.desktop.tiler = { enable = lib.mkEnableOption "Enable libraries for tiling window managers"; + apps = { + control = { + enable = lib.mkEnableOption "control apps (pavucontrol, playerctl, brightnessctl, blueman)"; + }; + gnome = { + enable = lib.mkEnableOption "GNOME apps (nautilus, gnome-calendar, seahorse, gcr)"; + }; + media = { + enable = lib.mkEnableOption "media/capture apps (wf-recorder, mpv, mpvpaper)"; + }; + }; }; }; config = lib.mkIf cfg.enable { @@ -46,32 +57,37 @@ in security.polkit.enable = true; programs.ssh.startAgent = true; - environment.systemPackages = with pkgs; [ - # Protocols and libraries - xwayland-satellite - libnotify - kdePackages.qtwebsockets + # Always-on tiler plumbing: Wayland protocols, notification lib, secrets lib. + environment.systemPackages = with pkgs; + [ + # Protocols and libraries + xwayland-satellite + libnotify + kdePackages.qtwebsockets - # Keyring / secrets - libsecret - gcr - seahorse - - # Control Tools - pavucontrol - playerctl - brightnessctl - blueman - # Apps - gnome-calendar - nautilus - # Screen capture and recording tools - satty # image annotation - slurp - wf-recorder # video capture - # Video Wallpaper - mpv - mpvpaper - ]; + # Keyring / secrets library + libsecret + ] + # App groups are opt-in so slim hosts (e.g. hl-pi1) don't pull them in. + ++ (lib.optionals cfg.apps.control.enable [ + # Control Tools + pavucontrol + playerctl + brightnessctl + blueman + ]) + ++ (lib.optionals cfg.apps.gnome.enable [ + # GNOME apps + gnome-calendar + nautilus + seahorse + gcr + ]) + ++ (lib.optionals cfg.apps.media.enable [ + # Screen capture / video wallpaper + wf-recorder + mpv + mpvpaper + ]); }; } diff --git a/modules/nixos/desktop/tiler/hyprland.nix b/modules/nixos/desktop/tiler/hyprland.nix index 7310b2c..f135cef 100644 --- a/modules/nixos/desktop/tiler/hyprland.nix +++ b/modules/nixos/desktop/tiler/hyprland.nix @@ -3,7 +3,6 @@ , pkgs , skygUtils , hyprland -, noctalia , ... }: let @@ -11,7 +10,6 @@ let system = pkgs.stdenv.hostPlatform.system; hyprlandPkg = hyprland.packages.${system}.hyprland; hyprlandPortal = hyprland.packages.${system}.xdg-desktop-portal-hyprland; - noctaliaPkg = noctalia.packages.${system}.default; # When mountAsSource is set, build a real, GC-protected copy of the hypr config # dir. The flake self-source path (skyg.rootDir) is not referenced by the system @@ -62,6 +60,9 @@ in ''; }; }; + tools = { + enable = lib.mkEnableOption "Hyprland shell tools (hypridle, wofi, rofi, grim, slurp, satty)"; + }; }; }; config = lib.mkIf cfg.enable { @@ -81,17 +82,18 @@ in extraPortals = [ hyprlandPortal ]; }; - # Shell + tools that the Hyprland session/config expect. + # wl-clipboard is always needed; the rest are opt-in so headless-style + # configs (e.g. hl-pi1) don't pull the whole shell toolchain. environment.systemPackages = with pkgs; [ - noctaliaPkg + wl-clipboard + ] ++ (lib.optionals cfg.tools.enable [ hypridle wofi rofi - wl-clipboard grim slurp satty - ] ++ (lib.optionals cfg.configLink.mountAsSource [ bakedHyprConfig ]); + ]) ++ (lib.optionals cfg.configLink.mountAsSource [ bakedHyprConfig ]); # Symlink ~/.config/hypr -> configs//hypr (host-specific). system.userActivationScripts.hyprlandConfig = lib.mkIf cfg.configLink.enable { diff --git a/modules/nixos/desktop/wayland.nix b/modules/nixos/desktop/wayland.nix deleted file mode 100644 index 1e33ba9..0000000 --- a/modules/nixos/desktop/wayland.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.skyg.nixos.desktop; -in -{ - config = lib.mkIf cfg.enable - { - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - environment.systemPackages = with pkgs; [ - wayland-utils - wofi-emoji - wl-clipboard - ]; - programs.xwayland.enable = true; - xdg.portal = { - enable = true; - xdgOpenUsePortal = true; - }; - }; -} diff --git a/modules/nixos/desktop/x11/ABOUTME.md b/modules/nixos/desktop/x11/ABOUTME.md deleted file mode 100644 index def5d84..0000000 --- a/modules/nixos/desktop/x11/ABOUTME.md +++ /dev/null @@ -1,30 +0,0 @@ -# modules/nixos/desktop/x11/ - -X11 server setup and touchpad gesture support for desktop hosts. - -## Files - -``` -x11/ -├── default.nix # Enables services.xserver (us layout) when desktop.enable is set -└── lib-gesture.nix # skyg.nixos.desktop.x11.enableLibGestures — libinput-gestures + tools -``` - -## Behaviour - -- `default.nix` enables `services.xserver` with a US keyboard layout whenever - `skyg.nixos.desktop.enable` is on (X is kept available even on Wayland-first hosts). -- `lib-gesture.nix` is an independent opt-in that installs `libinput-gestures`, `wmctrl`, - `xdotool`, adds the user to the `input` group, and symlinks - `configs/libinput-gestures.conf` into the user's `~/.config`. - -## Option Namespace - -``` -skyg.nixos.desktop.x11.enableLibGestures # default false -``` - -## Conventions - -- Gesture config is sourced from `configs/libinput-gestures.conf` via an activation symlink — - edit the config there, not in the module. diff --git a/modules/nixos/desktop/x11/default.nix b/modules/nixos/desktop/x11/default.nix deleted file mode 100644 index 6b62251..0000000 --- a/modules/nixos/desktop/x11/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.skyg.nixos.desktop; -in -{ - imports = [ - ./lib-gesture.nix - ]; - config = lib.mkIf cfg.enable { - services.xserver = { - enable = true; - xkb.layout = "us"; - xkb.variant = ""; - }; - }; -} diff --git a/modules/nixos/desktop/x11/lib-gesture.nix b/modules/nixos/desktop/x11/lib-gesture.nix deleted file mode 100644 index 7f44fbe..0000000 --- a/modules/nixos/desktop/x11/lib-gesture.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.skyg.nixos.desktop.x11; -in -{ - options = { - skyg.nixos.desktop.x11 = { - enableLibGestures = lib.mkEnableOption - "Enable Desktop"; - }; - }; - config = lib.mkIf cfg.enableLibGestures { - users.users.${config.skyg.user.name}.extraGroups = [ "input" ]; - environment.systemPackages = with pkgs; [ - # These are used to handle touchpad gestures - libinput-gestures - wmctrl - xdotool - ]; - system.userActivationScripts.hyprlandMineConfig.text = '' - ln -sfn "/home/${config.skyg.user.name}/nixos-setup/configs/libinput-gestures.conf" "$HOME/.config/libinput-gestures.conf" - ''; - }; -} diff --git a/modules/openwrt-routers/ABOUTME.md b/modules/openwrt-routers/ABOUTME.md new file mode 100644 index 0000000..db19fda --- /dev/null +++ b/modules/openwrt-routers/ABOUTME.md @@ -0,0 +1,33 @@ +# openwrt-routers/ + +Declarative OpenWrt router configurations, compiled to UCI (Unified Configuration Interface) +by the Rust-based generator in `modules/openwrt/generator/`. + +## Contents + +| File | Description | +|---|---| +| `glmain.nix` | Configuration for the `glmain` GL.iNet router (gateway at `10.0.0.1`) | + +## How It Works + +1. `glmain.nix` declares the router's network topology, firewall zones, DHCP, and DNS in Nix +2. `modules/openwrt/default.nix` passes it through the generator binary +3. `skyg openwrt` SSHes to the router and applies the generated UCI config + +## Deploying + +```bash +skyg openwrt +``` + +## Adding a New Router + +1. Create `openwrt-routers/.nix` modelled on `glmain.nix` +2. Add a `openwrt-` package output in `flake.nix` using the `openwrt` helper +3. Add a deploy target in `bin/lib/cmds.nu` + +## Notes + +- Router credentials are stored in `secrets/glmain.json.age` +- Do not hardcode passwords or PSKs in the `.nix` file — use agenix secrets diff --git a/modules/openwrt-routers/glmain.nix b/modules/openwrt-routers/glmain.nix new file mode 100644 index 0000000..4ecd45c --- /dev/null +++ b/modules/openwrt-routers/glmain.nix @@ -0,0 +1,8 @@ +{ + router = { + ip = "10.0.0.1"; + user = "root"; + }; + + configSecret = ../secrets/glmain.json.age; +}