nix-config/modules/desktops/hyprland.nix
2023-10-14 18:53:32 +02:00

95 lines
2.2 KiB
Nix

#
# Hyprland Configuration
# Enable with "hyprland.enable = true;"
#
{
config,
lib,
system,
pkgs,
unstable,
hyprland,
vars,
host,
split-monitor-workspaces,
...
}:
with lib;
with host; {
options = {
hyprland = {
enable = mkOption {
type = types.bool;
default = false;
};
};
};
config = mkIf (config.hyprland.enable) {
environment = {
systemPackages = with pkgs; [
grim # Grab Images
slurp # Region Selector
wl-clipboard # Clipboard
wlr-randr # Monitor Settings
dunst
hyprpaper
waybar
];
# sessionVariables = {
# "NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland
# "MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
# "MOZ_WEBRENDER" = "1";
#
# # for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
# "LIBVA_DRIVER_NAME" = "nvidia";
# "XDG_SESSION_TYPE" = "wayland";
# "GBM_BACKEND" = "nvidia-drm";
# "__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
# "WLR_NO_HARDWARE_CURSORS" = "1";
# "WLR_EGL_NO_MODIFIRES" = "1";
# };
};
programs = {
hyprland = {
# Window Manager
enable = true;
xwayland.enable = true;
enableNvidiaPatches =
if hostName == "desktop"
then true
else false;
};
};
hardware = {
opengl.enable = true;
nvidia.nvidiaSettings = true;
};
xdg.portal = {
enable = true;
extraPortals = with pkgs; [xdg-desktop-portal-gtk];
};
home-manager.users.${vars.user} = {
imports = [hyprland.homeManagerModules.default];
wayland.windowManager.hyprland = {
enable = true;
systemdIntegration = true;
extraConfig = ''
bind = SUPER, RETURN, exec, alacritty
'';
plugins = [
split-monitor-workspaces.packages.${pkgs.system}.split-monitor-workspaces
];
};
};
nix.settings = {
substituters = ["https://hyprland.cachix.org"];
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
}; # Cache
};
}