2023-04-12 12:48:02 +00:00
|
|
|
{ config
|
|
|
|
, lib
|
|
|
|
, pkgs
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.programs.hyprland;
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
finalPortalPackage = cfg.portalPackage.override {
|
|
|
|
hyprland-share-picker = pkgs.hyprland-share-picker.override {
|
|
|
|
hyprland = cfg.finalPackage;
|
|
|
|
};
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.programs.hyprland = {
|
|
|
|
enable = mkEnableOption null // {
|
|
|
|
description = mdDoc ''
|
|
|
|
Hyprland, the dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
|
|
|
|
|
|
|
|
You can manually launch Hyprland by executing {command}`Hyprland` on a TTY.
|
|
|
|
|
|
|
|
A configuration file will be generated in {file}`~/.config/hypr/hyprland.conf`.
|
|
|
|
See <https://wiki.hyprland.org> for more information.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
package = mkPackageOptionMD pkgs "hyprland" { };
|
|
|
|
|
|
|
|
finalPackage = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
readOnly = true;
|
|
|
|
default = cfg.package.override {
|
|
|
|
enableXWayland = cfg.xwayland.enable;
|
2023-08-22 20:05:09 +00:00
|
|
|
enableNvidiaPatches = cfg.enableNvidiaPatches;
|
2023-08-04 22:07:22 +00:00
|
|
|
};
|
|
|
|
defaultText = literalExpression
|
2023-08-22 20:05:09 +00:00
|
|
|
"`programs.hyprland.package` with applied configuration";
|
2023-04-12 12:48:02 +00:00
|
|
|
description = mdDoc ''
|
2023-08-04 22:07:22 +00:00
|
|
|
The Hyprland package after applying configuration.
|
2023-04-12 12:48:02 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
portalPackage = mkPackageOptionMD pkgs "xdg-desktop-portal-hyprland" { };
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
xwayland.enable = mkEnableOption (mdDoc "XWayland") // { default = true; };
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
enableNvidiaPatches = mkEnableOption (mdDoc "patching wlroots for better Nvidia support");
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2023-08-04 22:07:22 +00:00
|
|
|
environment.systemPackages = [ cfg.finalPackage ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
fonts.enableDefaultPackages = mkDefault true;
|
2023-04-12 12:48:02 +00:00
|
|
|
hardware.opengl.enable = mkDefault true;
|
|
|
|
|
|
|
|
programs = {
|
|
|
|
dconf.enable = mkDefault true;
|
2023-05-24 13:37:59 +00:00
|
|
|
xwayland.enable = mkDefault cfg.xwayland.enable;
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
security.polkit.enable = true;
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
services.xserver.displayManager.sessionPackages = [ cfg.finalPackage ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
xdg.portal = {
|
|
|
|
enable = mkDefault true;
|
2023-08-04 22:07:22 +00:00
|
|
|
extraPortals = [ finalPortalPackage ];
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
};
|
2023-08-22 20:05:09 +00:00
|
|
|
|
|
|
|
imports = with lib; [
|
|
|
|
(mkRemovedOptionModule
|
|
|
|
[ "programs" "hyprland" "xwayland" "hidpi" ]
|
|
|
|
"XWayland patches are deprecated. Refer to https://wiki.hyprland.org/Configuring/XWayland"
|
|
|
|
)
|
|
|
|
(mkRenamedOptionModule
|
|
|
|
[ "programs" "hyprland" "nvidiaPatches" ]
|
|
|
|
[ "programs" "hyprland" "enableNvidiaPatches" ]
|
|
|
|
)
|
|
|
|
];
|
2023-04-12 12:48:02 +00:00
|
|
|
}
|