2024-06-05 15:53:02 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
let
|
2023-04-12 12:48:02 +00:00
|
|
|
cfg = config.programs.hyprland;
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
wayland-lib = import ./lib.nix { inherit lib; };
|
2023-04-12 12:48:02 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.programs.hyprland = {
|
2024-06-05 15:53:02 +00:00
|
|
|
enable = lib.mkEnableOption ''
|
|
|
|
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'';
|
|
|
|
|
|
|
|
package = lib.mkPackageOption pkgs "hyprland" {
|
|
|
|
extraDescription = ''
|
|
|
|
If the package is not overridable with `enableXWayland`, then the module option
|
|
|
|
{option}`xwayland` will have no effect.
|
2023-04-12 12:48:02 +00:00
|
|
|
'';
|
2024-06-05 15:53:02 +00:00
|
|
|
} // {
|
|
|
|
apply = p: wayland-lib.genFinalPackage p {
|
2023-08-04 22:07:22 +00:00
|
|
|
enableXWayland = cfg.xwayland.enable;
|
|
|
|
};
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
portalPackage = lib.mkPackageOption pkgs "xdg-desktop-portal-hyprland" {
|
|
|
|
extraDescription = ''
|
|
|
|
If the package is not overridable with `hyprland`, then the Hyprland package
|
|
|
|
used by the portal may differ from the one set in the module option {option}`package`.
|
|
|
|
'';
|
|
|
|
} // {
|
|
|
|
apply = p: wayland-lib.genFinalPackage p {
|
|
|
|
hyprland = cfg.package;
|
|
|
|
};
|
|
|
|
};
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
xwayland.enable = lib.mkEnableOption "XWayland" // { default = true; };
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
systemd.setPath.enable = lib.mkEnableOption null // {
|
2024-04-21 15:54:59 +00:00
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
description = ''
|
|
|
|
Set environment path of systemd to include the current system's bin directory.
|
|
|
|
This is needed in Hyprland setups, where opening links in applications do not work.
|
|
|
|
Enabled by default.
|
|
|
|
'';
|
|
|
|
};
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
|
|
|
{
|
|
|
|
environment.systemPackages = [ cfg.package ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# To make a Hyprland session available if a display manager like SDDM is enabled:
|
|
|
|
services.displayManager.sessionPackages = [ cfg.package ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
xdg.portal = {
|
|
|
|
extraPortals = [ cfg.portalPackage ];
|
|
|
|
configPackages = lib.mkDefault [ cfg.package ];
|
|
|
|
};
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
systemd = lib.mkIf cfg.systemd.setPath.enable {
|
|
|
|
user.extraConfig = ''
|
|
|
|
DefaultEnvironment="PATH=$PATH:/run/current-system/sw/bin:/etc/profiles/per-user/%u/bin:/run/wrappers/bin"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
(import ./wayland-session.nix {
|
|
|
|
inherit lib pkgs;
|
|
|
|
enableXWayland = cfg.xwayland.enable;
|
|
|
|
enableWlrPortal = false; # Hyprland has its own portal, wlr is not needed
|
|
|
|
})
|
|
|
|
]);
|
2023-08-22 20:05:09 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
imports = [
|
|
|
|
(lib.mkRemovedOptionModule
|
2023-08-22 20:05:09 +00:00
|
|
|
[ "programs" "hyprland" "xwayland" "hidpi" ]
|
|
|
|
"XWayland patches are deprecated. Refer to https://wiki.hyprland.org/Configuring/XWayland"
|
|
|
|
)
|
2024-05-15 15:35:15 +00:00
|
|
|
(lib.mkRemovedOptionModule
|
2023-08-22 20:05:09 +00:00
|
|
|
[ "programs" "hyprland" "enableNvidiaPatches" ]
|
2024-01-02 11:29:13 +00:00
|
|
|
"Nvidia patches are no longer needed"
|
|
|
|
)
|
2024-05-15 15:35:15 +00:00
|
|
|
(lib.mkRemovedOptionModule
|
2024-01-02 11:29:13 +00:00
|
|
|
[ "programs" "hyprland" "nvidiaPatches" ]
|
|
|
|
"Nvidia patches are no longer needed"
|
2023-08-22 20:05:09 +00:00
|
|
|
)
|
|
|
|
];
|
2024-06-05 15:53:02 +00:00
|
|
|
|
|
|
|
meta.maintainers = with lib.maintainers; [ fufexan ];
|
2023-04-12 12:48:02 +00:00
|
|
|
}
|