nixos/shared/modules/home-manager/noctalia.nix

393 lines
11 KiB
Nix

# For reference of the available options, see https://docs.noctalia.dev/getting-started/nixos/#config-ref
#
# To see a diff of the nix-set and GUI-set (current) settings, run:
# nix shell nixpkgs#jq nixpkgs#colordiff -c bash -c "colordiff -u --nobanner <(jq -S . ~/.config/noctalia/settings.json) <(noctalia-shell ipc call state all | jq -S .settings)"
{ config, lib, pkgs, inputs, ... }:
with lib;
let
cfg = config.noctaliaShell;
in
{
imports = [
inputs.noctalia.homeModules.default
];
options.noctaliaShell = {
enable = mkEnableOption "Noctalia shell";
colorScheme = mkOption {
type = types.str;
default = "Noctalia (default)";
description = ''
Predefined color scheme to use. Options include:
"Noctalia (default)", "Monochrome", "Catppuccin Mocha", etc.
See Noctalia docs for full list.
'';
};
useWallpaperColors = mkOption {
type = types.bool;
default = false;
description = "Generate colors from wallpaper instead of using predefined scheme";
};
darkMode = mkOption {
type = types.bool;
default = true;
description = "Use dark mode for Noctalia shell";
};
barPosition = mkOption {
type = types.enum [ "top" "bottom" "left" "right" ];
default = "top";
description = "Position of the Noctalia bar";
};
barDensity = mkOption {
type = types.enum [ "spacious" "comfortable" "default" "compact" "mini" ];
default = "default";
description = "Bar density (compact for vertical bars)";
};
enableDock = mkOption {
type = types.bool;
default = true;
description = "Enable the Noctalia dock";
};
dockPosition = mkOption {
type = types.enum [ "top" "bottom" "left" "right" ];
default = "bottom";
description = "Position of the dock";
};
pinnedApps = mkOption {
type = types.listOf types.str;
default = [ ];
description = "List of .desktop file names for pinned dock apps";
};
avatarImage = mkOption {
type = types.str;
default = "";
description = "Path to avatar image for user profile";
};
locationName = mkOption {
type = types.str;
default = "Denver";
description = "Location name for weather widget";
};
use12hourFormat = mkOption {
type = types.bool;
default = false;
description = "Use 12-hour time format";
};
useFahrenheit = mkOption {
type = types.bool;
default = false;
description = "Use Fahrenheit for temperature";
};
# UI settings
fontDefault = mkOption {
type = types.str;
default = "";
description = "Default font for Noctalia shell";
};
fontFixed = mkOption {
type = types.str;
default = "";
description = "Monospace font for Noctalia shell";
};
fontDefaultScale = mkOption {
type = types.float;
default = 1.0;
description = "Scale factor for default font";
};
panelBackgroundOpacity = mkOption {
type = types.float;
default = 0.93;
description = "Background opacity for panels";
};
# General settings
dimmerOpacity = mkOption {
type = types.float;
default = 0.2;
description = "Opacity for screen dimmer";
};
lockScreenAnimations = mkOption {
type = types.bool;
default = false;
description = "Enable lock screen animations";
};
lockScreenCountdownDuration = mkOption {
type = types.int;
default = 10000;
description = "Lock screen countdown duration in milliseconds";
};
telemetryEnabled = mkOption {
type = types.bool;
default = false;
description = "Enable telemetry for Noctalia";
};
# Bar settings
barBackgroundOpacity = mkOption {
type = types.float;
default = 0.93;
description = "Bar background opacity";
};
clockFormat = mkOption {
type = types.str;
default = "HH:mm ddd, MMM dd";
description = "Clock format for horizontal display";
};
launcherIcon = mkOption {
type = types.str;
default = "activities";
description = "Icon for the launcher widget";
};
# Wallpaper settings
wallpaperDirectory = mkOption {
type = types.str;
default = "";
description = "Directory containing wallpapers";
};
# Dock settings
dockBackgroundOpacity = mkOption {
type = types.float;
default = 1.0;
description = "Dock background opacity";
};
dockSize = mkOption {
type = types.float;
default = 1.0;
description = "Dock size multiplier";
};
# Notification settings
notificationLocation = mkOption {
type = types.enum [ "top" "top_right" "top_left" "bottom" "bottom_right" "bottom_left" ];
default = "top_right";
description = "Location for notifications";
};
enableMediaToast = mkOption {
type = types.bool;
default = false;
description = "Enable media change toast notifications";
};
# OSD settings
osdLocation = mkOption {
type = types.enum [ "top" "top_right" "top_left" "bottom" "bottom_right" "bottom_left" "center" ];
default = "top_right";
description = "Location for OSD popups";
};
# Night light settings
enableNightLight = mkOption {
type = types.bool;
default = false;
description = "Enable night light feature";
};
nightLightTemp = mkOption {
type = types.str;
default = "4000";
description = "Night time color temperature";
};
# System monitor settings
systemMonitorUseCustomColors = mkOption {
type = types.bool;
default = false;
description = "Use custom colors for system monitor thresholds";
};
systemMonitorWarningColor = mkOption {
type = types.str;
default = "";
description = "Warning color for system monitor";
};
systemMonitorCriticalColor = mkOption {
type = types.str;
default = "";
description = "Critical color for system monitor";
};
# Plugin settings
pluginsAutoUpdate = mkOption {
type = types.bool;
default = false;
description = "Auto-update Noctalia plugins";
};
# Calendar settings
firstDayOfWeek = mkOption {
type = types.int;
default = (-1);
description = "First day of week (-1 for system default, 0=Sunday, 1=Monday)";
};
hideWeatherTimezone = mkOption {
type = types.bool;
default = false;
description = "Hide timezone in weather display";
};
};
config = mkIf cfg.enable {
# Configure Noctalia shell via home-manager module
programs.noctalia-shell = {
enable = true;
# Don't install the package separately since systemd service handles it
# But we need it for IPC commands in keybinds
package = inputs.noctalia.packages.${pkgs.stdenv.hostPlatform.system}.default;
settings = mkMerge [
# Use mkDefault for all settings to allow per-host overrides
(mkDefault {
colorSchemes = {
useWallpaperColors = cfg.useWallpaperColors;
predefinedScheme = cfg.colorScheme;
darkMode = cfg.darkMode;
};
bar = {
position = cfg.barPosition;
density = cfg.barDensity;
backgroundOpacity = cfg.barBackgroundOpacity;
showCapsule = true;
floating = false;
widgets = {
left = [
{ id = "Launcher"; icon = cfg.launcherIcon; }
{ id = "Clock"; formatHorizontal = cfg.clockFormat; }
{ id = "SystemMonitor"; }
{ id = "ActiveWindow"; }
{ id = "MediaMini"; }
];
center = [
{ id = "Workspace"; }
];
right = [
{ id = "Tray"; }
{ id = "NotificationHistory"; }
{ id = "Battery"; }
{ id = "Volume"; }
{ id = "Brightness"; }
{ id = "ControlCenter"; }
];
};
};
dock = {
enabled = cfg.enableDock;
position = cfg.dockPosition;
displayMode = "auto_hide";
backgroundOpacity = cfg.dockBackgroundOpacity;
size = cfg.dockSize;
pinnedApps = cfg.pinnedApps;
};
general = {
avatarImage = cfg.avatarImage;
dimmerOpacity = cfg.dimmerOpacity;
radiusRatio = 1;
animationSpeed = 1;
enableShadows = true;
lockScreenAnimations = cfg.lockScreenAnimations;
lockScreenCountdownDuration = cfg.lockScreenCountdownDuration;
telemetryEnabled = cfg.telemetryEnabled;
};
ui = {
fontDefault = cfg.fontDefault;
fontFixed = cfg.fontFixed;
fontDefaultScale = cfg.fontDefaultScale;
panelBackgroundOpacity = cfg.panelBackgroundOpacity;
};
location = {
name = cfg.locationName;
weatherEnabled = true;
use12hourFormat = cfg.use12hourFormat;
useFahrenheit = cfg.useFahrenheit;
firstDayOfWeek = cfg.firstDayOfWeek;
hideWeatherTimezone = cfg.hideWeatherTimezone;
};
wallpaper = {
enabled = true;
directory = cfg.wallpaperDirectory;
};
notifications = {
enabled = true;
location = cfg.notificationLocation;
enableMediaToast = cfg.enableMediaToast;
};
osd = {
enabled = true;
location = cfg.osdLocation;
};
nightLight = {
enabled = cfg.enableNightLight;
autoSchedule = true;
nightTemp = cfg.nightLightTemp;
};
systemMonitor = {
useCustomColors = cfg.systemMonitorUseCustomColors;
warningColor = cfg.systemMonitorWarningColor;
criticalColor = cfg.systemMonitorCriticalColor;
};
plugins = {
autoUpdate = cfg.pluginsAutoUpdate;
};
appLauncher = {
position = "center";
sortByMostUsed = true;
viewMode = "list";
};
})
];
};
# Disable conflicting services that Noctalia replaces
services.swayosd.enable = mkForce false;
services.swaync.enable = mkForce false;
# Disable wlsunset - Noctalia has built-in night light
services.wlsunset.enable = mkForce false;
# Disable waybar - Noctalia has its own bar
waybarConfig.enable = mkForce false;
programs.waybar.enable = mkForce false;
};
}