update to latest commit of grocy to make it work in new firefox
This commit is contained in:
parent
221b765adf
commit
7b0b321e89
|
@ -1,12 +1,55 @@
|
|||
{...}: {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
services.grocy = {
|
||||
enable = true;
|
||||
hostName = "grocy.owo.monster";
|
||||
nginx.enableSSL = false;
|
||||
phpfpm.settings = {
|
||||
"listen.owner" = "nginx";
|
||||
"pm" = "dynamic";
|
||||
"pm.max_children" = 32;
|
||||
"pm.max_requests" = 500;
|
||||
"pm.start_servers" = 2;
|
||||
"pm.min_spare_servers" = 2;
|
||||
"pm.max_spare_servers" = 5;
|
||||
"catch_workers_output" = true;
|
||||
#"php_flag[display_errors]" = true;
|
||||
"php_admin_value[error_log]" = "stderr";
|
||||
"php_admin_flag[log_errors]" = true;
|
||||
};
|
||||
settings = {
|
||||
currency = "GBP";
|
||||
culture = "en_GB";
|
||||
calendar.firstDayOfWeek = 1;
|
||||
};
|
||||
};
|
||||
|
||||
services.phpfpm.pools.grocy = let
|
||||
cfg = config.services.grocy;
|
||||
in {
|
||||
phpEnv = {
|
||||
GROCY_CONFIG_FILE = "/etc/grocy/config.php";
|
||||
GROCY_DB_FILE = "${cfg.dataDir}/grocy.db";
|
||||
GROCY_SQL_LOG_FILE = "${cfg.dataDir}/sql.log";
|
||||
GROCY_STORAGE_DIR = "${cfg.dataDir}/storage";
|
||||
GROCY_PLUGIN_DIR = "${cfg.dataDir}/plugins";
|
||||
GROCY_CACHE_DIR = "${cfg.dataDir}/viewcache";
|
||||
};
|
||||
};
|
||||
|
||||
environment.etc."grocy/config.php".text = let
|
||||
cfg = config.services.grocy;
|
||||
inherit (lib.trivial) boolToString;
|
||||
inherit (lib.modules) mkForce;
|
||||
in
|
||||
mkForce ''
|
||||
<?php
|
||||
Setting('CULTURE', '${cfg.settings.culture}');
|
||||
Setting('CURRENCY', '${cfg.settings.currency}');
|
||||
Setting('CALENDAR_FIRST_DAY_OF_WEEK', '${toString cfg.settings.calendar.firstDayOfWeek}');
|
||||
Setting('CALENDAR_SHOW_WEEK_OF_YEAR', ${boolToString cfg.settings.calendar.showWeekNumber});
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ in
|
|||
packages = {
|
||||
inherit (pkgs) comic-code comic-sans;
|
||||
inherit (pkgs) mk-enc-usb mk-encrypted-drive mk-raspberry-ext-drive;
|
||||
inherit (pkgs) gotosocial mpd-headless owncast;
|
||||
inherit (pkgs) gotosocial grocy mpd-headless owncast;
|
||||
inherit (pkgs) kitty-terminfo;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,6 +13,28 @@ final: prev: rec {
|
|||
cp -r ${./kitty-terminfo}/* $out/share
|
||||
'';
|
||||
|
||||
# latest version
|
||||
# to generate zip:
|
||||
# nix-shell -p stdenv php phpPackages.composer nodejs yarn
|
||||
# yarn install --frozen-lockfile --modules-folder public/packages --production
|
||||
# composer install --no-interaction --no-dev --optimize-autoloader
|
||||
# bsdtar cvaf ../Projects/nixfiles/overlay/grocy-9f94ba55a4a5ad91a442800d6734ee6968847d3b.zip .
|
||||
#
|
||||
# this includes a bunch of unneeded files
|
||||
# but we cba to go through the bat file
|
||||
# the author uses to figure out what all the 7z commands do)
|
||||
grocy = prev.grocy.overrideAttrs (_old: let
|
||||
rev = "9f94ba55a4a5ad91a442800d6734ee6968847d3b";
|
||||
in rec {
|
||||
src = ./grocy-${rev}.zip;
|
||||
unpackPhase = ''
|
||||
unzip ${src} -d .
|
||||
'';
|
||||
patches = [
|
||||
./grocy-env-variables.diff
|
||||
];
|
||||
});
|
||||
|
||||
# Remove when fixed in upstream
|
||||
jellyfin-ffmpeg =
|
||||
(prev.ffmpeg_6-headless.override {
|
||||
|
|
BIN
overlay/grocy-9f94ba55a4a5ad91a442800d6734ee6968847d3b.zip
Normal file
BIN
overlay/grocy-9f94ba55a4a5ad91a442800d6734ee6968847d3b.zip
Normal file
Binary file not shown.
99
overlay/grocy-env-variables.diff
Normal file
99
overlay/grocy-env-variables.diff
Normal file
|
@ -0,0 +1,99 @@
|
|||
diff --git a/app.php b/app.php
|
||||
index bc5b1b39..26f7687e 100644
|
||||
--- a/app.php
|
||||
+++ b/app.php
|
||||
@@ -12,7 +12,7 @@ use Slim\Views\Blade;
|
||||
require_once __DIR__ . '/packages/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
|
||||
require_once __DIR__ . '/helpers/ConfigurationValidator.php';
|
||||
|
||||
@@ -64,7 +64,7 @@ $app = AppFactory::create();
|
||||
$container = $app->getContainer();
|
||||
$container->set('view', function (Container $container)
|
||||
{
|
||||
- return new Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache');
|
||||
+ return new Blade(__DIR__ . '/views', getenv('GROCY_CACHE_DIR'));
|
||||
});
|
||||
|
||||
$container->set('UrlManager', function (Container $container)
|
||||
@@ -106,7 +106,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/helpers/PrerequisiteChecker.php b/helpers/PrerequisiteChecker.php
|
||||
index 8e12a5c5..37b433db 100644
|
||||
--- a/helpers/PrerequisiteChecker.php
|
||||
+++ b/helpers/PrerequisiteChecker.php
|
||||
@@ -18,7 +18,6 @@ class PrerequisiteChecker
|
||||
public function checkRequirements()
|
||||
{
|
||||
self::checkForPhpVersion();
|
||||
- self::checkForConfigFile();
|
||||
self::checkForConfigDistFile();
|
||||
self::checkForComposer();
|
||||
self::checkForPhpExtensions();
|
||||
diff --git a/services/DatabaseService.php b/services/DatabaseService.php
|
||||
index e22d0c76..66938bed 100644
|
||||
--- a/services/DatabaseService.php
|
||||
+++ b/services/DatabaseService.php
|
||||
@@ -29,7 +29,7 @@ class DatabaseService
|
||||
|
||||
if (GROCY_MODE === 'dev')
|
||||
{
|
||||
- $logFilePath = GROCY_DATAPATH . '/sql.log';
|
||||
+ $logFilePath = getenv('GROCY_SQL_LOG_FILE');
|
||||
if (file_exists($logFilePath))
|
||||
{
|
||||
file_put_contents($logFilePath, $sql . PHP_EOL, FILE_APPEND);
|
||||
@@ -70,7 +70,7 @@ class DatabaseService
|
||||
|
||||
if (GROCY_MODE === 'dev')
|
||||
{
|
||||
- $logFilePath = GROCY_DATAPATH . '/sql.log';
|
||||
+ $logFilePath = getenv('GROCY_SQL_LOG_FILE');
|
||||
if (file_exists($logFilePath))
|
||||
{
|
||||
self::$DbConnection->setQueryCallback(function ($query, $params) use ($logFilePath)
|
||||
@@ -137,6 +137,6 @@ class DatabaseService
|
||||
return GROCY_DATAPATH . '/grocy_' . $dbSuffix . '.db';
|
||||
}
|
||||
|
||||
- return GROCY_DATAPATH . '/grocy.db';
|
||||
+ return getenv('GROCY_DB_FILE');
|
||||
}
|
||||
}
|
||||
diff --git a/services/FilesService.php b/services/FilesService.php
|
||||
index 7d070350..a6dd4b08 100644
|
||||
--- a/services/FilesService.php
|
||||
+++ b/services/FilesService.php
|
||||
@@ -10,7 +10,7 @@ class FilesService extends BaseService
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
- $this->StoragePath = GROCY_DATAPATH . '/storage';
|
||||
+ $this->StoragePath = getenv('GROCY_STORAGE_DIR');
|
||||
if (!file_exists($this->StoragePath))
|
||||
{
|
||||
mkdir($this->StoragePath);
|
||||
diff --git a/services/StockService.php b/services/StockService.php
|
||||
index 86c0b4f5..ba752a14 100644
|
||||
--- a/services/StockService.php
|
||||
+++ b/services/StockService.php
|
||||
@@ -1707,7 +1707,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;
|
Loading…
Reference in a new issue