From c729ffe3b07c8b38a2055dba92001c0ae9946fb5 Mon Sep 17 00:00:00 2001 From: Leonora Tindall Date: Tue, 13 Feb 2024 21:53:35 -0600 Subject: [PATCH] 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. --- modules/targets/generic-linux.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/targets/generic-linux.nix b/modules/targets/generic-linux.nix index b5a07d5fa..fa263a126 100644 --- a/modules/targets/generic-linux.nix +++ b/modules/targets/generic-linux.nix @@ -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; }; }