From c2472016795553a0b27cafc7640719480a1169a2 Mon Sep 17 00:00:00 2001 From: Ember Keske Date: Wed, 2 Aug 2023 06:44:36 +0200 Subject: [PATCH 1/2] grocy: 3.3.0 -> 4.0.0 --- nixos/modules/services/web-apps/grocy.nix | 6 +-- .../0001-Define-configs-with-env-vars.patch | 44 +++++++++++-------- ...-config-file-as-it-s-stored-in-etc-g.patch | 14 +++--- pkgs/servers/grocy/default.nix | 5 +-- 4 files changed, 37 insertions(+), 32 deletions(-) diff --git a/nixos/modules/services/web-apps/grocy.nix b/nixos/modules/services/web-apps/grocy.nix index 688367cafaf5..a5bf3bbf83fb 100644 --- a/nixos/modules/services/web-apps/grocy.nix +++ b/nixos/modules/services/web-apps/grocy.nix @@ -115,10 +115,8 @@ in { user = "grocy"; group = "nginx"; - # PHP 8.0 is the only version which is supported/tested by upstream: - # https://github.com/grocy/grocy/blob/v3.3.0/README.md#how-to-install - # Compatibility with PHP 8.1 is available on their development branch: - # https://github.com/grocy/grocy/commit/38a4ad8ec480c29a1bff057b3482fd103b036848 + # PHP 8.1 is the only version which is supported/tested by upstream: + # https://github.com/grocy/grocy/blob/v4.0.0/README.md#platform-support phpPackage = pkgs.php81; inherit (cfg.phpfpm) settings; diff --git a/pkgs/servers/grocy/0001-Define-configs-with-env-vars.patch b/pkgs/servers/grocy/0001-Define-configs-with-env-vars.patch index 4429a804e80d..cc7c45e5e27f 100644 --- a/pkgs/servers/grocy/0001-Define-configs-with-env-vars.patch +++ b/pkgs/servers/grocy/0001-Define-configs-with-env-vars.patch @@ -1,21 +1,21 @@ -From 05b762c6ca58ecb5fd631a019fbda69b0647785f Mon Sep 17 00:00:00 2001 -From: Maximilian Bosch -Date: Tue, 22 Dec 2020 15:38:56 +0100 -Subject: [PATCH] Define configs with env vars +From 3ec6fce101083d4f23641fd015cbe4ade317ad59 Mon Sep 17 00:00:00 2001 +From: Ember Keske +Date: Wed, 2 Aug 2023 06:36:02 +0200 +Subject: [PATCH 1/2] Define configs with env vars --- - app.php | 4 ++-- + app.php | 6 +++--- services/DatabaseService.php | 2 +- services/FilesService.php | 2 +- - services/StockService.php | 3 +-- - 4 files changed, 5 insertions(+), 6 deletions(-) + services/StockService.php | 2 +- + 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app.php b/app.php -index 17ba6a99..89f48089 100644 +index 31905be6..30b3eb82 100644 --- a/app.php +++ b/app.php -@@ -11,7 +11,7 @@ use Slim\Views\Blade; - require_once __DIR__ . '/vendor/autoload.php'; +@@ -12,7 +12,7 @@ use Slim\Views\Blade; + require_once __DIR__ . '/packages/autoload.php'; // Load config files -require_once GROCY_DATAPATH . '/config.php'; @@ -23,7 +23,7 @@ index 17ba6a99..89f48089 100644 require_once __DIR__ . '/config-dist.php'; // For not in own config defined values we use the default ones require_once __DIR__ . '/helpers/ConfigurationValidator.php'; -@@ -62,7 +62,7 @@ $app = AppFactory::create(); +@@ -63,7 +63,7 @@ $app = AppFactory::create(); $container = $app->getContainer(); $container->set('view', function (Container $container) { @@ -32,11 +32,20 @@ index 17ba6a99..89f48089 100644 }); $container->set('UrlManager', function (Container $container) { +@@ -103,7 +103,7 @@ $errorMiddleware->setDefaultErrorHandler( + + $app->add(new CorsMiddleware($app->getResponseFactory())); + +-$app->getRouteCollector()->setCacheFile(GROCY_DATAPATH . '/viewcache/route_cache.php'); ++$app->getRouteCollector()->setCacheFile(getenv('GROCY_CACHE_DIR') . '/route_cache.php'); + + ob_clean(); // No response output before here + $app->run(); diff --git a/services/DatabaseService.php b/services/DatabaseService.php -index c093f361..0894791f 100644 +index be5486b6..b6091ee7 100644 --- a/services/DatabaseService.php +++ b/services/DatabaseService.php -@@ -114,6 +114,6 @@ class DatabaseService +@@ -104,6 +104,6 @@ class DatabaseService return GROCY_DATAPATH . '/grocy_' . $dbSuffix . '.db'; } @@ -58,19 +67,18 @@ index 7d070350..a6dd4b08 100644 { mkdir($this->StoragePath); diff --git a/services/StockService.php b/services/StockService.php -index 85f57803..15556112 100644 +index 16cb468c..23228803 100644 --- a/services/StockService.php +++ b/services/StockService.php -@@ -1704,8 +1704,7 @@ class StockService extends BaseService +@@ -1769,7 +1769,7 @@ class StockService extends BaseService throw new \Exception('No barcode lookup plugin defined'); } - $path = GROCY_DATAPATH . "/plugins/$pluginName.php"; -- + $path = getenv('GROCY_PLUGIN_DIR') . "/$pluginName.php"; + if (file_exists($path)) { - require_once $path; -- -2.38.1 +2.41.0 diff --git a/pkgs/servers/grocy/0002-Remove-check-for-config-file-as-it-s-stored-in-etc-g.patch b/pkgs/servers/grocy/0002-Remove-check-for-config-file-as-it-s-stored-in-etc-g.patch index b065ca801d5f..5b6ae862dcb6 100644 --- a/pkgs/servers/grocy/0002-Remove-check-for-config-file-as-it-s-stored-in-etc-g.patch +++ b/pkgs/servers/grocy/0002-Remove-check-for-config-file-as-it-s-stored-in-etc-g.patch @@ -1,6 +1,6 @@ -From c46323dfc4a3d5bf17f7508f5b5f223858a598c3 Mon Sep 17 00:00:00 2001 -From: Maximilian Bosch -Date: Tue, 22 Dec 2020 15:39:15 +0100 +From 0e834aa0ef712ce97acf24c05c43a04387fda18c Mon Sep 17 00:00:00 2001 +From: Ember Keske +Date: Wed, 2 Aug 2023 06:36:46 +0200 Subject: [PATCH 2/2] Remove check for config-file as it's stored in /etc/grocy --- @@ -8,17 +8,17 @@ Subject: [PATCH 2/2] Remove check for config-file as it's stored in /etc/grocy 1 file changed, 1 deletion(-) diff --git a/helpers/PrerequisiteChecker.php b/helpers/PrerequisiteChecker.php -index cbe0a3a..a484db2 100644 +index da431b4b..6b878627 100644 --- a/helpers/PrerequisiteChecker.php +++ b/helpers/PrerequisiteChecker.php -@@ -11,7 +11,6 @@ class PrerequisiteChecker - { +@@ -17,7 +17,6 @@ class PrerequisiteChecker public function checkRequirements() { + self::checkForPhpVersion(); - self::checkForConfigFile(); self::checkForConfigDistFile(); self::checkForComposer(); self::checkForPhpExtensions(); -- -2.29.2 +2.41.0 diff --git a/pkgs/servers/grocy/default.nix b/pkgs/servers/grocy/default.nix index bbae0f8f248f..6b39ec1fe8bf 100644 --- a/pkgs/servers/grocy/default.nix +++ b/pkgs/servers/grocy/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "grocy"; - version = "3.3.2"; + version = "4.0.0"; src = fetchurl { url = "https://github.com/grocy/grocy/releases/download/v${version}/grocy_${version}.zip"; - sha256 = "sha256-KF4zxrC8rlRUaBKc4iLIt6TSAHMJ+tOWptMsVcixVWs="; + sha256 = "sha256-Sei+UYM5azzSWgnmgufxDl5ySbYJ52DBGPc0nTjnqqc="; }; nativeBuildInputs = [ unzip ]; @@ -36,6 +36,5 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ ma27 ]; description = "ERP beyond your fridge - grocy is a web-based self-hosted groceries & household management solution for your home"; homepage = "https://grocy.info/"; - broken = true; # Not compatible with PHP 8.1 }; } From 66ee520289a94519350a741924a52b41ae8237df Mon Sep 17 00:00:00 2001 From: Ember Keske Date: Sat, 19 Aug 2023 13:02:04 +0200 Subject: [PATCH 2/2] grocy: replace @ma27 with @n0emis as maintainer --- nixos/modules/services/web-apps/grocy.nix | 2 +- pkgs/servers/grocy/default.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/web-apps/grocy.nix b/nixos/modules/services/web-apps/grocy.nix index a5bf3bbf83fb..b0d3c44cea81 100644 --- a/nixos/modules/services/web-apps/grocy.nix +++ b/nixos/modules/services/web-apps/grocy.nix @@ -166,7 +166,7 @@ in { }; meta = { - maintainers = with maintainers; [ ma27 ]; + maintainers = with maintainers; [ n0emis ]; doc = ./grocy.md; }; } diff --git a/pkgs/servers/grocy/default.nix b/pkgs/servers/grocy/default.nix index 6b39ec1fe8bf..5777245d6780 100644 --- a/pkgs/servers/grocy/default.nix +++ b/pkgs/servers/grocy/default.nix @@ -33,7 +33,7 @@ stdenv.mkDerivation rec { meta = with lib; { license = licenses.mit; - maintainers = with maintainers; [ ma27 ]; + maintainers = with maintainers; [ n0emis ]; description = "ERP beyond your fridge - grocy is a web-based self-hosted groceries & household management solution for your home"; homepage = "https://grocy.info/"; };