2022-12-04 20:29:12 +01:00
|
|
|
inputs: {
|
2022-05-21 12:07:55 +02:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
2023-08-23 02:23:00 +02:00
|
|
|
options,
|
2022-05-21 12:07:55 +02:00
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.programs.hyprland;
|
2023-08-16 12:39:20 +02:00
|
|
|
inherit (pkgs.stdenv.hostPlatform) system;
|
2022-12-09 15:25:57 +01:00
|
|
|
|
2023-08-01 23:49:46 +02:00
|
|
|
finalPortalPackage = cfg.portalPackage.override {
|
2023-09-10 19:11:21 +02:00
|
|
|
hyprland = cfg.finalPackage;
|
2022-12-09 15:25:57 +01:00
|
|
|
};
|
2022-05-21 12:07:55 +02:00
|
|
|
in {
|
2023-08-14 10:03:01 +02:00
|
|
|
# disables Nixpkgs Hyprland module to avoid conflicts
|
|
|
|
disabledModules = ["programs/hyprland.nix"];
|
|
|
|
|
2022-05-21 12:07:55 +02:00
|
|
|
options.programs.hyprland = {
|
2023-04-05 14:06:30 +02:00
|
|
|
enable =
|
|
|
|
mkEnableOption null
|
|
|
|
// {
|
|
|
|
description = mdDoc ''
|
|
|
|
Hyprland, the dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
|
2022-05-21 12:07:55 +02:00
|
|
|
|
2023-04-05 14:06:30 +02:00
|
|
|
You can manually launch Hyprland by executing {command}`Hyprland` on a TTY.
|
2022-09-09 14:40:30 +02:00
|
|
|
|
2023-04-05 14:06:30 +02:00
|
|
|
A configuration file will be generated in {file}`~/.config/hypr/hyprland.conf`.
|
|
|
|
See <https://wiki.hyprland.org> for more information.
|
2022-12-09 15:25:57 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-08-16 12:39:20 +02:00
|
|
|
package = mkPackageOptionMD inputs.self.packages.${system} "hyprland" { };
|
2023-08-01 23:49:46 +02:00
|
|
|
|
|
|
|
finalPackage = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
readOnly = true;
|
|
|
|
default = cfg.package.override {
|
|
|
|
enableXWayland = cfg.xwayland.enable;
|
|
|
|
};
|
|
|
|
defaultText =
|
|
|
|
literalExpression
|
|
|
|
"`programs.hyprland.package` with applied configuration";
|
2023-04-05 14:06:30 +02:00
|
|
|
description = mdDoc ''
|
2023-08-01 23:49:46 +02:00
|
|
|
The Hyprland package after applying configuration.
|
2022-12-15 19:53:20 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-08-16 12:39:20 +02:00
|
|
|
portalPackage = mkPackageOptionMD inputs.xdph.packages.${system} "xdg-desktop-portal-hyprland" {};
|
2023-04-05 14:06:30 +02:00
|
|
|
|
2023-08-01 23:49:46 +02:00
|
|
|
xwayland.enable = mkEnableOption (mdDoc "support for XWayland") // {default = true;};
|
2022-05-21 12:07:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2023-08-01 23:49:46 +02:00
|
|
|
environment.systemPackages = [cfg.finalPackage];
|
2023-04-05 14:06:30 +02:00
|
|
|
|
2023-08-23 02:23:00 +02:00
|
|
|
# NixOS changed the name of this attribute between NixOS 23.05 and
|
|
|
|
# 23.11
|
|
|
|
fonts = if builtins.hasAttr "enableDefaultPackages" options.fonts
|
|
|
|
then {enableDefaultPackages = mkDefault true;}
|
|
|
|
else {enableDefaultFonts = mkDefault true;};
|
2023-07-29 22:05:35 +02:00
|
|
|
|
2022-09-06 23:45:24 +02:00
|
|
|
hardware.opengl.enable = mkDefault true;
|
2023-04-05 14:06:30 +02:00
|
|
|
|
2022-09-06 23:45:24 +02:00
|
|
|
programs = {
|
|
|
|
dconf.enable = mkDefault true;
|
2023-08-01 23:49:46 +02:00
|
|
|
xwayland.enable = mkDefault cfg.xwayland.enable;
|
2022-09-06 23:45:24 +02:00
|
|
|
};
|
2023-04-05 14:06:30 +02:00
|
|
|
|
2022-09-06 23:45:24 +02:00
|
|
|
security.polkit.enable = true;
|
2023-04-05 14:06:30 +02:00
|
|
|
|
2023-08-01 23:49:46 +02:00
|
|
|
services.xserver.displayManager.sessionPackages = [cfg.finalPackage];
|
2023-04-05 14:06:30 +02:00
|
|
|
|
2022-09-06 23:45:24 +02:00
|
|
|
xdg.portal = {
|
|
|
|
enable = mkDefault true;
|
2023-08-01 23:49:46 +02:00
|
|
|
extraPortals = [finalPortalPackage];
|
2022-09-06 23:45:24 +02:00
|
|
|
};
|
2022-05-21 12:07:55 +02:00
|
|
|
};
|
2023-08-01 23:49:46 +02:00
|
|
|
|
|
|
|
imports = with lib; [
|
|
|
|
(
|
|
|
|
mkRemovedOptionModule
|
|
|
|
["programs" "hyprland" "xwayland" "hidpi"]
|
|
|
|
"XWayland patches are deprecated. Refer to https://wiki.hyprland.org/Configuring/XWayland"
|
|
|
|
)
|
|
|
|
(
|
2023-11-26 03:58:57 +01:00
|
|
|
mkRemovedOptionModule
|
2023-08-01 23:49:46 +02:00
|
|
|
["programs" "hyprland" "enableNvidiaPatches"]
|
2023-11-26 03:58:57 +01:00
|
|
|
"Nvidia patches are no longer needed"
|
|
|
|
)
|
|
|
|
(
|
|
|
|
mkRemovedOptionModule
|
|
|
|
["programs" "hyprland" "nvidiaPatches"]
|
|
|
|
"Nvidia patches are no longer needed"
|
2023-08-01 23:49:46 +02:00
|
|
|
)
|
|
|
|
];
|
2022-05-21 12:07:55 +02:00
|
|
|
}
|