2022-12-04 22:29:12 +03:00
|
|
|
inputs: {
|
2022-05-21 13:07:55 +03:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.programs.hyprland;
|
2022-12-09 17:25:57 +03:00
|
|
|
|
2023-08-02 00:49:46 +03:00
|
|
|
finalPortalPackage = cfg.portalPackage.override {
|
|
|
|
hyprland-share-picker = inputs.xdph.packages.${pkgs.system}.hyprland-share-picker.override {
|
|
|
|
hyprland = cfg.finalPackage;
|
|
|
|
};
|
2022-12-09 17:25:57 +03:00
|
|
|
};
|
2022-05-21 13:07:55 +03:00
|
|
|
in {
|
|
|
|
options.programs.hyprland = {
|
2023-04-05 15:06:30 +03:00
|
|
|
enable =
|
|
|
|
mkEnableOption null
|
|
|
|
// {
|
|
|
|
description = mdDoc ''
|
|
|
|
Hyprland, the dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
|
2022-05-21 13:07:55 +03:00
|
|
|
|
2023-04-05 15:06:30 +03:00
|
|
|
You can manually launch Hyprland by executing {command}`Hyprland` on a TTY.
|
2022-09-09 15:40:30 +03:00
|
|
|
|
2023-04-05 15:06:30 +03:00
|
|
|
A configuration file will be generated in {file}`~/.config/hypr/hyprland.conf`.
|
|
|
|
See <https://wiki.hyprland.org> for more information.
|
2022-12-09 17:25:57 +03:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-08-02 00:49:46 +03:00
|
|
|
package = mkPackageOptionMD inputs.packages.${pkgs.system} "hyprland" {};
|
|
|
|
|
|
|
|
finalPackage = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
readOnly = true;
|
|
|
|
default = cfg.package.override {
|
|
|
|
enableXWayland = cfg.xwayland.enable;
|
|
|
|
enableNvidiaPatches = cfg.enableNvidiaPatches;
|
|
|
|
};
|
|
|
|
defaultText =
|
|
|
|
literalExpression
|
|
|
|
"`programs.hyprland.package` with applied configuration";
|
2023-04-05 15:06:30 +03:00
|
|
|
description = mdDoc ''
|
2023-08-02 00:49:46 +03:00
|
|
|
The Hyprland package after applying configuration.
|
2022-12-15 21:53:20 +03:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-08-02 00:49:46 +03:00
|
|
|
portalPackage = mkPackageOptionMD inputs.xdph.packages.${pkgs.system} "xdg-desktop-portal-hyprland" {};
|
2023-04-05 15:06:30 +03:00
|
|
|
|
2023-08-02 00:49:46 +03:00
|
|
|
xwayland.enable = mkEnableOption (mdDoc "support for XWayland") // {default = true;};
|
|
|
|
|
|
|
|
enableNvidiaPatches = mkEnableOption null // {
|
|
|
|
description = mdDoc "Whether to apply patches to wlroots for better Nvidia support.";
|
|
|
|
};
|
2022-05-21 13:07:55 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2023-08-02 00:49:46 +03:00
|
|
|
environment.systemPackages = [cfg.finalPackage];
|
2023-04-05 15:06:30 +03:00
|
|
|
|
2023-07-29 23:05:35 +03:00
|
|
|
fonts =
|
|
|
|
if versionOlder config.system.stateVersion "23.11"
|
|
|
|
then {enableDefaultFonts = mkDefault true;}
|
|
|
|
else {enableDefaultPackages = mkDefault true;};
|
|
|
|
|
2022-09-07 00:45:24 +03:00
|
|
|
hardware.opengl.enable = mkDefault true;
|
2023-04-05 15:06:30 +03:00
|
|
|
|
2022-09-07 00:45:24 +03:00
|
|
|
programs = {
|
|
|
|
dconf.enable = mkDefault true;
|
2023-08-02 00:49:46 +03:00
|
|
|
xwayland.enable = mkDefault cfg.xwayland.enable;
|
2022-09-07 00:45:24 +03:00
|
|
|
};
|
2023-04-05 15:06:30 +03:00
|
|
|
|
2022-09-07 00:45:24 +03:00
|
|
|
security.polkit.enable = true;
|
2023-04-05 15:06:30 +03:00
|
|
|
|
2023-08-02 00:49:46 +03:00
|
|
|
services.xserver.displayManager.sessionPackages = [cfg.finalPackage];
|
2023-04-05 15:06:30 +03:00
|
|
|
|
2022-09-07 00:45:24 +03:00
|
|
|
xdg.portal = {
|
|
|
|
enable = mkDefault true;
|
2023-08-02 00:49:46 +03:00
|
|
|
extraPortals = [finalPortalPackage];
|
2022-09-07 00:45:24 +03:00
|
|
|
};
|
2022-05-21 13:07:55 +03:00
|
|
|
};
|
2023-08-02 00:49:46 +03: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"]
|
|
|
|
)
|
|
|
|
];
|
2022-05-21 13:07:55 +03:00
|
|
|
}
|