From 6e2fa1b9e7322a026e1aa0223ab8e0f1ecccdead Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 12 Oct 2026 21:07:34 +0000 Subject: [PATCH] Port the desktop aspects: Noctalia, audio, fonts, XDG, apps Replace the T1 stubs with the real modules, ported from 030e97e without behaviour changes except the intended theme ones (DESIGN.md section 11). - noctalia: NixOS half (module, package, recommendedServices, attaches the home-manager half to the owner) and home-manager half (user service, shell settings). The noctalia flake's modules list home-manager's and nixpkgs' own `programs.noctalia` in `disabledModules`, so nothing is declared twice. The `theme` block and `font_family` are gone: Stylix's noctalia target writes the custom palette `stylix` and the shell font (Monaspace Krypton, via the override in theme/stylix.nix). - audio: PipeWire body unchanged. - fonts: coverage fonts only; the theme fonts and fontconfig defaults come from Stylix. - xdg, apps: bodies unchanged. The generated noctalia config.toml builds and passes `noctalia config validate`. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01JZ16yf4acmaSiHq81vyQ6Z --- modules/desktop/apps.nix | 26 ++++++++++++-- modules/desktop/audio.nix | 23 ++++++++++-- modules/desktop/fonts.nix | 15 ++++++-- modules/desktop/noctalia.nix | 68 ++++++++++++++++++++++++++++++++++-- modules/desktop/xdg.nix | 58 ++++++++++++++++++++++++++++-- 5 files changed, 179 insertions(+), 11 deletions(-) diff --git a/modules/desktop/apps.nix b/modules/desktop/apps.nix index b57df2e..f8b3ce8 100644 --- a/modules/desktop/apps.nix +++ b/modules/desktop/apps.nix @@ -1,4 +1,26 @@ -# STUB (T1): replaced in phase 2 +# Everyday desktop applications (home-manager). Firefox, mpv, imv and zathura +# are configured programs; mpv and zathura are also themed by Stylix +# (theme/stylix.nix). Firefox is not: Stylix would need a declared profile. { - flake.modules.homeManager.apps = { }; + flake.modules.homeManager.apps = + { pkgs, ... }: + { + programs = { + firefox.enable = true; + mpv.enable = true; + imv.enable = true; + zathura.enable = true; + }; + + home.packages = with pkgs; [ + vesktop # Discord client with working screen sharing on Wayland + telegram-desktop + file-roller + teamspeak6-client + loupe # image viewer + zenity + procps + networkmanager-openvpn + ]; + }; } diff --git a/modules/desktop/audio.nix b/modules/desktop/audio.nix index d9df3dc..ba96ba9 100644 --- a/modules/desktop/audio.nix +++ b/modules/desktop/audio.nix @@ -1,4 +1,23 @@ -# STUB (T1): replaced in phase 2 +# PipeWire as the single audio server (ALSA, PulseAudio and JACK clients). { - flake.modules.nixos.audio = { }; + flake.modules.nixos.audio = { + services = { + pipewire = { + enable = true; + alsa = { + enable = true; + # 32-bit ALSA clients: Wine/Proton games. + support32Bit = true; + }; + pulse.enable = true; + jack.enable = true; + wireplumber.enable = true; + }; + + pulseaudio.enable = false; + }; + + # Lets PipeWire take realtime scheduling for low-latency audio. + security.rtkit.enable = true; + }; } diff --git a/modules/desktop/fonts.nix b/modules/desktop/fonts.nix index 1b760e1..9eaddd9 100644 --- a/modules/desktop/fonts.nix +++ b/modules/desktop/fonts.nix @@ -1,4 +1,15 @@ -# STUB (T1): replaced in phase 2 +# Coverage fonts: scripts and symbols that the theme fonts do not have. The +# theme fonts themselves (Monaspace, Inter, Noto Serif, Noto Color Emoji) and +# the fontconfig default families come from Stylix (theme/stylix.nix, targets +# `font-packages` and `fontconfig`). { - flake.modules.nixos.fonts = { }; + flake.modules.nixos.fonts = + { pkgs, ... }: + { + fonts.packages = with pkgs; [ + noto-fonts-cjk-sans + nerd-fonts.jetbrains-mono + nerd-fonts.symbols-only + ]; + }; } diff --git a/modules/desktop/noctalia.nix b/modules/desktop/noctalia.nix index 5e5b558..f69587b 100644 --- a/modules/desktop/noctalia.nix +++ b/modules/desktop/noctalia.nix @@ -1,5 +1,67 @@ -# STUB (T1): replaced in phase 2 +# Noctalia v5 shell (bar, launcher, notifications, lock screen, wallpaper), +# both halves of one feature: +# NixOS the package and the services its panels talk to +# (NetworkManager, Bluetooth, UPower, power profiles). The user +# service is started by home-manager, so +# `programs.noctalia.systemd` stays off here. +# home-manager the user service and the shell settings. +# The NixOS half adds the home-manager half to the owner, so a host imports +# `nixos.noctalia` once. +# +# The modules come from the noctalia flake. home-manager ships its own +# `programs.noctalia` too (modules/programs/noctalia), and nixpkgs has one for +# NixOS; the flake's modules list those in `disabledModules`, so importing them +# here replaces the others and nothing is declared twice. They are imported +# only in this file (a module value imported twice declares its options twice). +# +# Colours: Stylix's `noctalia` target (theme/stylix.nix) writes the custom +# palette `stylix` and `theme.*`; the shell font comes from the same target +# (overridden to Monaspace Krypton there). So no `theme` and no `font_family` +# here. Settings are validated at build time by `noctalia config validate`, so +# only keys from the upstream schema may appear. Anything changed in the +# settings window at runtime is stored separately and overrides the file. +{ config, inputs, ... }: +let + inherit (config.meta) owner; + hmNoctalia = config.flake.modules.homeManager.noctalia; +in { - flake.modules.nixos.noctalia = { }; - flake.modules.homeManager.noctalia = { }; + flake.modules.nixos.noctalia = + { pkgs, ... }: + { + imports = [ inputs.noctalia.nixosModules.default ]; + + home-manager.users.${owner.name}.imports = [ hmNoctalia ]; + + programs.noctalia = { + enable = true; + package = pkgs.noctalia; + # NetworkManager, Bluetooth, UPower and power-profiles-daemon, which the + # shell's panels talk to. + recommendedServices.enable = true; + }; + }; + + flake.modules.homeManager.noctalia = { + imports = [ inputs.noctalia.homeModules.default ]; + + programs.noctalia = { + enable = true; + + # A user service instead of hl.exec_cmd, so it restarts on failure and + # follows graphical-session.target (managed by UWSM). + systemd.enable = true; + + settings.shell = { + telemetry_enabled = false; + + # No other polkit agent is started in the session. + polkit_agent = true; + + # Apps started from the launcher get their own systemd scope, so + # restarting the shell service does not kill them. + launch_apps_as_systemd_services = true; + }; + }; + }; } diff --git a/modules/desktop/xdg.nix b/modules/desktop/xdg.nix index f74fd41..3a905b5 100644 --- a/modules/desktop/xdg.nix +++ b/modules/desktop/xdg.nix @@ -1,4 +1,58 @@ -# STUB (T1): replaced in phase 2 +# XDG base dirs, the user folders and default applications. +# Documents, Downloads, Music, Pictures and Videos are separate subvolumes on +# the data SSD mounted into $HOME (modules/hosts/desktop/disks.nix); Desktop, +# Templates and Public are plain directories on the system disk. Home-manager's +# default folder names already match, so only the unwanted ones are changed. +let + firefox = "firefox.desktop"; + fileManager = "Dolphin.desktop"; + imageViewer = "org.gnome.Loupe.desktop"; + mediaPlayer = "mpv.desktop"; + pdfViewer = "org.pwmt.zathura.desktop"; + archiveManager = "org.gnome.FileRoller.desktop"; +in { - flake.modules.homeManager.xdg = { }; + flake.modules.homeManager.xdg = { + xdg = { + enable = true; + + userDirs = { + enable = true; + createDirectories = true; + + # No ~/Projects: code lives wherever the user clones it. + projects = null; + }; + + mimeApps = { + enable = true; + + defaultApplications = { + "text/html" = firefox; + "x-scheme-handler/http" = firefox; + "x-scheme-handler/https" = firefox; + "x-scheme-handler/about" = firefox; + "x-scheme-handler/unknown" = firefox; + + "inode/directory" = fileManager; + + "image/*" = imageViewer; + "video/*" = mediaPlayer; + "audio/*" = mediaPlayer; + "application/pdf" = pdfViewer; + + "application/zip" = archiveManager; + "application/x-tar" = archiveManager; + "application/x-7z-compressed" = archiveManager; + "application/vnd.rar" = archiveManager; + }; + }; + + # "Open in terminal" actions (desktop entries with Terminal=true) use WezTerm. + terminal-exec = { + enable = true; + settings.default = [ "org.wezfurlong.wezterm.desktop" ]; + }; + }; + }; }