targets/generic-linux: add enableKdeApplicationCache

This option allows home-manager to trigger kbuildsycoca to refresh the
KDE .desktop file cache, making desktop applications appear in menus.
This commit is contained in:
Leonora Tindall 2024-02-13 21:53:35 -06:00
parent 21b078306a
commit c729ffe3b0

View file

@ -26,6 +26,14 @@ in {
GNU/Linux distributions other than NixOS.
'';
};
enableKdeApplicationCache = mkEnableOption "" // {
description = ''
Whether to enable the management of the KDE application cache.
When using KDE Plasma, desktop applications installed via
home-manager may not appear in menus with this option disabled.
'';
};
};
config = mkIf cfg.enable {
@ -103,5 +111,13 @@ in {
TERMINFO_DIRS =
"${profileDirectory}/share/terminfo:$TERMINFO_DIRS\${TERMINFO_DIRS:+:}${distroTerminfoDirs}";
};
home.activation.updateKdeApplicationCache =
if cfg.enableKdeApplicationCache then
hm.dag.entryAfter [ "installPackages" ] ''
run /usr/bin/kbuildsycoca5 --noincremental
''
else
null;
};
}