nixpkgs/nixos/modules/programs/wayland/hyprland.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

98 lines
2.7 KiB
Nix
Raw Normal View History

{ config
, lib
, pkgs
, ...
}:
with lib; let
cfg = config.programs.hyprland;
finalPortalPackage = cfg.portalPackage.override {
2023-09-10 18:26:25 +01:00
hyprland = cfg.finalPackage;
};
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.
'';
};
package = mkPackageOption pkgs "hyprland" { };
finalPackage = mkOption {
type = types.package;
readOnly = true;
default = cfg.package.override {
enableXWayland = cfg.xwayland.enable;
};
defaultText = literalExpression
2023-08-03 17:37:03 +01:00
"`programs.hyprland.package` with applied configuration";
description = mdDoc ''
The Hyprland package after applying configuration.
'';
};
portalPackage = mkPackageOption pkgs "xdg-desktop-portal-hyprland" { };
2023-08-03 17:37:03 +01:00
xwayland.enable = mkEnableOption (mdDoc "XWayland") // { default = true; };
systemd.setPath.enable = mkEnableOption null // {
default = true;
description = mdDoc ''
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.
'';
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.finalPackage ];
fonts.enableDefaultPackages = mkDefault true;
hardware.opengl.enable = mkDefault true;
programs = {
dconf.enable = mkDefault true;
xwayland.enable = mkDefault cfg.xwayland.enable;
};
security.polkit.enable = true;
services.xserver.displayManager.sessionPackages = [ cfg.finalPackage ];
xdg.portal = {
enable = mkDefault true;
extraPortals = [ finalPortalPackage ];
configPackages = mkDefault [ cfg.finalPackage ];
};
systemd = mkIf cfg.systemd.setPath.enable {
user.extraConfig = ''
DefaultEnvironment="PATH=$PATH:/run/current-system/sw/bin"
'';
};
};
2023-08-03 17:37:03 +01:00
imports = with lib; [
(mkRemovedOptionModule
[ "programs" "hyprland" "xwayland" "hidpi" ]
"XWayland patches are deprecated. Refer to https://wiki.hyprland.org/Configuring/XWayland"
)
(mkRemovedOptionModule
2023-08-03 17:37:03 +01:00
[ "programs" "hyprland" "enableNvidiaPatches" ]
"Nvidia patches are no longer needed"
)
(mkRemovedOptionModule
[ "programs" "hyprland" "nvidiaPatches" ]
"Nvidia patches are no longer needed"
2023-08-03 17:37:03 +01:00
)
];
}