Files
NixOsConfig/modules/home/hyprland/default.nix
T

68 lines
2.0 KiB
Nix

# Hyprland user configuration. Hyprland 0.56 reads Lua, so the real config lives
# in the plain .lua files next to this module; Nix only passes in the few
# values that come from the system config (keyboard layouts, cursor, apps).
{
config,
lib,
pkgs,
osConfig,
...
}:
let
cfg = config.my.home.hyprland;
cursor = config.home.pointerCursor;
# Exposed to the Lua files as `require("nixvars")`.
nixVars = {
kbLayout = lib.concatStringsSep "," osConfig.my.locale.keyboardLayouts;
kbOptions = lib.concatStringsSep "," osConfig.my.locale.keyboardOptions;
terminal = "wezterm";
fileManager = "nautilus";
cursorSize = if cursor.enable then cursor.size else 24;
cursorTheme = if cursor.enable then cursor.name else "";
};
in
{
options.my.home.hyprland.enable = lib.mkEnableOption "Hyprland user configuration (Lua)";
config = lib.mkIf cfg.enable {
wayland.windowManager.hyprland = {
enable = true;
configType = "lua";
# The NixOS module (programs.hyprland) installs the compositor and the
# portal, built from the flake overlay. Installing them again here would
# put a second copy in the user profile.
package = null;
portalPackage = null;
# UWSM owns the session and graphical-session.target; HM's own
# hyprland-session.target and dbus import would only duplicate that.
systemd.enable = false;
xwayland.enable = true;
# Loaded in name order; `nixvars` is a helper module, not loaded on its own.
extraLuaFiles = {
nixvars = {
content = "return ${lib.generators.toLua { } nixVars}\n";
autoLoad = false;
};
"10-settings" = ./settings.lua;
"20-binds" = ./binds.lua;
"30-rules" = ./rules.lua;
};
};
# Tools the binds call (screenshots, file manager).
home.packages = with pkgs; [
grim
slurp
wl-clipboard
nautilus
];
# Electron and Chromium apps pick Wayland instead of XWayland.
home.sessionVariables.NIXOS_OZONE_WL = "1";
};
}