repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
caelestia.nixNix268 lines11.8 KiBraw download
# modules/home/caelestia.nix — Caelestia Shell as bar, launcher, notifications,
# OSD, lock and session menu; its CLI; the static Rosé Pine (M3) schemes.
#
# Look (2026-10-08): Rosé Pine dark (main, not moon) everywhere, translucent
# shell layers over blur, and Caelestia's own framed bar: the screen edge is a
# 10 px frame with 25 px rounded inner corners, the clock and tray sit in pill
# backgrounds, occupied workspaces are filled, the Nix snowflake is the logo.
# The sidebar, utilities and notification panels are narrower than stock
# (./caelestia/shell-tokens.json: 340 / 340 / 360 px instead of 430).
# A Rosé Pine Dawn mapping is registered too:  caelestia scheme set -n rose-pine -f rose-pine-dawn
# and back:                                    caelestia scheme set -n rose-pine -f rose-pine-dark
#
{ ... }:
let theme = import ../_palette.nix; in
{
  flake.homeModules.caelestia =
  { config, pkgs, lib, inputs, osConfig, identity, ... }:
  let
    system = pkgs.stdenv.hostPlatform.system;
    hyprPkg = inputs.hyprland.packages.${system}.hyprland;

    # The CLI knows schemes by name and re-reads their colours whenever the
    # wallpaper changes, so the two hand-mapped Rosé Pine → M3 palettes are
    # registered as a real scheme (name rose-pine; flavours rose-pine-dark, mode
    # dark, and rose-pine-dawn, mode light). The CLI's own `rosepine/dawn` is a
    # Material palette generated from a gold seed, not the Rosé Pine colours.
    cli = (inputs.caelestia-cli.packages.${system}.default).overrideAttrs (old: {
      patchPhase = (old.patchPhase or "") + ''
        install -Dm644 ${./caelestia/rose-pine-dark.txt} src/caelestia/data/schemes/rose-pine/rose-pine-dark/dark.txt
        install -Dm644 ${pkgs.writeText "${theme.name}-dark.txt" (theme.render (builtins.readFile ./caelestia/rose-pine-dark.txt))} src/caelestia/data/schemes/${theme.name}/${theme.name}-dark/dark.txt
        install -Dm644 ${./caelestia/rose-pine-dawn.txt} src/caelestia/data/schemes/rose-pine/rose-pine-dawn/light.txt
      '';
    });

    shell =
      ((inputs.caelestia-shell.packages.${system}.with-cli).override {
        caelestia-cli = cli;
        hyprland = hyprPkg; # hyprctl from the same Hyprland the compositor runs
      }).overrideAttrs (old: {
        # bar.activeWindow.compact shows the program (desktop-entry name for the
        # window class) instead of the window title. Upstream's compact mode only
        # trims the title at its last " - ". Rebuilds the shell locally.
        patches = (old.patches or [ ]) ++ [ ./caelestia/active-window-program-name.patch ];
      });

    # ~/Pictures/Wallpapers/{rose-pine,rose-pine-dark,rose-pine-mid-walls}; the picker scans subfolders.
    wallpaperDir = "${config.home.homeDirectory}/Pictures/Wallpapers";
  in
  # Only when the Hyprland desktop is switched on (modules/features/desktop/options.nix).
  lib.mkIf osConfig.daemon.desktop.hyprland.enable {
    programs.caelestia = {
      enable = true;
      package = shell;

      # The module's default target is graphical-session.target, which Niri
      # starts too (niri.service BindsTo it), so Caelestia would come up beside
      # Noctalia in a Niri login. uwsm's Hyprland session target only exists
      # under Hyprland.
      systemd.target = "wayland-session@hyprland.desktop.target";

      cli = {
        enable = true;
        package = cli;
        # Theming is static Rosé Pine from this repo; the CLI must not rewrite
        # kitty, GTK, Hyprland or anything else when the wallpaper changes.
        settings.theme = {
          enableTerm = false;
          enableHypr = false;
          enableDiscord = false;
          enableSpicetify = false;
          enablePandora = false;
          enableFuzzel = false;
          enableBtop = false;
          enableNvtop = false;
          enableHtop = false;
          enableGtk = false;
          enableQt = false;
          enableWarp = false;
          enableChromium = false;
          enableZed = false;
          enableCava = false;
        };
      };

      settings = {
        appearance = {
          font = {
            clock = "Rubik";
            workspaces = "Rubik";
            headline.family = "Noto Sans";
            title.family = "Noto Sans";
            body.family = "Noto Sans";
            label.family = "Noto Sans";
            mono.family = "DMMono Nerd Font";
          };
          anim.durations.scale = 1.15;
          transparency = {
            enabled = true;
            base = 0.85;
            layers = 0.4;
          };
        };
        general = {
          # The Nix snowflake in the bar, dashboard and lock screen (empty = Caelestia's own logo).
          logo = "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
          apps = {
            terminal = [ "kitty" ];
            audio = [ "caelestia" "shell" "drawers" "toggle" "sidebar" ]; # was the Omarchy audio popup
            playback = [ "mpv" ];
            explorer = [ "nautilus" ];
          };
          idle = {
            lockBeforeSleep = false;
            inhibitWhenAudio = true;
            # Lock after 15 min idle, screen off after 20; audio playing or a
            # fullscreen app with an idle inhibitor holds both off.
            timeouts = [
              { timeout = 900; idleAction = "lock"; respectInhibitors = true; }
              { timeout = 1200; idleAction = "dpms off"; returnAction = "dpms on"; }
            ];
          };
        };
        # Omarchy drew the wallpaper; here Caelestia does. Colours stay static.
        background = {
          enabled = true;
          wallpaperEnabled = true;
          # Big clock on the wallpaper, bottom right, with a soft shadow.
          desktopClock = {
            enabled = true;
            position = "bottom-right";
            scale = 1.0;
            shadow.enabled = true;
          };
          # Audio visualiser along the bottom of the wallpaper while something plays (cava is built in).
          visualiser = {
            enabled = true;
            autoHide = true;
            blur = false;
            rounding = 1;
            spacing = 1;
          };
        };
        bar = {
          persistent = true;
          showOnHover = true;
          workspaces = {
            shown = 5;
            activeIndicator = true;
            occupiedBg = true; # filled pills behind workspaces that have windows
            showWindows = true;
            activeTrail = true;
          };
          activeWindow = {
            compact = true; # the program's name (patched, see `shell` above), not the title
            inverted = true; # on a primary-coloured pill
          };
          clock = {
            showDate = true;
            showIcon = true;
            background = true; # clock in its own pill
          };
          tray = {
            background = true; # tray in its own pill
            recolour = true; # tray icons tinted to the scheme
          };
          statusIcons = [
            { id = "lockStatus"; enabled = true; }
            { id = "audio"; enabled = true; }
            { id = "microphone"; enabled = true; } # shows when something is capturing
            { id = "kbLayout"; enabled = false; }
            { id = "network"; enabled = true; }
            { id = "bluetooth"; enabled = true; }
            { id = "battery"; enabled = true; }
          ];
        };
        # Caelestia's frame: the bar is one side of a border around the screen
        # whose inner corners are rounded. Stock values; the carried 5/0/0 was a flat strip.
        border = {
          thickness = 10;
          rounding = 25;
          smoothing = 20;
        };
        dashboard = {
          enabled = true;
          showWeather = true;
          performance.showGpu = true;
        };
        launcher = {
          enabled = true;
          maxShown = 8;
          vimKeybinds = true; # ctrl+j/k move, like everywhere else here
          actions = [
            { name = "Calculator"; icon = "calculate"; description = "Do simple math equations (powered by Qalc)"; command = [ "autocomplete" "calc" ]; enabled = true; dangerous = false; }
            { name = "Wallpaper"; icon = "image"; description = "Pick a wallpaper"; command = [ "caelestia" "wallpaper" ]; enabled = true; dangerous = false; }
            { name = "Lock"; icon = "lock"; description = "Lock the session"; command = [ "caelestia" "shell" "lock" "lock" ]; enabled = true; dangerous = false; }
            { name = "Sleep"; icon = "bedtime"; description = "Suspend"; command = [ "systemctl" "suspend" ]; enabled = true; dangerous = false; }
            { name = "Settings"; icon = "settings"; description = "Configure the shell"; command = [ "caelestia" "shell" "nexus" "open" ]; enabled = true; dangerous = false; }
            { name = "Logout"; icon = "exit_to_app"; description = "Log out of the current session"; command = [ "uwsm" "stop" ]; enabled = true; dangerous = true; }
            { name = "Reboot"; icon = "cached"; description = "Reboot the system"; command = [ "systemctl" "reboot" ]; enabled = true; dangerous = true; }
            { name = "Shutdown"; icon = "power_settings_new"; description = "Shutdown the system"; command = [ "systemctl" "poweroff" ]; enabled = true; dangerous = true; }
          ];
        };
        lock = {
          enabled = true; # Caelestia is the lock screen here (Omarchy had hyprlock)
          useWallpaper = true; # the wallpaper behind the lock, not a flat colour
        };
        notifs = {
          expire = true;
          defaultExpireTimeout = 6000;
          actionOnClick = true;
        };
        osd = {
          enabled = true;
          enableBrightness = true;
        };
        services = {
          gpuType = "Generic"; # must be a string
          smartScheme = false; # never derive colours from the wallpaper
          defaultPlayer = "rmpc";
          # weatherLocation unset: the weather card locates by IP (ip-api.com),
          # so no place is written into this public config.
        };
        session = {
          enabled = true;
          icons.hibernate = "bedtime";
          commands = {
            logout = [ "uwsm" "stop" ];
            shutdown = [ "systemctl" "poweroff" ];
            hibernate = [ "systemctl" "suspend" ];
            reboot = [ "systemctl" "reboot" ];
          };
        };
        sidebar.enabled = true;
        utilities = {
          enabled = true;
          toasts.nowPlaying = true; # a toast when the track changes
        };
        paths.wallpaperDir = wallpaperDir;
      };
    };

    # The scheme the shell reads at start: Rosé Pine dark (scheme.json;
    # scheme-dawn.json is the light mapping). `caelestia scheme set …` rewrites
    # this file (home-manager backs the symlink up as .hm-bak when that happens).
    home.file.".local/state/caelestia/scheme.json".text = builtins.toJSON ((builtins.fromJSON (theme.render (builtins.readFile ./caelestia/scheme.json))) // {
      name = theme.name;
      flavour = if theme.name != "rose-pine" then "${theme.name}-dark" else "rose-pine-dark";
    });

    # Internal size tokens: the shell reads this file (defaults in its source,
    # plugin/src/Caelestia/Config/tokens.hpp: sidebar, utilities and
    # notification width 430, bar innerWidth 40). Here: sidebar and utilities
    # 340, notifications 360, bar 36. Rounding, padding and spacing stay stock.
    home.file.".config/caelestia/shell-tokens.json".source = ./caelestia/shell-tokens.json;

    # First wallpaper, only if none was ever chosen (Caelestia keeps the choice in state).
    home.activation.caelestiaWallpaper = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
      st="$HOME/.local/state/caelestia/wallpaper"
      if [ ! -e "$st/path.txt" ]; then
        wp=$(ls "${wallpaperDir}"/rose-pine-dark/*.png 2>/dev/null | head -1 || true)
        if [ -n "$wp" ]; then
          mkdir -p "$st" && printf '%s' "$wp" > "$st/path.txt" && ln -sfn "$wp" "$st/current"
        fi
      fi
    '';
  }
  ;
}