2024-02-08 22:40:04 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: {
|
2024-02-08 20:21:35 +00:00
|
|
|
services.grocy = {
|
|
|
|
enable = true;
|
|
|
|
hostName = "grocy.owo.monster";
|
|
|
|
nginx.enableSSL = false;
|
2024-02-08 22:40:04 +00:00
|
|
|
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;
|
2024-02-18 21:20:38 +00:00
|
|
|
"php_admin_flag[display_errors]" = true;
|
2024-02-08 22:40:04 +00:00
|
|
|
"php_admin_value[error_log]" = "stderr";
|
|
|
|
"php_admin_flag[log_errors]" = true;
|
|
|
|
};
|
2024-02-08 20:21:35 +00:00
|
|
|
settings = {
|
|
|
|
currency = "GBP";
|
|
|
|
culture = "en_GB";
|
|
|
|
calendar.firstDayOfWeek = 1;
|
|
|
|
};
|
|
|
|
};
|
2024-02-08 22:40:04 +00:00
|
|
|
|
|
|
|
services.phpfpm.pools.grocy = let
|
|
|
|
cfg = config.services.grocy;
|
|
|
|
in {
|
|
|
|
phpEnv = {
|
2024-02-18 21:20:38 +00:00
|
|
|
GROCY_DATAPATH = "${cfg.dataDir}";
|
2024-05-10 22:41:14 +01:00
|
|
|
GROCY_CONFIG_FILE = "/etc/grocy/config.php";
|
|
|
|
GROCY_DB_FILE = "${cfg.dataDir}/grocy.db";
|
|
|
|
GROCY_STORAGE_DIR = "${cfg.dataDir}/storage";
|
|
|
|
GROCY_PLUGIN_DIR = "${cfg.dataDir}/plugins";
|
|
|
|
GROCY_CACHE_DIR = "${cfg.dataDir}/viewcache";
|
2024-02-08 22:40:04 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
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});
|
|
|
|
'';
|
2024-02-08 20:21:35 +00:00
|
|
|
}
|