61 lines
1.5 KiB
Nix
61 lines
1.5 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
# The Hyprland compositor.
|
|
let
|
|
mkBind = keybind: {
|
|
_args = [
|
|
keybind.keys
|
|
(mkAction keybind.action)
|
|
];
|
|
};
|
|
|
|
mkAction =
|
|
action:
|
|
lib.generators.mkLuaInline ({ exec = "hl.dsp.exec_cmd(${toLua action.command})"; }.${action.kind});
|
|
|
|
keybinds = lib.attrValues (
|
|
lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind
|
|
);
|
|
|
|
toLua = lib.generators.toLua { };
|
|
in
|
|
{
|
|
options.modules.desktop.session.hyprland.enable = lib.mkEnableOption "the Hyprland compositor";
|
|
|
|
config = lib.mkIf config.modules.desktop.session.hyprland.enable {
|
|
|
|
# This program integration owns the session, portals, and polkit, launched
|
|
# through the universal Wayland session manager.
|
|
programs.hyprland = {
|
|
enable = true;
|
|
withUWSM = true;
|
|
};
|
|
|
|
home-manager.users.${config.user.name}.wayland.windowManager.hyprland = {
|
|
enable = true;
|
|
|
|
# One package drives the whole session, so there is never a version split.
|
|
# The program integration above installs it and the portal, leaving home-
|
|
# manager to write only the config.
|
|
package = null;
|
|
portalPackage = null;
|
|
|
|
# uwsm owns the systemd graphical-session targets.
|
|
systemd.enable = false;
|
|
|
|
# Write the native Lua Hyprland config. Home Manager renders the Nix
|
|
# settings below as hl.* calls.
|
|
configType = "lua";
|
|
|
|
settings = {
|
|
config.general.layout = "dwindle";
|
|
|
|
bind = map mkBind keybinds;
|
|
};
|
|
};
|
|
};
|
|
}
|