# modules/features/desktop/noctalia.nix — Noctalia Shell (bar, launcher,# notifications, control centre, lock screen, wallpaper) as a wrapped,# portable package: `nix run ~/NixDaemon#noctalia`. Niri spawns it at startup# (niri.nix). Rosé Pine Main is Noctalia's own "Rosepine" scheme (dark half =# base #191724, rose #ebbcba); never Moon.## The settings below live in the Nix store (NOCTALIA_SETTINGS_FILE), so the# GUI settings panel (right-click the bar) changes them for the running# session only. To keep a change: tweak it in the GUI, then## dump-noctalia-shell (in the same package) prints the live settings as Nix## and copy the keys that differ from Noctalia's defaults into `settings` here.{ inputs, self, ... }:
lettheme=import../../_palette.nix;
in{
perSystem= { pkgs, lib, self', ... }:
letscreensaver= self.packages.${pkgs.stdenv.hostPlatform.system}.niri-screensaver;
gruvpineLogo= pkgs.writeText "nixos-gruvpine.svg" (builtins.readFile ../../../assets/nixos-gruvpine.svg);
logoSettings= {
useDistroLogo=false;
customIconPath=toString gruvpineLogo;
enableColorization=false;
};
rightWidgets= [
{ id="Tray"; }
{ id="plugin:keybind-cheatsheet"; }
{ id="NotificationHistory"; }
{ id="Battery"; }
{ id="Volume"; }
{ id="Brightness"; }
(logoSettings // { id="ControlCenter"; })
];
greeterLockShell= pkgs.noctalia-shell.overrideAttrs (old: {
postInstall= (old.postInstall or"") +'' cp ${./_lockscreen/LockScreenHeader.qml} "$out/share/noctalia-shell/Modules/LockScreen/LockScreenHeader.qml" substituteInPlace "$out/share/noctalia-shell/Modules/LockScreen/LockScreenHeader.qml" \ --replace-fail '@FOAM@' '${theme.palette.foam}' \ --replace-fail '@TEXT@' '${theme.palette.text}' \ --replace-fail '@GOLD@' '${theme.palette.gold}' \ --replace-fail '@SURFACE@' '${theme.palette.surface}' \ --replace-fail '@OVERLAY@' '${theme.palette.overlay}' \ --replace-fail '@OUTLINE@' '${theme.palette.hlMed}' \ --replace-fail '@SUBTLE@' '${theme.palette.subtle}' \ --replace-fail '@ROSE@' '${theme.palette.rose}' \ --replace-fail '@LOGO@' '${gruvpineLogo}'${pkgs.python3}/bin/python3 ${./_lockscreen/patch.py} "$out" \ '${theme.palette.foam}' '${theme.palette.base}' '${theme.palette.text}' '';
});
mkNoctalia= overrides: inputs.wrapper-modules.wrappers.noctalia-shell.wrap {
inherit pkgs;
package= greeterLockShell;
settings= lib.recursiveUpdate {
# Noctalia's current settings schema (Commons/Settings.qml). Without# it every migration since v0 runs at start, one of them against# ~/.config/noctalia. Bump it when noctalia-shell is updated# (`dump-noctalia-shell` prints the value it expects).settingsVersion=59;
colorSchemes= {
predefinedScheme=if theme.name !="rose-pine"thentoString (pkgs.writeText "${theme.name}.json" (builtins.toJSON {
dark= {
mPrimary= theme.palette.rose; mOnPrimary= theme.palette.base;
mSecondary= theme.palette.foam; mOnSecondary= theme.palette.base;
mTertiary= theme.palette.iris; mOnTertiary= theme.palette.base;
mError= theme.palette.love; mOnError= theme.palette.base;
mSurface= theme.palette.base; mOnSurface= theme.palette.text;
mSurfaceVariant= theme.palette.overlay; mOnSurfaceVariant= theme.palette.subtle;
mOutline= theme.palette.hlMed; mShadow= theme.palette.base;
mHover= theme.palette.hlHigh; mOnHover= theme.palette.text;
};
})) else"Rosepine";
darkMode=true;
useWallpaperColors=false; # never derive colours from the wallpaper };
bar= {
position="top";
density="compact";
# Keep the six Gruvpine colors in the bundled NixOS snowflake.# Distro-logo lookup takes precedence over customIconPath, so it# must be disabled along with single-color icon tinting.widgets= {
left= [
(logoSettings // { id="Launcher"; })
{ id="Clock"; }
{ id="SystemMonitor"; }
{ id="ActiveWindow"; }
{ id="MediaMini"; }
];
center= [ { id="Workspace"; } ];
right= rightWidgets;
};
};
dock= {
# The dock's separate launcher uses its built-in distro-logo setting.showLauncherIcon=true;
launcherUseDistroLogo=true;
};
general= {
lockOnSuspend=true;
telemetryEnabled=false;
};
ui.fontDefault="Noto Sans"; # fontFixed: Noctalia's default, or the -daemon fontwallpaper= {
enabled=true;
# the same Rosé Pine wallpapers Caelestia uses (modules/home/caelestia.nix):# three sets in subfolders, so the picker searches recursivelyviewMode="recursive";
fillMode="crop";
};
location= {
useFahrenheit=false;
use12hourFormat=false;
};
appLauncher= {
terminalCommand="kitty -e";
enableClipboardHistory=true; # the Ctrl+Super+V bind (niri.nix) opens this tab; needs cliphist + wl-paste (modules/home/session.nix) };
idle= {
enabled=true;
lockTimeout=600; # Noctalia's own lock screen after ten idle minutesscreenOffTimeout=1200; # as the Hyprland side (20 min)suspendTimeout=0; # never: Noctalia's default is 30 min, and NVIDIA suspend is untested here (nvidia.nix) };
} overrides;
};
in {
# The shared settings. packages.noctalia is these as they stand (what# anyone running the flake gets); packages.noctalia-daemon layers the# author's weather, wallpaper directory and font on top. packages.noctalia= mkNoctalia { };
packages.noctalia-daemon=letbase= self'.packages.noctalia-daemon-base;
# The weather location is the author's home town, so it is not in# this public repo: noctalia-daemon.json carries a placeholder, and# the real name lives in secrets/noctalia-location (sops, decrypted at# login by modules/home/noctalia-plugins.nix). The wrapper forces# NOCTALIA_SETTINGS_FILE to the store copy, so this launcher writes a# read-only runtime copy with the name filled in and execs the# unwrapped shell on it. Without the secret (anyone else running the# flake) it runs on the store settings unchanged.launcher= pkgs.writeShellScriptBin "noctalia-shell"'' settings=${base}/noctalia-shell-config/settings.json secret="$HOME/.config/sops-nix/secrets/noctalia-location" run="''${XDG_RUNTIME_DIR:-/run/user/$(${pkgs.coreutils}/bin/id -u)}/noctalia"${pkgs.coreutils}/bin/rm -f "$run/settings.json.new" if [ -r "$secret" ] && ${pkgs.coreutils}/bin/mkdir -p "$run" \ && ${pkgs.jq}/bin/jq --rawfile loc "$secret" '.location.name = ($loc | rtrimstr("\n"))' \ "$settings" > "$run/settings.json.new"; then${pkgs.coreutils}/bin/chmod 0400 "$run/settings.json.new"${pkgs.coreutils}/bin/mv -f "$run/settings.json.new" "$run/settings.json" settings="$run/settings.json" fi export NOCTALIA_SETTINGS_FILE="$settings" exec -a "$0" @inner@ "$@" '';
# The unwrapped binary is whatever the wrapper execs; read at build# time, and fail loudly if the wrapper's shape ever changes.launcherBin= pkgs.runCommand "noctalia-daemon-launcher" { } '' inner=$(${pkgs.gnugrep}/bin/grep -oE '^exec -a "\$0" /nix/store/[^ ]+' ${base}/bin/noctalia-shell \ | ${pkgs.gawk}/bin/awk '{print $4}') [ -x "$inner" ] || { echo "noctalia-daemon: wrapper layout changed; update the launcher" >&2; exit 1; } install -Dm755 ${launcher}/bin/noctalia-shell $out/bin/noctalia-shell substituteInPlace $out/bin/noctalia-shell --replace-fail @inner@ "$inner" '';
in pkgs.symlinkJoin {
name="noctalia-daemon";
paths= [ launcherBin base ]; # launcher first: its bin/noctalia-shell wins meta.mainProgram="noctalia-shell";
};
packages.noctalia-daemon-base=let# The author's live settings (GUI dump), kept as JSON so a fresh dump# can be pasted over the file. Logo icons and the colour scheme are# set below, so the dump's copies of those are overridden.saved=builtins.fromJSON (builtins.readFile ./noctalia-daemon.json);
withLogo=map (w:
if w.id=="Launcher"|| w.id=="ControlCenter"then w // logoSettings else w);
in mkNoctalia (lib.recursiveUpdate saved {
hooks= {
enabled=true;
screenLock="${screensaver}/bin/niri-screensaver-launch kill";
screenUnlock="${screensaver}/bin/niri-screensaver-launch kill";
};
idle.customCommands=builtins.toJSON [ {
name="Niri Screensaver";
timeout=300;
command="${screensaver}/bin/niri-screensaver-launch launch";
resumeCommand="${screensaver}/bin/niri-screensaver-launch kill";
} ];
general= {
compactLockScreen=true;
showSessionButtonsOnLockScreen=false;
lockScreenAnimations=false;
enableLockScreenMediaControls=false;
passwordChars=true;
};
# "Gruvpine" is installed into ~/.config/noctalia/colorschemes by# modules/home/noctalia-plugins.nix, so it also shows in the GUI's# colour scheme list; the other themes keep the generated scheme.colorSchemes= lib.optionalAttrs (theme.name=="gruvpine") { predefinedScheme="Gruvpine"; };
bar.widgets= {
left= withLogo saved.bar.widgets.left;
# Plugins installed by modules/home/noctalia-plugins.nix. KDE Connect# and OBS Control are installed but kept off the bar until their# daemons exist.right= [
{ id="plugin:catwalk"; }
{ id="plugin:pomodoro"; }
{ id="plugin:clipper"; }
{ id="plugin:dns-switcher"; }
{ id="plugin:keybind-cheatsheet"; }
] ++ withLogo saved.bar.widgets.right;
};
});
};
}