nixos-configs/modules/greetd/hyprland.nix
matt1432 88d5d1bdd8
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: get rid of isNvidia
2024-03-03 17:34:21 -05:00

99 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))
+
/*
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 = ags -b greeter &> /tmp/ags.log; hyprctl dispatch exit
''
);
}