hyprland: use shared desktop modules from GitHub

Pin illustris/flake to e09318c and consume its common Home Manager and NixOS Hyprland modules. Keep NVIDIA and monitor-specific settings, HDR controls and LG recovery in the desktop overrides.

Remove the duplicated controller, panel, scripts and Waybar patches, update the regression test and documentation, and normalize Nix indentation to tabs with lib.indent for embedded scripts.
This commit is contained in:
illustris committed 2026-10-04 11:10:28 +05:30
1 parent 3fcf3c9c57
commit 96d459a1a1
18 files changed
+273 -1901

No files matched your search

+28 -431
View File
@@ -1,433 +1,30 @@
{ ... }:
{
config,
lib,
pkgs,
...
}:
let
target = "wayland-session@hyprland.desktop.target";
panel = pkgs.writeScriptBin "desktop-panel" ''
#!${lib.getExe pkgs.python3}
${builtins.readFile ./panel.py}
'';
# NVIDIA's EGL surface cleanup can spin after resume; keep the locker on Mesa.
lockPackage = pkgs.symlinkJoin {
name = "hyprlock-software";
paths = [ pkgs.hyprlock ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram "$out/bin/hyprlock" \
--set LIBGL_ALWAYS_SOFTWARE 1 \
--set __EGL_VENDOR_LIBRARY_FILENAMES ${pkgs.mesa}/share/glvnd/egl_vendor.d/50_mesa.json
'';
meta = pkgs.hyprlock.meta;
};
ctl = pkgs.writeShellApplication {
name = "desktopctl";
runtimeInputs =
with pkgs;
[
hyprland
jq
wofi
uwsm
systemd
]
++ [
lockPackage
panel
];
text = builtins.readFile ./desktopctl.sh;
};
screenshot = pkgs.writeShellApplication {
name = "desktop-screenshot";
runtimeInputs = with pkgs; [
grim
slurp
wl-clipboard
hyprland
jq
libnotify
];
text = builtins.readFile ./screenshot.sh;
};
clipboard = pkgs.writeShellApplication {
name = "desktop-clipboard";
runtimeInputs = with pkgs; [
cliphist
wofi
wl-clipboard
];
text = ''
choice=$(cliphist list | wofi --dmenu --prompt Clipboard) || exit 0
[ -n "$choice" ] || exit 0
printf '%s\n' "$choice" | cliphist decode | wl-copy
'';
};
tools = {
terminal = lib.getExe pkgs.st;
launcher = "${lib.getExe pkgs.wofi} --show drun";
files = lib.getExe pkgs.kdePackages.dolphin;
clipboard = lib.getExe clipboard;
lock = lib.getExe lockPackage;
screenshot = lib.getExe screenshot;
menu = "${lib.getExe ctl} menu";
help = "${lib.getExe ctl} help";
volume = "${pkgs.wireplumber}/bin/wpctl";
player = lib.getExe pkgs.playerctl;
};
isolated = {
Unit = {
PartOf = lib.mkForce [ target ];
After = lib.mkForce [ target ];
};
Install.WantedBy = lib.mkForce [ target ];
};
wallpaper = "/home/illustris/Downloads/adrien-olichon-RCAhiGJsUUE-unsplash.jpg";
in
{
home.packages = with pkgs; [
ctl
screenshot
clipboard
wl-clipboard
cliphist
grim
slurp
wofi
hyprpaper
pavucontrol
playerctl
networkmanagerapplet
blueman
udiskie
kdePackages.kdeconnect-kde
kdePackages.breeze
kdePackages.breeze-icons
kdePackages.qtwayland
xdg-utils
];
wayland.systemd.target = target;
wayland.windowManager.hyprland = {
enable = true;
configType = "lua";
systemd.enable = false;
extraLuaFiles = {
geometry = {
content = ./geometry.lua;
autoLoad = false;
};
desktop = {
content = ./desktop.lua;
autoLoad = false;
};
bindings = {
content = ./bindings.lua;
autoLoad = false;
};
};
extraConfig = ''
package.path = ${lib.generators.toLua { } (config.xdg.configHome + "/hypr/?.lua;")} .. package.path
tools = ${lib.generators.toLua { } tools}
require("desktop")
require("bindings")
'';
};
programs.wofi = {
enable = true;
settings = {
width = 600;
height = 480;
allow_images = true;
insensitive = true;
term = "st";
};
style = ''
window { background: #232629; color: #eff0f1; border: 1px solid #00ccff; }
#input { background: #31363b; color: #eff0f1; margin: 10px; border: 0; border-radius: 0; }
#entry { padding: 8px 12px; }
#entry:selected { background: #00576b; }
#text:selected { color: #eff0f1; }
'';
};
# The pinned Firefox/GTK build crashes in xdg_output_handle_name on native Wayland.
# At scale 1 XWayland stays sharp, and this wrapper only changes Hyprland sessions.
programs.firefox.package = pkgs.firefox.overrideAttrs (old: {
makeWrapperArgs = old.makeWrapperArgs ++ [
"--run"
''
if [ "''${XDG_CURRENT_DESKTOP:-}" = Hyprland ]; then
export GDK_BACKEND=x11 MOZ_ENABLE_WAYLAND=0
fi
''
];
});
services = {
dunst = {
enable = true;
settings.global = {
font = "Noto Sans 11";
frame_color = "#00ccff";
background = "#232629";
foreground = "#eff0f1";
frame_width = 1;
corner_radius = 2;
origin = "top-right";
offset = "16x16";
width = 420;
};
};
cliphist = {
enable = true;
allowImages = true;
systemdTargets = [ target ];
};
hyprpaper = {
enable = true;
systemdTarget = target;
settings = {
ipc = true;
splash = false;
wallpaper = [
{
monitor = "";
path = wallpaper;
fit_mode = "cover";
}
];
};
};
network-manager-applet.enable = true;
blueman-applet = {
enable = true;
systemdTargets = [ target ];
};
polkit-gnome.enable = true;
udiskie = {
enable = true;
tray = "auto";
};
hypridle = {
enable = true;
systemdTarget = target;
settings = {
general = {
lock_cmd = "pidof hyprlock || ${lib.getExe pkgs.uwsm} app -- ${lib.getExe lockPackage}";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "${lib.getExe ctl} wake";
ignore_dbus_inhibit = false;
};
listener = [
{
timeout = 420;
on-timeout = "loginctl lock-session";
}
{
timeout = 480;
on-timeout = "${lib.getExe ctl} sleep";
on-resume = "${lib.getExe ctl} wake";
}
];
};
};
};
programs.hyprlock = {
enable = true;
package = lockPackage;
settings = {
general = {
hide_cursor = true;
ignore_empty_input = true;
screencopy_mode = 1;
};
auth.pam.enabled = true;
background = [
{
monitor = "";
path = wallpaper;
blur_passes = 2;
blur_size = 6;
}
];
input-field = [
{
monitor = "";
size = "360, 52";
outline_thickness = 2;
outer_color = "rgb(00ccff)";
inner_color = "rgb(232629)";
font_color = "rgb(eff0f1)";
placeholder_text = "Password";
position = "0, -100";
halign = "center";
valign = "center";
}
];
label = [
{
monitor = "";
text = "$TIME";
font_family = "Noto Sans";
font_size = 72;
color = "rgb(eff0f1)";
position = "0, 80";
halign = "center";
valign = "center";
}
];
};
};
programs.waybar = {
enable = true;
package = pkgs.waybar.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [
./waybar-lua.patch
./waybar-ipc.patch
];
});
systemd = {
enable = true;
targets = [ target ];
};
settings.main = {
layer = "top";
position = "bottom";
height = 32;
spacing = 6;
modules-left = [
"custom/menu"
"hyprland/workspaces"
"custom/layout"
"wlr/taskbar"
];
modules-center = [ "clock" ];
modules-right = [
"mpris"
"idle_inhibitor"
"pulseaudio"
"network"
"bluetooth"
"tray"
];
"custom/menu" = {
format = "Apps";
on-click = tools.launcher;
on-click-right = tools.menu;
tooltip = false;
};
"hyprland/workspaces" = {
all-outputs = true;
sort-by-number = true;
move-to-monitor = true;
};
"custom/layout" = {
exec = lib.getExe panel;
return-type = "json";
restart-interval = 1;
on-click = "${lib.getExe ctl} cycle";
on-click-right = tools.menu;
};
"wlr/taskbar" = {
format = "{icon} {title}";
icon-size = 18;
max-length = 28;
on-click = "activate";
on-click-middle = "close";
tooltip-format = "{app_id}: {title}";
};
clock = {
format = "{:%a %d %b %H:%M}";
tooltip-format = "<tt>{calendar}</tt>";
};
mpris = {
format = "{artist} - {title}";
max-length = 35;
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = "Keep Awake: On";
deactivated = "Keep Awake: Off";
};
tooltip = true;
tooltip-format-activated = "Automatic locking and display sleep are paused. Click to resume.";
tooltip-format-deactivated = "Automatic locking and display sleep are enabled. Click to keep awake.";
};
pulseaudio = {
format = "Vol {volume}%";
format-muted = "Muted";
on-click = "pavucontrol";
on-click-right = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
};
network = {
format-ethernet = "LAN";
format-wifi = "{essid} {signalStrength}%";
format-disconnected = "Offline";
tooltip-format = "{ifname}: {ipaddr}";
on-click = "nm-connection-editor";
};
bluetooth = {
format = "BT {status}";
on-click = "blueman-manager";
};
tray = {
icon-size = 20;
spacing = 8;
};
};
style = ''
* { font-family: "Noto Sans"; font-size: 12px; border: none; border-radius: 0; min-height: 0; }
window#waybar { background: #232629; color: #eff0f1; border-top: 1px solid #4d5257; }
#workspaces button { padding: 0 10px; color: #bdc3c7; background: transparent; }
#workspaces button.active { color: #00ccff; background: #31363b; border-bottom: 2px solid #00ccff; }
#workspaces button.urgent { background: #da4453; }
#custom-menu, #custom-layout, #clock, #pulseaudio, #network, #bluetooth, #idle_inhibitor, #mpris, #tray { padding: 0 8px; }
#custom-layout { color: #00ccff; }
#idle_inhibitor.activated { color: #00ccff; }
#taskbar button { padding: 0 8px; color: #bdc3c7; }
#taskbar button.active { background: #31363b; color: #eff0f1; }
tooltip { background: #31363b; color: #eff0f1; }
'';
};
systemd.user.services = {
waybar = isolated;
network-manager-applet = isolated;
polkit-gnome = isolated;
udiskie = isolated;
dunst.Install.WantedBy = [ target ];
dunst.Unit.ConditionEnvironment = "XDG_CURRENT_DESKTOP=Hyprland";
kdeconnect-hyprland = {
Unit = {
Description = "KDE Connect for Hyprland";
PartOf = [ target ];
After = [ target ];
};
Service.ExecStart = "${pkgs.kdePackages.kdeconnect-kde}/bin/kdeconnect-indicator";
Install.WantedBy = [ target ];
};
};
# These packages also install XDG autostarts; the Hyprland units own their lifecycle.
xdg.configFile = {
"autostart/nm-applet.desktop".text = ''
[Desktop Entry]
Type=Application
Name=NetworkManager Applet
Exec=${pkgs.networkmanagerapplet}/bin/nm-applet
NotShowIn=KDE;GNOME;COSMIC;Hyprland;
'';
"autostart/blueman.desktop".text = ''
[Desktop Entry]
Type=Application
Name=Blueman Applet
Exec=${pkgs.blueman}/bin/blueman-applet
NotShowIn=Hyprland;
'';
"autostart/picom.desktop".text = ''
[Desktop Entry]
Type=Application
Name=picom
Exec=${pkgs.picom}/bin/picom
NotShowIn=Hyprland;
'';
};
illustris.hyprland = {
wallpaper = "/home/illustris/Downloads/adrien-olichon-RCAhiGJsUUE-unsplash.jpg";
softwareRendering = true;
xwaylandFirefox = true;
compositorSettings.cursor.no_hardware_cursors = true;
monitorRules = [ ];
monitorKeys = {
W = "oled";
E = "lg";
};
extraLuaConfig = ''require("outputs")'';
extraCommands = {
dual = "desktop.display_profile(true)";
solo = "desktop.display_profile(false)";
hdr = "desktop.hdr_toggle()";
};
extraMenuEntries = {
"Dual monitors" = "dual";
"OLED only" = "solo";
"Toggle HDR" = "hdr";
"Retrain LG HDMI" = "wake";
};
};
wayland.windowManager.hyprland.extraLuaFiles.outputs = {
content = ./outputs.lua;
autoLoad = false;
};
}