gtk: warn on gtk4 theme inheritance change

The gtk4 theme option still inherits from gtk.theme for users pinned
before 26.05, but that fallback was previously silent. Move the
default through the shared state-version helper so the compatibility
branch emits the standard deprecation warning and stays consistent
with other future cleanups.

Add a focused test that covers the legacy inheritance path alongside
the existing current-state-version test for the null default.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2026-03-13 14:42:33 -05:00
parent acf65ad748
commit d3281688bf
3 changed files with 38 additions and 2 deletions

View file

@ -45,8 +45,24 @@ in
packageExample = "pkgs.gnome.gnome-themes-extra";
}
);
default = if lib.versionOlder config.home.stateVersion "26.05" then cfg.theme else null;
defaultText = literalExpression ''if lib.versionOlder config.home.stateVersion "26.05" then cfg.theme else null'';
inherit
(lib.hm.deprecations.mkStateVersionOptionDefault {
inherit (config.home) stateVersion;
since = "26.05";
optionPath = [
"gtk"
"gtk4"
"theme"
];
legacy = {
value = cfg.theme;
text = "config.gtk.theme";
};
current.value = null;
})
default
defaultText
;
description = ''
Theme for GTK 4 applications.

View file

@ -15,6 +15,7 @@
# GTK4
gtk4-basic-settings = ./gtk4/gtk4-basic-settings.nix;
gtk4-stateversion-theme-inheritance = ./gtk4/gtk4-stateversion-theme-inheritance.nix;
gtk4-theme-css-injection = ./gtk4/gtk4-theme-css-injection.nix;
gtk4-no-theme-css-injection = ./gtk4/gtk4-no-theme-css-injection.nix;
gtk4-stateversion-no-theme-inheritance = ./gtk4/gtk4-stateversion-no-theme-inheritance.nix;

View file

@ -0,0 +1,19 @@
{ pkgs, ... }:
{
home.stateVersion = "25.11";
gtk = {
enable = true;
theme = {
name = "Adwaita-dark";
package = pkgs.gnome-themes-extra;
};
};
nmt.script = ''
assertFileRegex home-files/.config/gtk-4.0/settings.ini \
'^gtk-theme-name=Adwaita-dark$'
assertFileContains home-files/.config/gtk-4.0/gtk.css \
'share/themes/Adwaita-dark/gtk-4.0/gtk.css'
'';
}