refactor(noctalia): hot-reload config via out-of-store symlink

`programs.noctalia.settings` deploys the TOML as a store symlink, so every edit needs a `home-manager switch`. Deploy the baseline from the config layer with `mkOutOfStoreSymlink` instead: Noctalia hot-reloads config-layer files and never rewrites them, so edits apply live while Settings UI changes stay in ~/.local/state/noctalia/settings.toml (which loads last) and out of the repo.

Update the docs and host-specific comments to match the two-layer model.
This commit is contained in:
Ryan Yin committed 2026-09-20 10:35:48 +08:00
1 parent efb5c08696
commit 063c31cc30
5 files changed
+42 -28

No files matched your search

+2 -1
View File
@@ -24,7 +24,8 @@ in
xdg.configFile."niri/niri-hardware.kdl".source =
mkSymlink "${config.home.homeDirectory}/nix-config/hosts/12kingdoms-shoukei/niri-hardware.kdl";
# Host-specific Noctalia config; merges after the shared config.toml.
# Host-specific Noctalia config; sorts after the shared config.toml, so it can
# override the shared baseline.
xdg.configFile."noctalia/host-shoukei.toml".source = ./12kingdoms-shoukei/noctalia.toml;
# The built-in laptop speakers are quiet, so boost above the -23 dB default.
+17 -12
View File
@@ -15,23 +15,27 @@ The configuration is organized into modular components that can be selectively e
## Noctalia
**Noctalia** (v5) is a native C++/Wayland all-in-one desktop shell that replaces multiple separate
tools with a single, unified solution. It is installed and configured through the upstream
tools with a single, unified solution. It is installed through the upstream
[`programs.noctalia`](https://docs.noctalia.dev/noctalia/getting-started/nixos/) Home Manager
module, which validates the TOML at build time.
module.
### Configuration
Noctalia merges **every `*.toml` in the config directory** (`~/.config/noctalia/`), sorted
alphabetically, and then layers the Settings UI's own overrides on top:
alphabetically, and then layers the state directory's `settings.toml` on top:
| Layer | Location | Notes |
| -------------------- | ----------------------------------------------------------------- | ----------------------------------------------- |
| Declarative baseline | `~/.config/noctalia/*.toml` (repo: `noctalia/config/config.toml`) | Merged alphabetically; `[include]` supported |
| GUI overrides | `~/.local/state/noctalia/settings.toml` | Written by the Settings UI; loads last and wins |
| Layer | Location | Notes |
| ------ | --------------------------------------- | --------------------------------------------------------------------- |
| Config | `~/.config/noctalia/*.toml` | Merged alphabetically; `[include]` supported; host-specific overrides |
| State | `~/.local/state/noctalia/settings.toml` | Written by the Settings UI; loads last and wins |
`noctalia config export merged` prints the effective user config and `noctalia config validate`
checks a file. Application theming stays with `catppuccin/nix`, so Noctalia's theme templates are
disabled.
The shared baseline (`noctalia/config/config.toml`) is deployed as an **out-of-store symlink**, so
manual edits hot-reload without a `home-manager switch`. Noctalia never rewrites files in the config
layer, so volatile runtime data (wallpaper rotation, widget geometry) stays in the state file and
out of the repository.
`noctalia config export` prints the merged user config and `noctalia config validate` checks a file.
Application theming stays with `catppuccin/nix`, so Noctalia's theme templates are disabled.
### Component Replacement
@@ -54,8 +58,9 @@ Noctalia consolidates functionality that previously required multiple tools:
### Desktop Shell
- **[`noctalia/default.nix`](./noctalia/default.nix)**: enables the upstream `programs.noctalia`
module
- **[`noctalia/config/config.toml`](./noctalia/config/config.toml)**: declarative baseline (v5 TOML)
module and symlinks the baseline out of store
- **[`noctalia/config/config.toml`](./noctalia/config/config.toml)**: declarative baseline (v5
TOML), tracked in the repo and hot-reloaded
Key features: bar and widgets, control center, desktop widgets, night light, wallpaper, session
panel, screenshots with annotation, system monitor, audio/volume, brightness, calendar/weather,
@@ -1,6 +1,9 @@
# Noctalia v5 — minimal declarative baseline.
# Everything else is tuned in the Settings UI: those changes go to
# ~/.local/state/noctalia/settings.toml (persisted) and take precedence.
# Noctalia v5 declarative baseline.
#
# This file is symlinked out of store into ~/.config/noctalia/config.toml, so
# edits hot-reload without a home-manager switch. Noctalia never rewrites files
# in the config layer; Settings UI changes go to
# ~/.local/state/noctalia/settings.toml, which loads after this file and wins.
[accessibility]
# Content scale for panels and other non-bar shell UI.
+13 -9
View File
@@ -1,4 +1,5 @@
{
config,
lib,
pkgs,
wallpapers,
@@ -6,16 +7,19 @@
}:
{
# Use the upstream Home Manager module (shipped by home-manager itself): it
# installs pkgs.noctalia, validates the TOML at build time via `checkConfig`,
# and handles custom palettes. Runtime changes made in the Settings UI keep
# working: they go to ~/.local/state/noctalia/settings.toml, which loads after
# this file and wins.
# Use the upstream Home Manager module (shipped by home-manager itself) for
# the package. The config file is not deployed through `programs.noctalia.settings`:
# that writes a store symlink, so every edit needs a home-manager switch.
# https://docs.noctalia.dev/noctalia/getting-started/nixos/#home-manager
programs.noctalia = {
enable = true;
settings = ./config/config.toml;
};
programs.noctalia.enable = true;
# Deploy the baseline as an out-of-store symlink in the config layer. Noctalia
# never rewrites files under ~/.config/noctalia/, so manual edits hot-reload
# without a switch, while Settings UI changes stay in the state layer
# (~/.local/state/noctalia/settings.toml), which loads last and wins - keeping
# volatile runtime data (wallpaper rotation, widget geometry) out of the repo.
# Host-specific tweaks are separate config-layer files (~/.config/noctalia/host-<host>.toml).
xdg.configFile."noctalia/config.toml".source =
config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/home/linux/gui/base/noctalia/config/config.toml";
# Noctalia v5 is started by niri's spawn-at-startup (see the niri conf), so
# app2unit is still used to launch desktop entries as systemd user units.