My nix-darwin and NixOS config
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: please

+54 -14
+23 -8
docs/wallpapers.md
··· 6 6 7 7 - `wallpaper.jpg` — default desktop background and lock screen 8 8 9 - ## Usage 9 + ## How it works 10 10 11 - The wallpaper is referenced directly in `settings/plasma/default.nix`: 11 + ### Linux (KDE Plasma) 12 + 13 + plasma-manager's `workspace.wallpaper` option applies wallpaper via D-Bus at 14 + home-manager activation time. However, activation runs *before* the Plasma 15 + session is live, so D-Bus isn't available and it silently fails. 16 + 17 + Instead, a `systemd.user` service in `home/programs/kde.nix` calls 18 + `plasma-apply-wallpaperimage` *after* `plasma-plasmashell.service` is up: 12 19 13 20 ```nix 14 - workspace = { 15 - wallpaper = "${../../wallpapers/wallpaper.jpg}"; 16 - # ... other settings 21 + systemd.user.services.set-plasma-wallpaper = { 22 + Unit.After = [ "plasma-plasmashell.service" ]; 23 + Unit.PartOf = [ "graphical-session.target" ]; 24 + Service.Type = "oneshot"; 25 + Service.ExecStart = "${pkgs.kdePackages.plasma-workspace}/bin/plasma-apply-wallpaperimage ${wallpaper}"; 26 + Install.WantedBy = [ "graphical-session.target" ]; 17 27 }; 18 28 ``` 19 29 20 - Note: The string interpolation `"${...}"` is required to convert the path to a Nix store path string. 30 + ### macOS 21 31 22 - Applied automatically on every Home Manager rebuild. 32 + Applied via `programs.desktoppr` in `home/home.nix`. 23 33 24 34 ## Changing the Wallpaper 25 35 26 36 1. Replace `wallpapers/wallpaper.jpg` with your image (keep the same filename), or 27 - 2. Add a new image and update the path in `settings/plasma/default.nix` 37 + 2. Add a new image and update the `wallpaper` let-binding in `home/programs/kde.nix` 28 38 3. Rebuild: `sudo nixos-rebuild switch --flake .#laptop` 39 + 40 + The service will apply the new wallpaper on next login (or you can restart it manually): 41 + ```bash 42 + systemctl --user restart set-plasma-wallpaper.service 43 + ``` 29 44 30 45 ## Recommended Format 31 46
+30 -2
home/programs/kde.nix
··· 1 1 # KDE Plasma desktop settings — desktop hosts only (not server). 2 2 # Terminal profile lives in terminal.nix and is imported separately for all 3 - # non-Darwin hosts; this file is only the plasma-manager layer. 4 - { lib, cfgLib, ... }: 3 + # non-Darwin hosts; this file is the plasma-manager layer + wallpaper service. 4 + # 5 + # Why a systemd service for wallpaper? 6 + # plasma-manager applies the wallpaper via D-Bus at home-manager activation 7 + # time. Activation runs before the Plasma session is live (no D-Bus), so it 8 + # silently fails. The service below runs plasma-apply-wallpaperimage *after* 9 + # the graphical session has started, which is the only reliable method. 10 + { pkgs, lib, ... }: 5 11 12 + let 13 + wallpaper = "${../../wallpapers/wallpaper.jpg}"; 14 + in 6 15 { 7 16 imports = [ 8 17 ../../settings/plasma 9 18 ]; 19 + 20 + # ── Wallpaper systemd user service ───────────────────────────────────────── 21 + systemd.user.services.set-plasma-wallpaper = { 22 + Unit = { 23 + Description = "Apply KDE Plasma wallpaper"; 24 + After = [ "plasma-plasmashell.service" ]; 25 + PartOf = [ "graphical-session.target" ]; 26 + }; 27 + Service = { 28 + Type = "oneshot"; 29 + ExecStart = "${pkgs.kdePackages.plasma-workspace}/bin/plasma-apply-wallpaperimage ${wallpaper}"; 30 + # Restart on failure in case plasmashell wasn't fully ready yet 31 + Restart = "on-failure"; 32 + RestartSec = "2s"; 33 + }; 34 + Install = { 35 + WantedBy = [ "graphical-session.target" ]; 36 + }; 37 + }; 10 38 }
+1 -4
settings/plasma/default.nix
··· 9 9 # 10 10 # All font families, sizes, color schemes, and icon themes come from 11 11 # settings/config/desktop.nix — never hardcoded here. 12 - # Wallpaper lives in ../../wallpapers/wallpaper.jpg. 12 + # Wallpaper is applied by a systemd user service in home/programs/kde.nix. 13 13 # The Konsole profile lives in home/programs/terminal.nix. 14 14 # 15 15 # macOS-like layout: ··· 136 136 137 137 # ── Workspace ───────────────────────────────────────────────────────────── 138 138 workspace = { 139 - 140 - # Wallpaper — direct path to wallpaper.jpg (must be string-interpolated). 141 - wallpaper = "${../../wallpapers/wallpaper.jpg}"; 142 139 143 140 # Color scheme — from settings/config/desktop.nix. 144 141 # Explicit here so it always wins, even if the catppuccin module changes