From d6e7be7db161ff59221082173345bc066fe008d7 Mon Sep 17 00:00:00 2001 From: mjallen18 Date: Fri, 22 Aug 2025 21:11:13 -0500 Subject: [PATCH] cleanup --- modules/home/desktop/hyprland/packages.nix | 74 -------- .../hyprland/services/hypridle/default.nix | 46 ----- .../hyprland/services/hyprlock/default.nix | 52 ------ .../hyprland/services/hyprpaper/default.nix | 23 --- modules/home/desktop/hyprland/variables.nix | 39 ---- .../hyprland/default.nix | 113 ++++++++++-- .../hyprland/options.nix | 38 +++- .../{desktop => programs}/hyprland/theme.nix | 7 +- modules/nixos/desktop/hyprland/default.nix | 168 ++++++++++++++++-- modules/nixos/desktop/hyprland/options.nix | 13 ++ .../specialisations/hyprland/default.nix | 5 +- .../specialisations/hyprland/home/default.nix | 23 ++- 12 files changed, 307 insertions(+), 294 deletions(-) delete mode 100644 modules/home/desktop/hyprland/packages.nix delete mode 100644 modules/home/desktop/hyprland/services/hypridle/default.nix delete mode 100644 modules/home/desktop/hyprland/services/hyprlock/default.nix delete mode 100644 modules/home/desktop/hyprland/services/hyprpaper/default.nix delete mode 100644 modules/home/desktop/hyprland/variables.nix rename modules/home/{desktop => programs}/hyprland/default.nix (84%) mode change 100755 => 100644 rename modules/home/{desktop => programs}/hyprland/options.nix (66%) rename modules/home/{desktop => programs}/hyprland/theme.nix (91%) create mode 100644 modules/nixos/desktop/hyprland/options.nix diff --git a/modules/home/desktop/hyprland/packages.nix b/modules/home/desktop/hyprland/packages.nix deleted file mode 100644 index d717506..0000000 --- a/modules/home/desktop/hyprland/packages.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.mjallen.desktop.hyprland; -in -{ - config = mkIf cfg.enable { - home.packages = with pkgs; [ - box64 - brightnessctl - ddcutil - dunst - egl-wayland - file-roller - glib - gnome-calculator - gnome-calendar - gnome-disk-utility - gnome-firmware - gnome-firmware-updater - gnome-font-viewer - gnome-logs - gnome-photos - gnome-tweaks - gnome-weather - gsettings-desktop-schemas - hyprcursor - hyprland - hyprpaper - hyprshot - hyprsysteminfo - kdePackages.qtmultimedia - libnotify - libz - mako - meson - nautilus - networkmanagerapplet - nm-tray - nomacs - nwg-look - overskride - pamixer - pavucontrol - playerctl - polkit - polkit_gnome - qt5.qtwayland - qt6.qtwayland - rofi-wayland - waybar - wayland-protocols - wayland-utils - waypaper - wev - wl-clipboard - wlogout - wlroots - xdg-desktop-portal-hyprland - xdg-desktop-portal-gtk - xdg-desktop-portal-wlr - xorg.xhost - xsettingsd - xwayland - - pkgs.mjallen.pipewire-python - ]; - }; -} diff --git a/modules/home/desktop/hyprland/services/hypridle/default.nix b/modules/home/desktop/hyprland/services/hypridle/default.nix deleted file mode 100644 index 6da7c5d..0000000 --- a/modules/home/desktop/hyprland/services/hypridle/default.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - config, - lib, - namespace, - ... -}: -let - cfg = config.${namespace}.desktop.hyprland; -in -{ - imports = [ ../../options.nix ]; - - config = lib.mkIf cfg.enable { - services.hypridle = { - enable = true; - settings = { - general = { - before_sleep_cmd = "loginctl lock-session"; # lock before suspend. - after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display. - ignore_dbus_inhibit = false; - lock_cmd = "pidof hyprlock || hyprlock"; # avoid starting multiple hyprlock instances. - }; - listener = [ - # { - # timeout = 300; # 5min - # on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor. - # on-resume = "brightnessctl -r"; # monitor backlight restore. - # } - { - timeout = cfg.hyprIdle.lockScreenTimer; - on-timeout = "loginctl lock-session"; # lock screen when timeout has passed - } - { - timeout = cfg.hyprIdle.screenOffTimer; - on-timeout = "hyprctl dispatch dpms off"; # screen off when timeout has passed - on-resume = "hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired. - } - { - timeout = cfg.hyprIdle.suspendTimer; - on-timeout = "systemctl suspend"; # suspend pc - } - ]; - }; - }; - }; -} diff --git a/modules/home/desktop/hyprland/services/hyprlock/default.nix b/modules/home/desktop/hyprland/services/hyprlock/default.nix deleted file mode 100644 index bc2175a..0000000 --- a/modules/home/desktop/hyprland/services/hyprlock/default.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ - config, - lib, - namespace, - ... -}: -let - cfg = config.${namespace}.desktop.hyprland; -in -{ - imports = [ ../../options.nix ]; - - config = lib.mkIf cfg.enable { - programs.hyprlock = { - enable = true; - settings = { - background = [ - { - monitor = ""; - path = cfg.wallpaper; # supports png, jpg, webp (no animations, though) - color = "rgba(25, 20, 20, 1.0)"; - - # all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations - blur_passes = "3"; # 0 disables blurring - blur_size = "7"; - noise = "0.0117"; - contrast = "0.8916"; - brightness = "0.8172"; - vibrancy = "0.1696"; - vibrancy_darkness = "0.0"; - } - ]; - input-field = [ - { - size = "200, 50"; - position = "0, -80"; - monitor = cfg.primaryDisplay; - dots_center = true; - fade_on_empty = true; - font_color = "rgb(202, 211, 245)"; - inner_color = "rgb(91, 96, 120)"; - outer_color = "rgb(24, 25, 38)"; - bothlock_color = -1; - outline_thickness = 5; - placeholder_text = ''Password...''; - shadow_passes = 2; - } - ]; - }; - }; - }; -} diff --git a/modules/home/desktop/hyprland/services/hyprpaper/default.nix b/modules/home/desktop/hyprland/services/hyprpaper/default.nix deleted file mode 100644 index c480201..0000000 --- a/modules/home/desktop/hyprland/services/hyprpaper/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - config, - lib, - namespace, - ... -}: -let - cfg = config.${namespace}.desktop.hyprland; -in -{ - imports = [ ../../options.nix ]; - - config = lib.mkIf cfg.enable { - services.hyprpaper = { - enable = true; - settings = { - preload = [ "/run/wallpaper.jpg" ]; - wallpaper = ",/run/wallpaper.jpg"; - splash = false; - }; - }; - }; -} diff --git a/modules/home/desktop/hyprland/variables.nix b/modules/home/desktop/hyprland/variables.nix deleted file mode 100644 index ccba10d..0000000 --- a/modules/home/desktop/hyprland/variables.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ config, lib, ... }: -with lib; -let - cfg = config.mjallen.desktop.hyprland; -in -{ - config = mkIf cfg.enable { - home.sessionVariables = { - BROWSER = "${cfg.defaultApps.browser.pname}"; - CLUTTER_BACKEND = "wayland"; - EDITOR = "${cfg.defaultApps.editor.pname}"; - VISUAL = "${cfg.defaultApps.visual.pname}"; - ICON_THEME = cfg.iconThemeName; - GTK_CSD = "0"; - GTK_THEME = cfg.gtkThemeName; - GTK_USE_PORTAL = "1"; - HYPRCURSOR_THEME = config.home.pointerCursor.name; - HYPRCURSOR_SIZE = config.home.pointerCursor.size; - MOZ_ENABLE_WAYLAND = "1"; - NIXOS_OZONE_WL = "1"; - NIXOS_XDG_OPEN_USE_PORTAL = "1"; - QT_AUTO_SCREEN_SCALE_FACTOR = "1"; - QT_QPA_PLATFORM = "wayland-egl"; - QT_QPA_PLATFORMTHEME = "gtk3"; - QT_SCALE_FACTOR = "1"; - QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; - SDL_VIDEODRIVER = "wayland"; - TERMINAL = "${cfg.defaultApps.terminal.pname}"; - XCURSOR_THEME = config.home.pointerCursor.name; - XCURSOR_SIZE = config.home.pointerCursor.size; - XDG_CACHE_HOME = "\${HOME}/.cache"; - XDG_CONFIG_HOME = "\${HOME}/.config"; - XDG_CURRENT_DESKTOP = "Hyprland"; - XDG_DATA_HOME = "\${HOME}/.local/share"; - XDG_SESSION_DESKTOP = "Hyprland"; - XDG_SESSION_TYPE = "wayland"; - }; - }; -} diff --git a/modules/home/desktop/hyprland/default.nix b/modules/home/programs/hyprland/default.nix old mode 100755 new mode 100644 similarity index 84% rename from modules/home/desktop/hyprland/default.nix rename to modules/home/programs/hyprland/default.nix index e69af90..8d5cba1 --- a/modules/home/desktop/hyprland/default.nix +++ b/modules/home/programs/hyprland/default.nix @@ -6,27 +6,121 @@ }: with lib; let - cfg = config.mjallen.desktop.hyprland; + cfg = config.mjallen.programs.hyprland; drawer = "nwg-drawer -fm nautilus -term kitty -mb 10 -mt 10 -ml 10 -mr 10 -pbuseicontheme -i ${cfg.iconThemeName}"; in { imports = [ ./options.nix - ./packages.nix ./theme.nix - ./variables.nix ]; config = mkIf cfg.enable { + # Home packages + home.packages = with pkgs; [ + box64 + brightnessctl + ddcutil + dunst + egl-wayland + file-roller + glib + gnome-calculator + gnome-calendar + gnome-disk-utility + gnome-firmware + gnome-firmware-updater + gnome-font-viewer + gnome-logs + gnome-photos + gnome-tweaks + gnome-weather + gsettings-desktop-schemas + hyprcursor + hyprland + hyprpaper + hyprshot + hyprsysteminfo + kdePackages.qtmultimedia + libnotify + libz + mako + meson + nautilus + networkmanagerapplet + nm-tray + nomacs + nwg-look + overskride + pamixer + pavucontrol + playerctl + polkit + polkit_gnome + qt5.qtwayland + qt6.qtwayland + rofi-wayland + waybar + wayland-protocols + wayland-utils + waypaper + wev + wl-clipboard + wlogout + wlroots + xdg-desktop-portal-hyprland + xdg-desktop-portal-gtk + xdg-desktop-portal-wlr + xorg.xhost + xsettingsd + xwayland + pkgs.mjallen.pipewire-python + ]; + + # Session variables + home.sessionVariables = { + BROWSER = "${cfg.defaultApps.browser.pname}"; + CLUTTER_BACKEND = "wayland"; + EDITOR = "${cfg.defaultApps.editor.pname}"; + VISUAL = "${cfg.defaultApps.visual.pname}"; + ICON_THEME = cfg.iconThemeName; + GTK_CSD = "0"; + GTK_THEME = cfg.gtkThemeName; + GTK_USE_PORTAL = "1"; + HYPRCURSOR_THEME = config.home.pointerCursor.name; + HYPRCURSOR_SIZE = config.home.pointerCursor.size; + MOZ_ENABLE_WAYLAND = "1"; + NIXOS_OZONE_WL = "1"; + NIXOS_XDG_OPEN_USE_PORTAL = "1"; + QT_AUTO_SCREEN_SCALE_FACTOR = "1"; + QT_QPA_PLATFORM = "wayland-egl"; + QT_QPA_PLATFORMTHEME = "gtk3"; + QT_SCALE_FACTOR = "1"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + SDL_VIDEODRIVER = "wayland"; + TERMINAL = "${cfg.defaultApps.terminal.pname}"; + XCURSOR_THEME = config.home.pointerCursor.name; + XCURSOR_SIZE = config.home.pointerCursor.size; + XDG_CACHE_HOME = "\${HOME}/.cache"; + XDG_CONFIG_HOME = "\${HOME}/.config"; + XDG_CURRENT_DESKTOP = "Hyprland"; + XDG_DATA_HOME = "\${HOME}/.local/share"; + XDG_SESSION_DESKTOP = "Hyprland"; + XDG_SESSION_TYPE = "wayland"; + }; + + # Services services = { hyprpolkitagent.enable = true; }; + # Programs programs = { vscode.profiles.default.userSettings."window"."titleBarStyle" = "custom"; }; + # Wayland configuration wayland.windowManager.hyprland = { enable = true; xwayland.enable = true; @@ -159,6 +253,7 @@ in misc = { vrr = 1; + force_default_wallpaper = 0; }; general = { @@ -180,10 +275,6 @@ in new_optimizations = true; xray = false; }; - # drop_shadow = "yes"; - # shadow_range = 4; - # shadow_render_power = "3"; - # "col.shadow" = "rgba(1a1a1aee)"; }; animations = { @@ -209,10 +300,6 @@ in preserve_split = "yes"; }; - misc = { - force_default_wallpaper = 0; - }; - workspace = cfg.workspace; windowrule = [ @@ -263,7 +350,7 @@ in "float, class:(.*codium.*),title:(Save As)" "float, class:(xdg-desktop-portal-gtk),title:(Open Workspace from File)" - # Game Tearing??? https://wiki.hyprland.org/Configuring/Tearing/ + # Game Tearing??? https://wiki.hypr.land/Configuring/Tearing/ "immediate, class:(.*gamescope)" # vmware @@ -284,8 +371,6 @@ in "renderunfocused, tag:horizonrdp" "idleinhibit, tag:horizonrdp" "float, tag:horizonrdp" - # "size 2160 7680, tag:horizonrdp" - # "move onscreen 0 0, tag:horizonrdp" # float the vmware window cause its annoying to use in fullscreen "float, class:(.*[Hh]orizon-client),title:([Oo]mnissa [Hh]orizon [Cc]lient)" diff --git a/modules/home/desktop/hyprland/options.nix b/modules/home/programs/hyprland/options.nix similarity index 66% rename from modules/home/desktop/hyprland/options.nix rename to modules/home/programs/hyprland/options.nix index 5aac68e..fbec5be 100644 --- a/modules/home/desktop/hyprland/options.nix +++ b/modules/home/programs/hyprland/options.nix @@ -1,28 +1,32 @@ { lib, pkgs, ... }: with lib; { - options.mjallen.desktop.hyprland = { - enable = mkEnableOption "enable hyprland desktop"; + options.mjallen.programs.hyprland = { + enable = mkEnableOption "enable hyprland"; primaryDisplay = mkOption { type = types.str; default = "DP-1"; + description = "Primary display identifier"; }; display1 = { input = mkOption { type = types.str; default = "DP-1"; + description = "First display identifier"; }; resolution = mkOption { type = types.str; default = "3840x2160"; + description = "First display resolution"; }; refreshRate = mkOption { type = types.str; default = "240.00000"; + description = "First display refresh rate"; }; }; @@ -30,63 +34,68 @@ with lib; input = mkOption { type = types.str; default = "DP-1"; + description = "Second display identifier"; }; resolution = mkOption { type = types.str; default = "3840x2160"; + description = "Second display resolution"; }; refreshRate = mkOption { type = types.str; default = "240.00000"; + description = "Second display refresh rate"; }; }; wallpaper = mkOption { type = with types; listOf str; default = [ ]; - description = "list of hyprland wallpaper configs"; + description = "List of hyprland wallpaper configs"; }; monitor = mkOption { type = with types; listOf str; default = [ ]; - description = "list of hyprland monitor configs"; + description = "List of hyprland monitor configs"; }; monitorv2 = mkOption { type = with types; listOf str; default = [ ]; - description = "list of hyprland monitorv2 configs"; + description = "List of hyprland monitorv2 configs"; }; workspace = mkOption { type = with types; listOf str; default = [ ]; - description = "list of hyprland workspace definitions"; + description = "List of hyprland workspace definitions"; }; windowRule = mkOption { type = with types; listOf str; default = [ ]; - description = "list of hyprland window rules"; + description = "List of hyprland window rules"; }; extraConfig = mkOption { type = with types; str; default = ''''; - description = "any extra options"; + description = "Any extra configuration options"; }; iconThemeName = mkOption { type = types.str; default = "Colloid-Dark"; + description = "Icon theme name"; }; gtkThemeName = mkOption { type = types.str; default = "Colloid-Dark"; + description = "GTK theme name"; }; defaultApps = mkOption { @@ -95,52 +104,63 @@ with lib; browser = mkOption { type = types.package; default = pkgs.firefox; + description = "Default browser"; }; editor = mkOption { type = types.package; default = pkgs.micro; + description = "Default text editor"; }; fileExplorer = mkOption { type = types.package; default = pkgs.nemo; + description = "Default file explorer"; }; visual = mkOption { type = types.package; default = pkgs.vscodium; + description = "Default visual editor"; }; terminal = mkOption { type = types.package; default = pkgs.kitty; + description = "Default terminal"; }; office = mkOption { type = types.package; default = pkgs.onlyoffice-bin_latest; + description = "Default office suite"; }; video = mkOption { type = types.package; default = pkgs.vlc; + description = "Default video player"; }; imageViewer = mkOption { type = types.package; default = pkgs.nomacs; + description = "Default image viewer"; }; }; }; - description = "Default applications used across the system."; + description = "Default applications used across the system"; }; hyprIdle = { lockScreenTimer = mkOption { type = with types; int; default = 300; + description = "Time in seconds before locking the screen"; }; screenOffTimer = mkOption { type = with types; int; default = 900; + description = "Time in seconds before turning off the screen"; }; suspendTimer = mkOption { type = with types; int; default = 1800; + description = "Time in seconds before suspending"; }; }; }; diff --git a/modules/home/desktop/hyprland/theme.nix b/modules/home/programs/hyprland/theme.nix similarity index 91% rename from modules/home/desktop/hyprland/theme.nix rename to modules/home/programs/hyprland/theme.nix index fb6c8f9..b984383 100644 --- a/modules/home/desktop/hyprland/theme.nix +++ b/modules/home/programs/hyprland/theme.nix @@ -6,7 +6,7 @@ }: with lib; let - cfg = config.mjallen.desktop.hyprland; + cfg = config.mjallen.programs.hyprland; themeSize = "compact"; # [ "standard" "compact" ] themeAccent = "all"; # [ "default" "purple" "pink" "red" "orange" "yellow" "green" "teal" "grey" "all" ] @@ -21,10 +21,6 @@ let cursorSize = 24; # GTK - # gtkThemeSize = themeSize; - # gtkThemeAccent = themeAccent; - # gtkThemeVariant = themeVariant; - # gtkThemeColor = themeColor; gtkTheme = "Colloid-Dark-Compact-Nord"; gtkThemePkg = pkgs.colloid-gtk-theme.override { sizeVariants = [ themeSize ]; @@ -34,7 +30,6 @@ let }; # Icons - # iconThemeScheme = iconScheme; iconTheme = "Colloid-Nord-Dark"; iconThemePkg = pkgs.colloid-icon-theme.override { schemeVariants = [ iconScheme ]; diff --git a/modules/nixos/desktop/hyprland/default.nix b/modules/nixos/desktop/hyprland/default.nix index 251043e..2bf0dcc 100755 --- a/modules/nixos/desktop/hyprland/default.nix +++ b/modules/nixos/desktop/hyprland/default.nix @@ -8,18 +8,89 @@ let cfg = config.${namespace}.desktop.hyprland; + # Create a persistent directory for wallpapers + wallpaperDir = "/var/lib/wallpapers"; + + # Default fallback wallpaper (included in the system) + defaultWallpaper = pkgs.runCommand "default-wallpaper" {} '' + mkdir -p $out + cp ${pkgs.nixos-artwork.wallpapers.nineish-dark-gray}/share/backgrounds/nixos/nix-wallpaper-nineish-dark-gray.png $out/default.jpg + ''; + bing-wallpaper = pkgs.writeScriptBin "bing-wallpaper" '' # Directory to store wallpapers - IMG_PATH="/run/wallpaper.jpg" + WALLPAPER_DIR="${wallpaperDir}" + IMG_PATH="$WALLPAPER_DIR/current.jpg" + FALLBACK_PATH="$WALLPAPER_DIR/fallback.jpg" + + # Ensure directory exists + mkdir -p "$WALLPAPER_DIR" + + # Copy to the standard location for other services + ln -sf "$IMG_PATH" /run/wallpaper.jpg - # Download if not already downloaded - URL=$(curl -s "https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1" | \ - jq -r '.images[0].url') - FULL_URL="https://www.bing.com$URL" - curl -s -o "$IMG_PATH" "$FULL_URL" - echo "Downloaded $FULL_URL to $IMG_PATH successfully" + # Try to download new wallpaper + if curl -s --connect-timeout 5 --max-time 10 "https://www.bing.com" > /dev/null; then + URL=$(curl -s "https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1" | \ + jq -r '.images[0].url') + FULL_URL="https://www.bing.com$URL" + if curl -s -o "$IMG_PATH.tmp" "$FULL_URL"; then + mv "$IMG_PATH.tmp" "$IMG_PATH" + echo "Downloaded $FULL_URL to $IMG_PATH successfully" + else + echo "Failed to download Bing wallpaper, using previous or fallback" + # If current doesn't exist, use fallback + if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then + cp "$FALLBACK_PATH" "$IMG_PATH" + fi + fi + else + echo "Network unavailable, using previous or fallback wallpaper" + # If current doesn't exist, use fallback + if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then + cp "$FALLBACK_PATH" "$IMG_PATH" + fi + fi ''; + nasa-wallpaper = pkgs.writeScriptBin "nasa-wallpaper" '' + # Directory to store wallpapers + WALLPAPER_DIR="${wallpaperDir}" + IMG_PATH="$WALLPAPER_DIR/current.jpg" + FALLBACK_PATH="$WALLPAPER_DIR/fallback.jpg" + + # Ensure directory exists + mkdir -p "$WALLPAPER_DIR" + + # Copy to the standard location for other services + ln -sf "$IMG_PATH" /run/wallpaper.jpg + + # Try to download new wallpaper + if curl -s --connect-timeout 5 --max-time 10 "https://api.nasa.gov" > /dev/null; then + APOD_URL="https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY" + IMAGE_URL=$(curl -s "$APOD_URL" | jq -r '.hdurl // .url') + if curl -s -o "$IMG_PATH.tmp" "$IMAGE_URL"; then + mv "$IMG_PATH.tmp" "$IMG_PATH" + echo "Downloaded $IMAGE_URL to $IMG_PATH successfully" + else + echo "Failed to download NASA wallpaper, using previous or fallback" + # If current doesn't exist, use fallback + if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then + cp "$FALLBACK_PATH" "$IMG_PATH" + fi + fi + else + echo "Network unavailable, using previous or fallback wallpaper" + # If current doesn't exist, use fallback + if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then + cp "$FALLBACK_PATH" "$IMG_PATH" + fi + fi + ''; + + # Select the appropriate wallpaper script based on the configuration + wallpaper-script = if cfg.wallpaperSource == "nasa" then nasa-wallpaper else bing-wallpaper; + sddmThemeName = "sddm-astronaut-theme"; sddmThemePkg = pkgs.sddm-astronaut.override { embeddedTheme = "astronaut"; @@ -27,15 +98,53 @@ let Background = "/run/wallpaper.jpg"; }; }; + + # The script to use based on the selected wallpaper source + wallpaper-command = if cfg.wallpaperSource == "nasa" then "nasa-wallpaper" else "bing-wallpaper"; + + # System activation script to ensure wallpaper is available early in boot + wallpaper-activation-script = '' + # Create wallpaper directory if it doesn't exist + mkdir -p ${wallpaperDir} + + # Copy default wallpaper as fallback if it doesn't exist + if [ ! -f ${wallpaperDir}/fallback.jpg ]; then + cp ${defaultWallpaper}/default.jpg ${wallpaperDir}/fallback.jpg + fi + + # If no current wallpaper exists, use the fallback + if [ ! -f ${wallpaperDir}/current.jpg ]; then + cp ${wallpaperDir}/fallback.jpg ${wallpaperDir}/current.jpg + fi + + # Create symlink for Plymouth and SDDM + ln -sf ${wallpaperDir}/current.jpg /run/wallpaper.jpg + ''; in { - imports = [ ../../../home/desktop/hyprland/options.nix ]; + imports = [ ./options.nix ]; config = lib.mkIf cfg.enable { environment.systemPackages = [ bing-wallpaper + nasa-wallpaper pkgs.jq ]; + + # Add system activation script to ensure wallpaper is available early + system.activationScripts.wallpaper = wallpaper-activation-script; + + # Configure Plymouth to use the same wallpaper + boot.plymouth = { + enable = true; + themePackages = [ pkgs.plymouth-theme-breeze ]; + theme = "breeze"; + extraConfig = '' + ShowDelay=0 + DeviceTimeout=5 + DeviceScale=1 + ''; + }; services = { displayManager = { @@ -63,9 +172,7 @@ in }; dbus.enable = true; - ddccontrol.enable = false; - blueman.enable = true; }; @@ -81,7 +188,7 @@ in systemd = { services = { - preload-bing-wallpaper = { + preload-wallpaper = { enable = true; wants = [ "network-online.target" ]; after = [ "network-online.target" ]; @@ -96,18 +203,44 @@ in pkgs.jq pkgs.curl bing-wallpaper + nasa-wallpaper ]; script = '' - bing-wallpaper + ${wallpaper-command} ''; serviceConfig = { Type = "oneshot"; + TimeoutSec = "10s"; # Limit how long we wait for network + }; + }; + + # Create a service that runs very early in boot to ensure wallpaper is available + early-wallpaper-setup = { + enable = true; + description = "Setup wallpaper early in boot process"; + wantedBy = [ "multi-user.target" "plymouth-start.service" ]; + before = [ "plymouth-start.service" ]; + script = '' + # Ensure wallpaper directory exists + mkdir -p ${wallpaperDir} + + # If no current wallpaper exists, use the fallback + if [ ! -f ${wallpaperDir}/current.jpg ]; then + cp ${wallpaperDir}/fallback.jpg ${wallpaperDir}/current.jpg + fi + + # Create symlink for Plymouth and SDDM + ln -sf ${wallpaperDir}/current.jpg /run/wallpaper.jpg + ''; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; }; }; }; user = { services = { - reload-bing-wallpaper = { + reload-wallpaper = { enable = true; path = [ pkgs.bash @@ -115,9 +248,10 @@ in pkgs.curl pkgs.hyprland bing-wallpaper + nasa-wallpaper ]; script = '' - bing-wallpaper + ${wallpaper-command} ${pkgs.hyprland}/bin/hyprctl hyprpaper reload ,/run/wallpaper.jpg ''; serviceConfig = { @@ -127,15 +261,15 @@ in }; # Create a timer to run the service periodically timers = { - reload-bing-wallpaper = { - description = "Timer for reload-bing-wallpaper"; + reload-wallpaper = { + description = "Timer for reload-wallpaper"; wantedBy = [ "timers.target" ]; # Timer configuration timerConfig = { OnCalendar = "daily"; # Check every day Persistent = true; # Run immediately if last run was missed - Unit = "reload-bing-wallpaper.service"; + Unit = "reload-wallpaper.service"; }; }; }; diff --git a/modules/nixos/desktop/hyprland/options.nix b/modules/nixos/desktop/hyprland/options.nix new file mode 100644 index 0000000..41e40d3 --- /dev/null +++ b/modules/nixos/desktop/hyprland/options.nix @@ -0,0 +1,13 @@ +{ lib, ... }: +with lib; +{ + options.mjallen.desktop.hyprland = { + enable = mkEnableOption "enable hyprland desktop environment"; + + wallpaperSource = mkOption { + type = types.enum [ "bing" "nasa" ]; + default = "bing"; + description = "Source for the wallpaper (bing or nasa)"; + }; + }; +} diff --git a/systems/x86_64-linux/desktop/specialisations/hyprland/default.nix b/systems/x86_64-linux/desktop/specialisations/hyprland/default.nix index f647dec..4235cd3 100755 --- a/systems/x86_64-linux/desktop/specialisations/hyprland/default.nix +++ b/systems/x86_64-linux/desktop/specialisations/hyprland/default.nix @@ -5,7 +5,10 @@ home-manager.users.matt = import ./home/default.nix; ${namespace} = { desktop = { - hyprland.enable = true; + hyprland = { + enable = true; + wallpaperSource = "nasa"; + }; gnome.enable = lib.mkForce false; }; }; diff --git a/systems/x86_64-linux/desktop/specialisations/hyprland/home/default.nix b/systems/x86_64-linux/desktop/specialisations/hyprland/home/default.nix index 8e67b02..de68912 100644 --- a/systems/x86_64-linux/desktop/specialisations/hyprland/home/default.nix +++ b/systems/x86_64-linux/desktop/specialisations/hyprland/home/default.nix @@ -1,8 +1,5 @@ { pkgs, lib, ... }: let - theme = import (lib.snowfall.fs.get-file "modules/home/desktop/theme/nord.nix"); - fontName = "JetBrainsMono NFM"; - fontPackage = pkgs.nerd-fonts.jetbrains-mono; displayLeft = { input = "DP-1"; resolution = "3840x2160"; @@ -15,9 +12,8 @@ let }; in { - mjallen = { - desktop.hyprland = { + programs.hyprland = { enable = true; primaryDisplay = "DP-1"; @@ -53,18 +49,19 @@ in browser = pkgs.firefox; }; }; + programs = { btop.enable = true; kitty = { enable = true; font = { - name = fontName; - package = fontPackage; + name = "JetBrainsMono NFM"; + package = pkgs.nerd-fonts.jetbrains-mono; }; }; mako = { enable = true; - fontName = fontName; + fontName = "JetBrainsMono NFM"; }; nwg-dock.enable = true; nwg-drawer.enable = true; @@ -109,14 +106,14 @@ in extraModulesStyle = '' #custom-lights { - color: ${theme.frost.nord8}; - background-color: ${theme.polarNight.nord0}; - ${theme.defaultOpacity} - ${theme.borderLeft} + color: #88c0d0; + background-color: #2e3440; + opacity: 0.8; + border-left: 5px solid #88c0d0; } #custom-lights:hover { - background: ${theme.polarNight.nord3}; + background: #4c566a; } ''; };