Merge pull request #250224 from n0emis/grocy-4.0.2

grocy: 4.0.0 -> 4.0.2

authored by Weijia Wang and committed by GitHub 71c99509 88d4f507

+27 -17
+13 -3
nixos/modules/services/web-apps/grocy.nix
··· 115 user = "grocy"; 116 group = "nginx"; 117 118 - # 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; 121 122 inherit (cfg.phpfpm) settings; 123 ··· 128 GROCY_PLUGIN_DIR = "${cfg.dataDir}/plugins"; 129 GROCY_CACHE_DIR = "${cfg.dataDir}/viewcache"; 130 }; 131 }; 132 133 services.nginx = {
··· 115 user = "grocy"; 116 group = "nginx"; 117 118 + # 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; 121 122 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 }; 142 143 services.nginx = {
+11 -11
pkgs/servers/grocy/0001-Define-configs-with-env-vars.patch
··· 1 - From 3ec6fce101083d4f23641fd015cbe4ade317ad59 Mon Sep 17 00:00:00 2001 2 From: Ember Keske <git@n0emis.eu> 3 Date: Wed, 2 Aug 2023 06:36:02 +0200 4 Subject: [PATCH 1/2] Define configs with env vars ··· 11 4 files changed, 6 insertions(+), 6 deletions(-) 12 13 diff --git a/app.php b/app.php 14 - index 31905be6..30b3eb82 100644 15 --- a/app.php 16 +++ b/app.php 17 @@ -12,7 +12,7 @@ use Slim\Views\Blade; ··· 23 require_once __DIR__ . '/config-dist.php'; // For not in own config defined values we use the default ones 24 require_once __DIR__ . '/helpers/ConfigurationValidator.php'; 25 26 - @@ -63,7 +63,7 @@ $app = AppFactory::create(); 27 - 28 $container = $app->getContainer(); 29 - $container->set('view', function (Container $container) { 30 - return new Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache'); 31 + return new Blade(__DIR__ . '/views', getenv('GROCY_CACHE_DIR')); 32 }); 33 34 - $container->set('UrlManager', function (Container $container) { 35 - @@ -103,7 +103,7 @@ $errorMiddleware->setDefaultErrorHandler( 36 37 $app->add(new CorsMiddleware($app->getResponseFactory())); 38 ··· 42 ob_clean(); // No response output before here 43 $app->run(); 44 diff --git a/services/DatabaseService.php b/services/DatabaseService.php 45 - index be5486b6..b6091ee7 100644 46 --- a/services/DatabaseService.php 47 +++ b/services/DatabaseService.php 48 - @@ -104,6 +104,6 @@ class DatabaseService 49 return GROCY_DATAPATH . '/grocy_' . $dbSuffix . '.db'; 50 } 51 ··· 67 { 68 mkdir($this->StoragePath); 69 diff --git a/services/StockService.php b/services/StockService.php 70 - index 16cb468c..23228803 100644 71 --- a/services/StockService.php 72 +++ b/services/StockService.php 73 - @@ -1769,7 +1769,7 @@ class StockService extends BaseService 74 throw new \Exception('No barcode lookup plugin defined'); 75 } 76
··· 1 + From 231ee836e357b83cc2fc0a3a977f74839308ec68 Mon Sep 17 00:00:00 2001 2 From: Ember Keske <git@n0emis.eu> 3 Date: Wed, 2 Aug 2023 06:36:02 +0200 4 Subject: [PATCH 1/2] Define configs with env vars ··· 11 4 files changed, 6 insertions(+), 6 deletions(-) 12 13 diff --git a/app.php b/app.php 14 + index bc5b1b39..26f7687e 100644 15 --- a/app.php 16 +++ b/app.php 17 @@ -12,7 +12,7 @@ use Slim\Views\Blade; ··· 23 require_once __DIR__ . '/config-dist.php'; // For not in own config defined values we use the default ones 24 require_once __DIR__ . '/helpers/ConfigurationValidator.php'; 25 26 + @@ -64,7 +64,7 @@ $app = AppFactory::create(); 27 $container = $app->getContainer(); 28 + $container->set('view', function (Container $container) 29 + { 30 - return new Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache'); 31 + return new Blade(__DIR__ . '/views', getenv('GROCY_CACHE_DIR')); 32 }); 33 34 + $container->set('UrlManager', function (Container $container) 35 + @@ -106,7 +106,7 @@ $errorMiddleware->setDefaultErrorHandler( 36 37 $app->add(new CorsMiddleware($app->getResponseFactory())); 38 ··· 42 ob_clean(); // No response output before here 43 $app->run(); 44 diff --git a/services/DatabaseService.php b/services/DatabaseService.php 45 + index 4a05bda1..ce41ed17 100644 46 --- a/services/DatabaseService.php 47 +++ b/services/DatabaseService.php 48 + @@ -125,6 +125,6 @@ class DatabaseService 49 return GROCY_DATAPATH . '/grocy_' . $dbSuffix . '.db'; 50 } 51 ··· 67 { 68 mkdir($this->StoragePath); 69 diff --git a/services/StockService.php b/services/StockService.php 70 + index 7265e82b..13af591a 100644 71 --- a/services/StockService.php 72 +++ b/services/StockService.php 73 + @@ -1761,7 +1761,7 @@ class StockService extends BaseService 74 throw new \Exception('No barcode lookup plugin defined'); 75 } 76
+1 -1
pkgs/servers/grocy/0002-Remove-check-for-config-file-as-it-s-stored-in-etc-g.patch
··· 1 - From 0e834aa0ef712ce97acf24c05c43a04387fda18c Mon Sep 17 00:00:00 2001 2 From: Ember Keske <git@n0emis.eu> 3 Date: Wed, 2 Aug 2023 06:36:46 +0200 4 Subject: [PATCH 2/2] Remove check for config-file as it's stored in /etc/grocy
··· 1 + From b532add2d1287489d4541e79c976bb77795696cd Mon Sep 17 00:00:00 2001 2 From: Ember Keske <git@n0emis.eu> 3 Date: Wed, 2 Aug 2023 06:36:46 +0200 4 Subject: [PATCH 2/2] Remove check for config-file as it's stored in /etc/grocy
+2 -2
pkgs/servers/grocy/default.nix
··· 2 3 stdenv.mkDerivation rec { 4 pname = "grocy"; 5 - version = "4.0.0"; 6 7 src = fetchurl { 8 url = "https://github.com/grocy/grocy/releases/download/v${version}/grocy_${version}.zip"; 9 - sha256 = "sha256-Sei+UYM5azzSWgnmgufxDl5ySbYJ52DBGPc0nTjnqqc="; 10 }; 11 12 nativeBuildInputs = [ unzip ];
··· 2 3 stdenv.mkDerivation rec { 4 pname = "grocy"; 5 + version = "4.0.2"; 6 7 src = fetchurl { 8 url = "https://github.com/grocy/grocy/releases/download/v${version}/grocy_${version}.zip"; 9 + sha256 = "sha256-ZhXfZKmfg8lSzEAGIj7LMIfvaHG1FY5j+/OpOCTxm3c="; 10 }; 11 12 nativeBuildInputs = [ unzip ];