{ pkgs, lib, osConfig, ... }: let flakestat = pkgs.writeShellApplication { name = "flakestat"; runtimeInputs = with pkgs; [ git jq ]; text = builtins.readFile ./flakestat.sh; }; arrhist = pkgs.stdenv.mkDerivation { name = "arrhist"; propagatedBuildInputs = [ (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [ requests ])) ]; src = ./arrhist.py; dontUnpack = true; installPhase = "install -Dm755 ${./arrhist.py} $out/bin/arrhist"; }; withArrhist = if (osConfig.system.name == "gunter") then true else false; withBattery = if (osConfig.system.name == "magicman") then true else false; in { sops.secrets."sonarr_base_url" = { }; sops.secrets."sonarr_api_key" = { }; sops.secrets."radarr_base_url" = { }; sops.secrets."radarr_api_key" = { }; xdg.configFile."waybar/macchiato.css" = { source = pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "waybar"; rev = "f74ab1eecf2dcaf22569b396eed53b2b2fbe8aff"; sha256 = "WLJMA2X20E5PCPg0ZPtSop0bfmu+pLImP9t8A8V4QK8="; } + "/themes/macchiato.css"; }; programs.waybar = { enable = true; systemd = { enable = false; # disable it,autostart it in hyprland conf target = "graphical-session.target"; }; style = '' @import "macchiato.css"; * { border: none; border-radius: 10px; min-height: 10px; font-family: "JetbrainsMono Nerd Font"; font-size: 15px; transition-property: background-color; transition-duration: 0.5s; color: @text; } window#waybar { background: transparent; } window#waybar.hidden { opacity: 0.2; } #window { margin-top: 6px; padding-left: 10px; padding-right: 10px; border-radius: 10px; transition: none; color: transparent; background: transparent; } @keyframes blink_red { to { background-color: @red; } } .warning, .critical, .urgent { animation-name: blink_red; animation-duration: 1s; animation-timing-function: linear; animation-iteration-count: infinite; animation-direction: alternate; } #workspaces { padding-left: 12px; padding-right: 12px; background-color: @base; } #workspaces button { padding-left: 12px; padding-right: 12px; } #workspaces button.active { background-color: @surface1; } #workspaces button.urgent { color: alpha(@red, 0.4); } #workspaces button:hover { background-color: @surface2; } tooltip { background-color: @base; } tooltip label { color: @text; } #custom-launcher { font-size: 15px; padding-left: 5px; padding-right: 12px; background-color: @base; } .modules-right { background-color: @base; } #mode, #clock, #memory, #temperature, #cpu, #mpd, #custom-wall, #temperature, #backlight, #pulseaudio, #network, #battery, #custom-powermenu, #custom-flakestat, #custom-arrhist { padding-left: 12px; padding-right: 12px; } #battery.charging, #battery.full, #battery.discharging { color: @maroon; } #battery.critical:not(.charging) { color: @red; } ''; settings = [ ({ "layer" = "top"; "position" = "top"; modules-left = [ "custom/flakestat" ]; modules-center = [ "hyprland/workspaces" ]; modules-right = [ (lib.mkIf (withArrhist) "custom/arrhist") "pulseaudio" "pulseaudio#microphone" "memory" "cpu" "tray" (lib.mkIf (withBattery) "battery") "clock" ]; "hyprland/workspaces" = { "format" = "{name}"; "on-click" = "activate"; "on-scroll-up" = "hyprctl dispatch workspace e+1"; "on-scroll-down" = "hyprctl dispatch workspace e-1"; }; "pulseaudio" = { "scroll-step" = 5; "format" = "{icon} {volume}%"; "format-muted" = ""; "format-icons" = { "default" = [ "" "" "" ]; }; "on-click" = "pamixer -t"; }; "pulseaudio#microphone" = { "format" = "{format_source}"; "format-source" = " {volume}%"; "format-source-muted" = ""; "on-click" = "pamixer --default-source -t"; "on-scroll-up" = "pamixer --default-source -i 5"; "on-scroll-down" = "pamixer --default-source -d 5"; "scroll-step" = 5; "on-click-right" = "pavucontrol"; }; "clock" = { "interval" = 1; "format" = "{:%H:%M %A %b %d}"; "tooltip" = true; }; "memory" = { "interval" = 3; "format" = " {percentage}%"; "states" = { "warning" = 85; }; }; "cpu" = { "interval" = 3; "format" = " {usage}%"; }; "tray" = { "icon-size" = 15; "spacing" = 6; }; "battery" = { "interval" = 60; "states" = { "warning" = 20; "critical" = 5; }; "format" = "{icon} {capacity}%"; "format-icons" = [ "" "" "" "" "" ]; }; "custom/flakestat" = { "exec" = "${flakestat}/bin/flakestat"; "format" = " {}"; "return-type" = "json"; "interval" = 600; }; } // lib.optionalAttrs (withArrhist) { "custom/arrhist" = { "exec" = "${arrhist}/bin/arrhist"; "return-type" = "json"; "interval" = 600; }; }) ]; }; }