From ff53fe10e02b2d48304a7cf42ae1b8fb6be67c71 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Mon, 1 Jun 2026 12:39:13 -0500 Subject: [PATCH] qt: assert kde6 migration warning --- modules/misc/qt.nix | 40 +++++++++++++------ .../qt/qt-platform-theme-kde6-migration.nix | 7 ++++ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/modules/misc/qt.nix b/modules/misc/qt.nix index d04821670..24aa9e830 100644 --- a/modules/misc/qt.nix +++ b/modules/misc/qt.nix @@ -319,22 +319,31 @@ in config = let - deprecateKde6 = - name: optionPath: - if name == "kde6" then - lib.warn '' - The ${optionPath} value "kde6" has been deprecated and renamed to "kde". - Please update your configuration: - ${optionPath} = "kde"; - '' "kde" + deprecateKde6 = name: if name == "kde6" then "kde" else name; + + deprecatedKde6PlatformThemeOption = + if builtins.isString cfg.platformTheme then + if cfg.platformTheme == "kde6" then + [ + "qt" + "platformTheme" + ] + else + null + else if cfg.platformTheme != null && cfg.platformTheme.name == "kde6" then + [ + "qt" + "platformTheme" + "name" + ] else - name; + null; platformTheme = if (builtins.isString cfg.platformTheme) then { option = "qt.platformTheme"; - name = deprecateKde6 cfg.platformTheme "qt.platformTheme"; + name = deprecateKde6 cfg.platformTheme; package = null; } else if cfg.platformTheme == null then @@ -346,7 +355,7 @@ in else { option = "qt.platformTheme.name"; - name = deprecateKde6 cfg.platformTheme.name "qt.platformTheme.name"; + name = deprecateKde6 cfg.platformTheme.name; inherit (cfg.platformTheme) package; }; @@ -392,7 +401,14 @@ in ) "The option `qt.platformTheme` has been renamed to `qt.platformTheme.name`.") ++ (lib.lists.optional ( platformTheme.name == "gnome" && platformTheme.package == null - ) "The value `gnome` for option `${platformTheme.option}` is deprecated. Use `adwaita` instead."); + ) "The value `gnome` for option `${platformTheme.option}` is deprecated. Use `adwaita` instead.") + ++ (lib.optional (deprecatedKde6PlatformThemeOption != null) ( + lib.hm.deprecations.mkDeprecatedOptionValueRenameWarning { + option = deprecatedKde6PlatformThemeOption; + old = ''"kde6"''; + replacement = ''"kde"''; + } + )); qt.style.package = lib.mkIf (cfg.style.name != null) ( lib.mkDefault (stylePackages.${lib.toLower cfg.style.name} or null) diff --git a/tests/modules/misc/qt/qt-platform-theme-kde6-migration.nix b/tests/modules/misc/qt/qt-platform-theme-kde6-migration.nix index cdf54bd51..d0e394735 100644 --- a/tests/modules/misc/qt/qt-platform-theme-kde6-migration.nix +++ b/tests/modules/misc/qt/qt-platform-theme-kde6-migration.nix @@ -4,6 +4,13 @@ platformTheme.name = "kde6"; # Should trigger warning and convert to "kde" }; + test.asserts.warnings.expected = [ + '' + The value "kde6" for `qt.platformTheme.name` is deprecated and will be + removed in a future release. Please use "kde" instead. + '' + ]; + nmt.script = '' # Verify that kde6 gets converted to kde in QT_QPA_PLATFORMTHEME assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \