2022-12-04 20:29:12 +01:00
|
|
|
inputs: {
|
2022-05-21 12:07:55 +02:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.programs.hyprland;
|
2022-12-09 15:25:57 +01:00
|
|
|
|
2023-01-18 09:37:56 +01:00
|
|
|
defaultHyprlandPackage = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.default.override {
|
2022-12-09 15:25:57 +01:00
|
|
|
enableXWayland = cfg.xwayland.enable;
|
|
|
|
hidpiXWayland = cfg.xwayland.hidpi;
|
2023-04-05 14:06:30 +02:00
|
|
|
inherit (cfg) nvidiaPatches;
|
2022-12-09 15:25:57 +01:00
|
|
|
};
|
2022-05-21 12:07:55 +02:00
|
|
|
in {
|
2023-04-05 14:06:30 +02:00
|
|
|
# disables Nixpkgs Hyprland module to avoid conflicts
|
|
|
|
disabledModules = ["programs/hyprland.nix"];
|
2022-09-03 01:20:20 +02:00
|
|
|
|
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-04-05 14:06:30 +02:00
|
|
|
package = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
default = defaultHyprlandPackage;
|
|
|
|
defaultText = literalExpression ''
|
|
|
|
hyprland.packages.''${pkgs.stdenv.hostPlatform.system}.default.override {
|
|
|
|
enableXWayland = config.programs.hyprland.xwayland.enable;
|
|
|
|
hidpiXWayland = config.programs.hyprland.xwayland.hidpi;
|
|
|
|
inherit (config.programs.hyprland) nvidiaPatches;
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
example = literalExpression "pkgs.hyprland";
|
|
|
|
description = mdDoc ''
|
|
|
|
The Hyprland package to use.
|
|
|
|
Setting this option will make {option}`programs.hyprland.xwayland` and
|
|
|
|
{option}`programs.hyprland.nvidiaPatches` not work.
|
2022-12-15 19:53:20 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-04-05 14:06:30 +02:00
|
|
|
xwayland = {
|
|
|
|
enable = mkEnableOption (mdDoc "XWayland") // {default = true;};
|
|
|
|
hidpi =
|
|
|
|
mkEnableOption null
|
|
|
|
// {
|
|
|
|
description = mdDoc ''
|
|
|
|
Enable HiDPI XWayland, based on [XWayland MR 733](https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733).
|
|
|
|
See <https://wiki.hyprland.org/Nix/Options-Overrides/#xwayland-hidpi> for more info.
|
|
|
|
'';
|
|
|
|
};
|
2022-09-09 14:40:30 +02:00
|
|
|
};
|
2023-04-05 14:06:30 +02:00
|
|
|
|
|
|
|
nvidiaPatches = mkEnableOption (mdDoc "patching wlroots for better Nvidia support");
|
2022-05-21 12:07:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2022-09-06 23:45:24 +02:00
|
|
|
environment = {
|
2023-04-05 14:06:30 +02:00
|
|
|
systemPackages = [cfg.package];
|
2022-09-09 14:40:30 +02:00
|
|
|
|
2023-04-05 14:06:30 +02:00
|
|
|
sessionVariables = {
|
|
|
|
NIXOS_OZONE_WL = mkDefault "1";
|
2022-09-06 23:45:24 +02:00
|
|
|
};
|
|
|
|
};
|
2023-04-05 14:06:30 +02:00
|
|
|
|
2022-05-21 12:07:55 +02:00
|
|
|
fonts.enableDefaultFonts = mkDefault true;
|
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;
|
|
|
|
xwayland.enable = mkDefault true;
|
|
|
|
};
|
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
|
|
|
|
|
|
|
services.xserver.displayManager.sessionPackages = [cfg.package];
|
|
|
|
|
2022-09-06 23:45:24 +02:00
|
|
|
xdg.portal = {
|
|
|
|
enable = mkDefault true;
|
2022-12-09 15:25:57 +01:00
|
|
|
extraPortals = lib.mkIf (cfg.package != null) [
|
2023-01-18 09:37:56 +01:00
|
|
|
(inputs.xdph.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland.override {
|
|
|
|
hyprland-share-picker = inputs.xdph.packages.${pkgs.stdenv.hostPlatform.system}.hyprland-share-picker.override {
|
2022-12-15 19:53:20 +01:00
|
|
|
hyprland = cfg.package;
|
2022-12-09 15:25:57 +01:00
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
2022-09-06 23:45:24 +02:00
|
|
|
};
|
2022-05-21 12:07:55 +02:00
|
|
|
};
|
|
|
|
}
|