aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMihai Fufezan <[email protected]>2023-08-02 00:49:46 +0300
committerMihai Fufezan <[email protected]>2023-08-14 10:39:57 +0300
commit2650224c1fb6bd448b8cc78752e4d9939dc33743 (patch)
treee411580730b5a3aa84a48ad7c32fb9d0cf970404
parente510c6a7fcccb22db9cd4d07865382e9e3650410 (diff)
downloadHyprland-2650224c1fb6bd448b8cc78752e4d9939dc33743.tar.gz
Hyprland-2650224c1fb6bd448b8cc78752e4d9939dc33743.zip
Nix: remove hidpi from modules
-rw-r--r--nix/hm-module.nix27
-rw-r--r--nix/module.nix89
2 files changed, 50 insertions, 66 deletions
diff --git a/nix/hm-module.nix b/nix/hm-module.nix
index 705ddf86..123bceb3 100644
--- a/nix/hm-module.nix
+++ b/nix/hm-module.nix
@@ -7,8 +7,7 @@ self: {
cfg = config.wayland.windowManager.hyprland;
defaultHyprlandPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default.override {
enableXWayland = cfg.xwayland.enable;
- hidpiXWayland = cfg.xwayland.hidpi;
- inherit (cfg) nvidiaPatches;
+ inherit (cfg) enableNvidiaPatches;
};
in {
disabledModules = ["services/window-managers/hyprland.nix"];
@@ -36,13 +35,12 @@ in {
defaultText = lib.literalExpression ''
hyprland.packages.''${pkgs.stdenv.hostPlatform.system}.default.override {
enableXWayland = config.wayland.windowManager.hyprland.xwayland.enable;
- hidpiXWayland = config.wayland.windowManager.hyprland.xwayland.hidpi;
- inherit (config.wayland.windowManager.hyprland) nvidiaPatches;
+ inherit (config.wayland.windowManager.hyprland) enableNvidiaPatches;
}
'';
description = lib.mdDoc ''
Hyprland package to use. Will override the 'xwayland' and
- 'nvidiaPatches' options.
+ 'enableNvidiaPatches' options.
Defaults to the one provided by the flake. Set it to
{package}`pkgs.hyprland` to use the one provided by nixpkgs or
@@ -86,19 +84,9 @@ in {
'';
};
- xwayland = {
- 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.
- '';
- };
- };
+ xwayland.enable = lib.mkEnableOption (lib.mdDoc "XWayland") // {default = true;};
- 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 {
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")
+ ];
}
diff --git a/nix/module.nix b/nix/module.nix
index 04f48fcd..a5ecee72 100644
--- a/nix/module.nix
+++ b/nix/module.nix
@@ -7,15 +7,12 @@ inputs: {
with lib; let
cfg = config.programs.hyprland;
- defaultHyprlandPackage = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.default.override {
- enableXWayland = cfg.xwayland.enable;
- hidpiXWayland = cfg.xwayland.hidpi;
- inherit (cfg) nvidiaPatches;
+ finalPortalPackage = cfg.portalPackage.override {
+ hyprland-share-picker = inputs.xdph.packages.${pkgs.system}.hyprland-share-picker.override {
+ hyprland = cfg.finalPackage;
+ };
};
in {
- # disables Nixpkgs Hyprland module to avoid conflicts
- disabledModules = ["programs/hyprland.nix"];
-
options.programs.hyprland = {
enable =
mkEnableOption null
@@ -30,47 +27,34 @@ in {
'';
};
- 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";
+ 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";
description = mdDoc ''
- The Hyprland package to use.
- Setting this option will make {option}`programs.hyprland.xwayland` and
- {option}`programs.hyprland.nvidiaPatches` not work.
+ The Hyprland package after applying configuration.
'';
};
- 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.
- '';
- };
- };
+ portalPackage = mkPackageOptionMD inputs.xdph.packages.${pkgs.system} "xdg-desktop-portal-hyprland" {};
- 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 {
- environment = {
- systemPackages = [cfg.package];
-
- sessionVariables = {
- NIXOS_OZONE_WL = mkDefault "1";
- };
- };
+ environment.systemPackages = [cfg.finalPackage];
fonts =
if versionOlder config.system.stateVersion "23.11"
@@ -81,22 +65,29 @@ in {
programs = {
dconf.enable = mkDefault true;
- xwayland.enable = mkDefault true;
+ xwayland.enable = mkDefault cfg.xwayland.enable;
};
security.polkit.enable = true;
- services.xserver.displayManager.sessionPackages = [cfg.package];
+ services.xserver.displayManager.sessionPackages = [cfg.finalPackage];
xdg.portal = {
enable = mkDefault true;
- extraPortals = lib.mkIf (cfg.package != null) [
- (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;
- };
- })
- ];
+ extraPortals = [finalPortalPackage];
};
};
+
+ 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"]
+ )
+ ];
}