nixos-configs/modules/greetd/hyprland.nix
matt1432 e8e534a4ad
All checks were successful
Discord / discord commits (push) Has been skipped
fix(greetd): add necessary newline to hyprland conf
2024-06-12 10:13:43 -04:00

95 lines
1.9 KiB
Nix

{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
boolToString
concatStringsSep
filterAttrs
hasPrefix
isAttrs
isBool
mapAttrsToList
optionalString
;
inherit (config.vars) mainUser;
inherit (import ./setupMonitors.nix {inherit config pkgs;}) setupMonitors;
# Nix stuff
cfgHypr = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland;
devices = filterAttrs (n: v: hasPrefix "device:" n) cfgHypr.settings;
monitors = cfgHypr.settings.monitor;
inputs = cfgHypr.settings.input;
misc = cfgHypr.settings.misc;
mkHyprBlock = attrs:
concatStringsSep "\n" (mapAttrsToList (
n: v:
if (isAttrs v)
then ''
${n} {
${mkHyprBlock v}
}
''
else if (isBool v)
then " ${n}=${boolToString v}"
else " ${n}=${toString v}"
)
attrs);
in {
hyprConf = pkgs.writeText "greetd-hypr-config" (
(optionalString config.nvidia.enable
# hyprlang
''
env = LIBVA_DRIVER_NAME,nvidia
env = XDG_SESSION_TYPE,wayland
env = GBM_BACKEND,nvidia-drm
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = WLR_NO_HARDWARE_CURSORS,1
'')
+ (concatStringsSep "\n" (map (x: "monitor=${x}") monitors))
+ "\n"
+
# hyprlang
''
misc {
${mkHyprBlock misc}
}
# Devices
${mkHyprBlock devices}
input {
${mkHyprBlock inputs}
}
''
+
# hyprlang
''
#
env = XCURSOR_SIZE,24
exec-once = hyprctl setcursor Dracula-cursors 24
general {
border_size = 0
}
decoration {
blur {
enabled = false
}
drop_shadow = false
}
exec-once = ${setupMonitors}
exec-once = astal -b greeter &> /tmp/astal.log; hyprctl dispatch exit
''
);
}