nixos-configs/modules/greetd/hyprland.nix

95 lines
1.9 KiB
Nix
Raw Normal View History

{
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" (
2024-03-03 17:34:21 -05:00
(optionalString config.nvidia.enable
2024-06-09 22:49:30 -04:00
# 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"
+
2024-06-09 22:49:30 -04:00
# hyprlang
''
misc {
${mkHyprBlock misc}
}
# Devices
${mkHyprBlock devices}
input {
${mkHyprBlock inputs}
}
''
+
2024-06-09 22:49:30 -04:00
# hyprlang
''
2024-06-09 22:49:30 -04:00
#
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}
2024-03-24 13:54:33 -04:00
exec-once = astal -b greeter &> /tmp/astal.log; hyprctl dispatch exit
''
);
}