···115 user = "grocy";
116 group = "nginx";
117118- # PHP 8.1 is the only version which is supported/tested by upstream:
119- # https://github.com/grocy/grocy/blob/v4.0.0/README.md#platform-support
120- phpPackage = pkgs.php81;
121122 inherit (cfg.phpfpm) settings;
123···128 GROCY_PLUGIN_DIR = "${cfg.dataDir}/plugins";
129 GROCY_CACHE_DIR = "${cfg.dataDir}/viewcache";
130 };
0000000000131 };
132133 services.nginx = {
···115 user = "grocy";
116 group = "nginx";
117118+ # PHP 8.1 and 8.2 are the only version which are supported/tested by upstream:
119+ # https://github.com/grocy/grocy/blob/v4.0.2/README.md#platform-support
120+ phpPackage = pkgs.php82;
121122 inherit (cfg.phpfpm) settings;
123···128 GROCY_PLUGIN_DIR = "${cfg.dataDir}/plugins";
129 GROCY_CACHE_DIR = "${cfg.dataDir}/viewcache";
130 };
131+ };
132+133+ # After an update of grocy, the viewcache needs to be deleted. Otherwise grocy will not work
134+ # https://github.com/grocy/grocy#how-to-update
135+ systemd.services.grocy-setup = {
136+ wantedBy = [ "multi-user.target" ];
137+ before = [ "phpfpm-grocy.service" ];
138+ script = ''
139+ rm -rf ${cfg.dataDir}/viewcache/*
140+ '';
141 };
142143 services.nginx = {