personal nixos config and packages
at main 11 kB view raw
1# additional @args needed to forward systemdSupport to mkWrapper 2{ 3 pkgs, 4 lib, 5 mkWrapper, 6 theme, 7 waybar, 8 pavucontrol, 9 networkmanagerapplet, 10 ... 11}@args: 12let 13 cfg = pkgs.writeText "config.jsonc" '' 14 { 15 "layer": "top", // Waybar at top layer 16 // "position": "bottom", // Waybar position (top|bottom|left|right) 17 "height": 26, // Waybar height (to be removed for auto height) 18 // "width": 1280, // Waybar width 19 "spacing": 4, // Gaps between modules (4px) 20 "margin-top": 4, 21 "margin-left": 4, 22 "margin-right": 4, 23 24 "modules-left": [ 25 "niri/workspaces" 26 ], 27 28 "modules-center": [ 29 "niri/window" 30 ], 31 32 "modules-right": [ 33 // "mpd", 34 // "idle_inhibitor", 35 // "power-profiles-daemon", 36 // "cpu", 37 // "memory", 38 // "temperature", 39 // "backlight", 40 // "keyboard-state", 41 // "sway/language", 42 "pulseaudio", 43 "network", 44 "battery", 45 // "battery#bat2", 46 "clock", 47 "tray" 48 ], 49 50 "sway/mode": { 51 "format": "<span style=\"italic\">{}</span>" 52 }, 53 54 "sway/scratchpad": { 55 "format": "{icon} {count}", 56 "show-empty": false, 57 "format-icons": ["", ""], 58 "tooltip": true, 59 "tooltip-format": "{app}: {title}" 60 }, 61 62 "mpd": { 63 "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) {songPosition}|{queueLength} {volume}% ", 64 "format-disconnected": "Disconnected ", 65 "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ", 66 "unknown-tag": "N/A", 67 "interval": 5, 68 "consume-icons": { 69 "on": " " 70 }, 71 "random-icons": { 72 "off": "<span color=\"#f53c3c\"></span> ", 73 "on": " " 74 }, 75 "repeat-icons": { 76 "on": " " 77 }, 78 "single-icons": { 79 "on": "1 " 80 }, 81 "state-icons": { 82 "paused": "", 83 "playing": "" 84 }, 85 "tooltip-format": "MPD (connected)", 86 "tooltip-format-disconnected": "MPD (disconnected)" 87 }, 88 "idle_inhibitor": { 89 "format": "{icon}", 90 "format-icons": { 91 "activated": "", 92 "deactivated": "" 93 } 94 }, 95 "tray": { 96 "icon-size": 16, 97 "spacing": 10 98 }, 99 "clock": { 100 "format": "{:%H:%M}", 101 "format-alt": "{:%A, %B %d, %R}", 102 "tooltip-format": "<tt><small>{calendar}</small></tt>", 103 "calendar": { 104 "mode" : "year", 105 "mode-mon-col" : 3, 106 "on-scroll" : 1, 107 "format": { 108 "months": "<span color='#ffead3'><b>{}</b></span>", 109 "days": "<span color='#ecc6d9'><b>{}</b></span>", 110 "weeks": "<span color='#99ffdd'><b>W{}</b></span>", 111 "weekdays": "<span color='#ffcc66'><b>{}</b></span>", 112 "today": "<span color='#ff6699'><b><u>{}</u></b></span>" 113 } 114 }, 115 "actions": { 116 "on-click-right": "mode", 117 "on-scroll-up": "tz_up", 118 "on-scroll-down": "tz_down", 119 "on-scroll-up": "shift_up", 120 "on-scroll-down": "shift_down" 121 } 122 }, 123 "cpu": { 124 "format": "{usage}% ", 125 "tooltip": false 126 }, 127 "memory": { 128 "format": "{}% " 129 }, 130 "temperature": { 131 // "thermal-zone": 2, 132 // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", 133 "critical-threshold": 80, 134 // "format-critical": "{temperatureC}°C {icon}", 135 "format": "{temperatureC}°C {icon}", 136 "format-icons": ["", "", ""] 137 }, 138 "backlight": { 139 // "device": "acpi_video1", 140 "format": "{percent}% {icon}", 141 "format-icons": ["", "", "", "", "", "", "", "", ""] 142 }, 143 "battery": { 144 "states": { 145 "good": 95, 146 "warning": 30, 147 "critical": 15 148 }, 149 "format": "{capacity}% {icon} ", 150 "format-full": "{capacity}% {icon} ", 151 "format-charging": "{capacity}% ", 152 "format-plugged": "{capacity}% ", 153 "format-alt": "{time} {icon}", 154 "format-icons": ["", "", "", "", ""] 155 }, 156 "power-profiles-daemon": { 157 "format": "{icon}", 158 "tooltip-format": "Power profile: {profile}\nDriver: {driver}", 159 "tooltip": true, 160 "format-icons": { 161 "default": "", 162 "performance": "", 163 "balanced": "", 164 "power-saver": "" 165 } 166 }, 167 "network": { 168 // "interface": "wlp2*", // (Optional) To force the use of this interface 169 // "format-wifi": "{essid} ({signalStrength}%) ", 170 "format-wifi": "{signalStrength}% ", 171 "format-ethernet": "{ipaddr}/{cidr} ", 172 "tooltip-format": "{ifname} via {gwaddr} ", 173 "format-linked": "{ifname} (No IP) ", 174 "format-disconnected": "Disconnected ", 175 // "format-alt": "{ifname}: {ipaddr}/{cidr}", 176 "on-click": "${lib.getExe' networkmanagerapplet "nm-connection-editor"}" 177 }, 178 "pulseaudio": { 179 "scroll-step": 1, // %, can be a float 180 "format": "{volume}% {icon} {format_source}", 181 "format-bluetooth": "{volume}% {icon} {format_source}", 182 "format-bluetooth-muted": "{icon} {format_source}", 183 "format-muted": "{format_source}", 184 "format-source": "{volume}% ", 185 "format-source-muted": "", 186 "format-icons": { 187 "headphone": "", 188 "hands-free": "", 189 "headset": "", 190 "phone": "", 191 "portable": "", 192 "car": "", 193 "default": ["", "", ""] 194 }, 195 "on-click": "${lib.getExe pavucontrol}" 196 }, 197 "custom/media": { 198 "format": "{icon} {}", 199 "return-type": "json", 200 "max-length": 40, 201 "format-icons": { 202 "spotify": "", 203 "default": "🎜" 204 }, 205 "escape": true, 206 "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder 207 // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name 208 }, 209 "custom/power": { 210 "format" : " ", 211 "tooltip": false, 212 "menu": "on-click", 213 "menu-file": "$HOME/.config/waybar/power_menu.xml", // Menu file in resources folder 214 "menu-actions": { 215 "shutdown": "shutdown", 216 "reboot": "reboot", 217 "suspend": "systemctl suspend", 218 "hibernate": "systemctl hibernate" 219 } 220 } 221 } 222 ''; 223 style = pkgs.writeText "style.css" '' 224 * { 225 font-family: "sans-serif", "Noto Monochrome Emoji", "Font Awesome 5 Pro Solid", "Font Awesome 5 Brands"; 226 font-size: ${theme.lengths.font-md}px; 227 font-weight: 600; 228 color: #${theme.colors.fg-regular}; 229 } 230 231 /* Reset styling for buttons */ 232 button { 233 all: unset; 234 } 235 236 window#waybar { 237 background: transparent; 238 } 239 240 #workspaces button.focused, 241 #workspaces button:hover { 242 border-color: #${theme.colors.cyan}; 243 } 244 245 #workspaces button.urgent { 246 border-color: #${theme.colors.red}; 247 } 248 249 #mode, 250 #clock, 251 #battery, 252 #cpu, 253 #memory, 254 #disk, 255 #temperature, 256 #backlight, 257 #network, 258 #pulseaudio, 259 #wireplumber, 260 #custom-media, 261 #tray, 262 #mode, 263 #idle_inhibitor, 264 #scratchpad, 265 #power-profiles-daemon, 266 #mpd, 267 #window, 268 #workspaces button { 269 padding: 4px 8px; 270 background-color: #${theme.colors.bg-regular}; 271 border-style: solid; 272 border-width: ${theme.lengths.border-width}px; 273 border-radius: ${theme.lengths.border-radius}px; 274 border-color: #${theme.colors.gray}; 275 } 276 277 /* Add spacing in between each workspace button */ 278 #workspaces button { 279 margin-right: 4px; 280 } 281 282 /* Prevent duplicated margin from rightmost workspace button */ 283 #workspaces button:last-child { 284 margin-right: 0; 285 } 286 287 #waybar.empty #window { 288 background-color: transparent; 289 border-width: 0px 290 } 291 292 #clock { 293 color: #${theme.colors.purple}; 294 } 295 296 #clock:hover { 297 border-color: #${theme.colors.purple}; 298 } 299 300 #battery { 301 color: #${theme.colors.green}; 302 } 303 304 #battery:hover { 305 border-color: #${theme.colors.green}; 306 } 307 308 #battery.charging { 309 border-color: #${theme.colors.green}; 310 } 311 312 @keyframes blink { 313 to { 314 border-color: #${theme.colors.red}; 315 } 316 } 317 318 /* Using steps() instead of linear as a timing function to limit cpu usage */ 319 #battery.critical:not(.charging) { 320 color: #${theme.colors.red}; 321 animation-name: blink; 322 animation-duration: 0.5s; 323 animation-timing-function: steps(12); 324 animation-iteration-count: infinite; 325 animation-direction: alternate; 326 } 327 328 #network { 329 color: #${theme.colors.blue}; 330 } 331 332 #network:hover { 333 border-color: #${theme.colors.blue}; 334 } 335 336 #network.disconnected { 337 border-color: #${theme.colors.red}; 338 } 339 340 #pulseaudio { 341 color: #${theme.colors.yellow}; 342 } 343 344 #pulseaudio:hover { 345 border-color: #${theme.colors.yellow}; 346 } 347 348 #pulseaudio.muted { 349 border-color: #${theme.colors.red}; 350 } 351 ''; 352 passThruArgs = builtins.removeAttrs args [ 353 "pkgs" 354 "lib" 355 "mkWrapper" 356 "theme" 357 "waybar" 358 "pavucontrol" 359 "networkmanagerapplet" 360 ]; 361in 362mkWrapper { 363 pkg = waybar.override passThruArgs; 364 waybar.prependFlags = [ 365 "--config" 366 "${cfg}" 367 "--style" 368 "${style}" 369 ]; 370}