Nix: remove hidpi from modules

This commit is contained in:
Mihai Fufezan 2023-08-02 00:49:46 +03:00 committed by Mihai Fufezan
parent e510c6a7fc
commit 2650224c1f
2 changed files with 50 additions and 66 deletions

View File

@ -7,8 +7,7 @@ self: {
cfg = config.wayland.windowManager.hyprland; cfg = config.wayland.windowManager.hyprland;
defaultHyprlandPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default.override { defaultHyprlandPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default.override {
enableXWayland = cfg.xwayland.enable; enableXWayland = cfg.xwayland.enable;
hidpiXWayland = cfg.xwayland.hidpi; inherit (cfg) enableNvidiaPatches;
inherit (cfg) nvidiaPatches;
}; };
in { in {
disabledModules = ["services/window-managers/hyprland.nix"]; disabledModules = ["services/window-managers/hyprland.nix"];
@ -36,13 +35,12 @@ in {
defaultText = lib.literalExpression '' defaultText = lib.literalExpression ''
hyprland.packages.''${pkgs.stdenv.hostPlatform.system}.default.override { hyprland.packages.''${pkgs.stdenv.hostPlatform.system}.default.override {
enableXWayland = config.wayland.windowManager.hyprland.xwayland.enable; enableXWayland = config.wayland.windowManager.hyprland.xwayland.enable;
hidpiXWayland = config.wayland.windowManager.hyprland.xwayland.hidpi; inherit (config.wayland.windowManager.hyprland) enableNvidiaPatches;
inherit (config.wayland.windowManager.hyprland) nvidiaPatches;
} }
''; '';
description = lib.mdDoc '' description = lib.mdDoc ''
Hyprland package to use. Will override the 'xwayland' and Hyprland package to use. Will override the 'xwayland' and
'nvidiaPatches' options. 'enableNvidiaPatches' options.
Defaults to the one provided by the flake. Set it to Defaults to the one provided by the flake. Set it to
{package}`pkgs.hyprland` to use the one provided by nixpkgs or {package}`pkgs.hyprland` to use the one provided by nixpkgs or
@ -86,19 +84,9 @@ in {
''; '';
}; };
xwayland = { xwayland.enable = lib.mkEnableOption (lib.mdDoc "XWayland") // {default = true;};
enable = lib.mkEnableOption (lib.mdDoc "XWayland") // {default = true;};
hidpi =
lib.mkEnableOption null
// {
description = lib.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.
'';
};
};
nvidiaPatches = lib.mkEnableOption (lib.mdDoc "patching wlroots for better Nvidia support."); enableNvidiaPatches = lib.mkEnableOption (lib.mdDoc "patching wlroots for better Nvidia support.");
extraConfig = lib.mkOption { extraConfig = lib.mkOption {
type = lib.types.nullOr lib.types.lines; type = lib.types.nullOr lib.types.lines;
@ -181,4 +169,9 @@ in {
}; };
}; };
}; };
imports = [
(lib.mkRemovedOptionModule ["wayland" "windowManager" "hyprland" "xwayland" "hidpi"]
"Support for this option has been removed. Refer to https://wiki.hyprland.org/Configuring/XWayland for more info")
];
} }

View File

@ -7,15 +7,12 @@ inputs: {
with lib; let with lib; let
cfg = config.programs.hyprland; cfg = config.programs.hyprland;
defaultHyprlandPackage = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.default.override { finalPortalPackage = cfg.portalPackage.override {
enableXWayland = cfg.xwayland.enable; hyprland-share-picker = inputs.xdph.packages.${pkgs.system}.hyprland-share-picker.override {
hidpiXWayland = cfg.xwayland.hidpi; hyprland = cfg.finalPackage;
inherit (cfg) nvidiaPatches; };
}; };
in { in {
# disables Nixpkgs Hyprland module to avoid conflicts
disabledModules = ["programs/hyprland.nix"];
options.programs.hyprland = { options.programs.hyprland = {
enable = enable =
mkEnableOption null mkEnableOption null
@ -30,47 +27,34 @@ in {
''; '';
}; };
package = mkOption { package = mkPackageOptionMD inputs.packages.${pkgs.system} "hyprland" {};
type = types.path;
default = defaultHyprlandPackage; finalPackage = mkOption {
defaultText = literalExpression '' type = types.package;
hyprland.packages.''${pkgs.stdenv.hostPlatform.system}.default.override { readOnly = true;
enableXWayland = config.programs.hyprland.xwayland.enable; default = cfg.package.override {
hidpiXWayland = config.programs.hyprland.xwayland.hidpi; enableXWayland = cfg.xwayland.enable;
inherit (config.programs.hyprland) nvidiaPatches; enableNvidiaPatches = cfg.enableNvidiaPatches;
} };
''; defaultText =
example = literalExpression "pkgs.hyprland"; literalExpression
"`programs.hyprland.package` with applied configuration";
description = mdDoc '' description = mdDoc ''
The Hyprland package to use. The Hyprland package after applying configuration.
Setting this option will make {option}`programs.hyprland.xwayland` and
{option}`programs.hyprland.nvidiaPatches` not work.
''; '';
}; };
xwayland = { portalPackage = mkPackageOptionMD inputs.xdph.packages.${pkgs.system} "xdg-desktop-portal-hyprland" {};
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.
'';
};
};
nvidiaPatches = mkEnableOption (mdDoc "patching wlroots for better Nvidia support"); xwayland.enable = mkEnableOption (mdDoc "support for XWayland") // {default = true;};
enableNvidiaPatches = mkEnableOption null // {
description = mdDoc "Whether to apply patches to wlroots for better Nvidia support.";
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment = { environment.systemPackages = [cfg.finalPackage];
systemPackages = [cfg.package];
sessionVariables = {
NIXOS_OZONE_WL = mkDefault "1";
};
};
fonts = fonts =
if versionOlder config.system.stateVersion "23.11" if versionOlder config.system.stateVersion "23.11"
@ -81,22 +65,29 @@ in {
programs = { programs = {
dconf.enable = mkDefault true; dconf.enable = mkDefault true;
xwayland.enable = mkDefault true; xwayland.enable = mkDefault cfg.xwayland.enable;
}; };
security.polkit.enable = true; security.polkit.enable = true;
services.xserver.displayManager.sessionPackages = [cfg.package]; services.xserver.displayManager.sessionPackages = [cfg.finalPackage];
xdg.portal = { xdg.portal = {
enable = mkDefault true; enable = mkDefault true;
extraPortals = lib.mkIf (cfg.package != null) [ extraPortals = [finalPortalPackage];
(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 {
hyprland = cfg.package;
};
})
];
}; };
}; };
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"]
)
];
} }