From 58f12ee8a64f3ec9c7982d1d8ed2ac322d845253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Mon, 6 Jan 2025 20:21:59 +0100 Subject: [PATCH] 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. --- nixos/modules/services/misc/homepage-dashboard.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nixos/modules/services/misc/homepage-dashboard.nix b/nixos/modules/services/misc/homepage-dashboard.nix index a4e5b8d2fc8c..35908488f487 100644 --- a/nixos/modules/services/misc/homepage-dashboard.nix +++ b/nixos/modules/services/misc/homepage-dashboard.nix @@ -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 {