nixos/modules/hyprland.nix
2025-03-19 20:27:43 -07:00

187 lines
4.7 KiB
Nix

{ lib, config, pkgs, inputs, ... }:
let
cfg = config.snowhawk.hyprland;
in
{
options.snowhawk.hyprland = {
enable = lib.mkEnableOption "hyprland";
nvidia = lib.mkEnableOption "hyprland nvidia tweaks";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
# Core Module
{
services.graphical-desktop.enable = lib.mkDefault true;
services.displayManager = {
enable = true;
sddm = {
enable = lib.mkDefault true;
wayland.enable = lib.mkDefault true;
};
};
security = {
polkit.enable = lib.mkDefault true;
};
programs = {
dconf.enable = lib.mkDefault true;
xwayland.enable = lib.mkDefault true;
};
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
];
};
programs.waybar.enable = true;
programs.hyprland = {
enable = true;
withUWSM = true;
xwayland.enable = true;
};
services.hypridle.enable = true;
systemd.user.services.hypridle.path = [ pkgs.brightnessctl ];
# programs.hyprlock.enable = true;
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050913
xdg.portal.config.hyprland.default = lib.mkDefault [ "wlr" "gtk" ];
services.xserver.desktopManager.runXdgAutostartIfNone = lib.mkDefault true;
environment.variables = {
QT_QPA_PLATFORM = "wayland;xcb";
MOZ_ENABLE_WAYLAND = 1;
SDL_VIDEODRIVEWR = "wayland,x11";
_JAVA_AWT_WM_NONREPARENTING = 1;
};
environment.systemPackages = with pkgs; [
# Screenshotting
grim
slurp
satty
# Hardware Control
brightnessctl
# Desktop
wofi
kitty
pipewire-controller
# Wayland Utilities
wdisplays
xorg.xlsclients
wl-clipboard
];
home-manager.sharedModules = [
./home/hyprland.nix
];
}
# SDDM Theme
(
let sddmPkg = (pkgs.sddm-astronaut.override { embeddedTheme = "purple_leaves"; });
in {
services.displayManager = {
enable = lib.mkDefault true;
sddm = {
enable = lib.mkDefault true;
wayland.enable = lib.mkDefault true;
theme = "sddm-astronaut-theme";
package = pkgs.kdePackages.sddm;
extraPackages = with pkgs; [
sddmPkg
kdePackages.qtsvg
kdePackages.qtvirtualkeyboard
kdePackages.qtmultimedia
];
};
};
environment.systemPackages = [ sddmPkg ];
}
)
# Anyrun
(lib.mkIf false {
home-manager.sharedModules = [{
imports = [
inputs.anyrun.homeManagerModules.default
];
programs.anyrun = {
enable = true;
config = {
x = { fraction = 0.5; };
y = { fraction = 0.3; };
width = { fraction = 0.3; };
layer = "overlay";
showResultsImmediately = true;
hidePluginInfo = true;
plugins = [
inputs.anyrun.packages.${pkgs.system}.applications
];
};
extraCss = /* css */ ''
window {
background: transparent;
}
'';
};
services.swaync = {
enable = true;
style = builtins.readFile "${inputs.rose-pine-swaync}/theme/rose-pine.css";
settings = {
positionX = "right";
positionY = "tops";
layer = "overlay";
control-center-layer = "tops";
cssPriority = "application";
control-center-margin-top = 0;
control-center-margin-bottom = 0;
control-center-margin-right = 0;
control-center-margin-left = 0;
notification-2fa-action = true;
notification-inline-replies = false;
notification-icon-size = 64;
notification-body-image-height = 100;
notification-body-image-width = 200;
timeout = 10;
timeout-low = 5;
timeout-critical = 0;
fit-to-screen = true;
control-center-width = 500;
control-center-height = 600;
notification-window-width = 500;
keyboard-shortcuts = true;
image-visibility = "when-available";
transition-time = 200;
hide-on-clear = false;
hide-on-action = true;
script-fail-notify = false;
};
};
}];
})
(lib.mkIf cfg.nvidia {
environment.variables = {
LIBVA_DRIVER_NAME = "nvidia";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
};
})
]);
}