nix-config/modules/desktops/hyprland.nix

96 lines
2.2 KiB
Nix
Raw Normal View History

2023-10-13 20:52:26 +02:00
#
# Hyprland Configuration
# Enable with "hyprland.enable = true;"
#
{
config,
lib,
system,
pkgs,
unstable,
hyprland,
vars,
host,
2023-10-14 18:53:32 +02:00
split-monitor-workspaces,
2023-10-13 20:52:26 +02:00
...
}:
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
2023-10-14 18:53:32 +02:00
dunst
hyprpaper
waybar
2023-10-13 20:52:26 +02:00
];
2023-10-14 18:53:32 +02:00
# 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";
# };
2023-10-13 20:52:26 +02:00
};
programs = {
hyprland = {
# Window Manager
enable = true;
2023-10-14 18:53:32 +02:00
xwayland.enable = true;
enableNvidiaPatches =
2023-10-13 20:52:26 +02:00
if hostName == "desktop"
then true
else false;
};
};
2023-10-14 18:53:32 +02:00
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
];
};
};
2023-10-13 20:52:26 +02:00
nix.settings = {
substituters = ["https://hyprland.cachix.org"];
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
}; # Cache
};
}