summary refs log tree commit diff
path: root/pkgs/servers
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2020-02-09 23:11:46 +0100
committerGitHub <noreply@github.com>2020-02-09 23:11:46 +0100
commitc2f2366f5c0d6574f1f5ba7e58149def2157c5d9 (patch)
tree9a578aa882d46584ee7121f63ef06c32b0cc4979 /pkgs/servers
parentc8718e29b3740b9094aee842e7b157872d98942e (diff)
parent13f7b7555322f5727d4b5279102222fdbee62587 (diff)
downloadnixpkgs-c2f2366f5c0d6574f1f5ba7e58149def2157c5d9.tar
nixpkgs-c2f2366f5c0d6574f1f5ba7e58149def2157c5d9.tar.gz
nixpkgs-c2f2366f5c0d6574f1f5ba7e58149def2157c5d9.tar.bz2
nixpkgs-c2f2366f5c0d6574f1f5ba7e58149def2157c5d9.tar.lz
nixpkgs-c2f2366f5c0d6574f1f5ba7e58149def2157c5d9.tar.xz
nixpkgs-c2f2366f5c0d6574f1f5ba7e58149def2157c5d9.tar.zst
nixpkgs-c2f2366f5c0d6574f1f5ba7e58149def2157c5d9.zip
Merge pull request #79485 from Ma27/grocy
grocy: init at 2.6.0
Diffstat (limited to 'pkgs/servers')
-rw-r--r--pkgs/servers/grocy/config-locations.patch61
-rw-r--r--pkgs/servers/grocy/default.nix32
2 files changed, 93 insertions, 0 deletions
diff --git a/pkgs/servers/grocy/config-locations.patch b/pkgs/servers/grocy/config-locations.patch
new file mode 100644
index 00000000000..475be78ec20
--- /dev/null
+++ b/pkgs/servers/grocy/config-locations.patch
@@ -0,0 +1,61 @@
+diff --git a/app.php b/app.php
+index 5f91e4d..09c6010 100644
+--- a/app.php
++++ b/app.php
+@@ -23,7 +23,7 @@ else
+ require_once __DIR__ . '/vendor/autoload.php';

+ 

+ // Load config files

+-require_once GROCY_DATAPATH . '/config.php';

++require_once getenv('GROCY_CONFIG_FILE');

+ require_once __DIR__ . '/config-dist.php'; // For not in own config defined values we use the default ones

+ 

+ // Definitions for dev/demo/prerelease mode

+@@ -49,7 +49,7 @@ $appContainer = new \Slim\Container([
+ 	],

+ 	'view' => function($container)

+ 	{

+-		return new \Slim\Views\Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache');

++		return new \Slim\Views\Blade(__DIR__ . '/views', getenv('GROCY_CACHE_DIR'));

+ 	},

+ 	'LoginControllerInstance' => function($container)

+ 	{

+diff --git a/services/DatabaseService.php b/services/DatabaseService.php
+index 0bcf9b8..ec45e93 100644
+--- a/services/DatabaseService.php
++++ b/services/DatabaseService.php
+@@ -13,7 +13,7 @@ class DatabaseService
+ 			return GROCY_DATAPATH . '/grocy_' . GROCY_CULTURE . '.db';

+ 		}

+ 

+-		return GROCY_DATAPATH . '/grocy.db';

++		return getenv('GROCY_DB_FILE');

+ 	}

+ 

+ 	private $DbConnectionRaw;

+diff --git a/services/FilesService.php b/services/FilesService.php
+index 7933b73..f52657e 100644
+--- a/services/FilesService.php
++++ b/services/FilesService.php
+@@ -12,7 +12,7 @@ class FilesService extends BaseService
+ 	{

+ 		parent::__construct();

+ 		

+-		$this->StoragePath = GROCY_DATAPATH . '/storage';

++		$this->StoragePath = getenv('GROCY_STORAGE_DIR');

+ 		

+ 		if (!file_exists($this->StoragePath))

+ 		{

+diff --git a/services/StockService.php b/services/StockService.php
+index d7482ef..d1399a7 100644
+--- a/services/StockService.php
++++ b/services/StockService.php
+@@ -933,7 +933,7 @@ class StockService extends BaseService
+ 			throw new \Exception('No barcode lookup plugin defined');

+ 		}

+ 

+-		$path = GROCY_DATAPATH . "/plugins/$pluginName.php";

++		$path = getenv('GROCY_PLUGIN_DIR');

+ 		if (file_exists($path))

+ 		{

+ 			require_once $path;

diff --git a/pkgs/servers/grocy/default.nix b/pkgs/servers/grocy/default.nix
new file mode 100644
index 00000000000..7af59f6904c
--- /dev/null
+++ b/pkgs/servers/grocy/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+  pname = "grocy";
+  version = "2.6.0";
+
+  src = fetchurl {
+    url = "https://github.com/grocy/grocy/releases/download/v${version}/grocy_${version}.zip";
+    sha256 = "1d4hy495in7p0i4fnhai1yqhjhmblv1g30siggmqpjrzdiiw3bak";
+  };
+
+  nativeBuildInputs = [ unzip ];
+  unpackPhase = ''
+    unzip ${src} -d .
+  '';
+
+  patches = [ ./config-locations.patch ];
+
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p $out/
+    cp -R . $out/
+  '';
+
+  meta = with stdenv.lib; {
+    license = licenses.mit;
+    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/";
+  };
+}