nixos/homepage-dashboard: fix stale cache issue

When the cache is stale, homepage-dashboard serves bad data (UI lacks
styling etc.). This issue happens at least on homepage-dashboard version
upgrades.

Fixes https://github.com/NixOS/nixpkgs/issues/346016.
This commit is contained in:
Bjørn Forsman
2025-01-06 20:21:59 +01:00
parent 55d28df0a2
commit 58f12ee8a6
@@ -254,6 +254,14 @@ in
ExecStart = lib.getExe cfg.package;
Restart = "on-failure";
};
preStart = ''
# Related:
# * https://github.com/NixOS/nixpkgs/issues/346016 ("homepage-dashboard: cache dir is not cleared upon version upgrade")
# * https://github.com/gethomepage/homepage/discussions/4560 ("homepage NixOS package does not clear cache on upgrade leaving broken state")
# * https://github.com/vercel/next.js/discussions/58864 ("Feature Request: Allow configuration of cache dir")
rm -rf "$NIXPKGS_HOMEPAGE_CACHE_DIR"/*
'';
};
networking.firewall = lib.mkIf cfg.openFirewall {