{ config, lib, pkgs, ... }: with lib; let cfg = config.services.grocy; in { options.services.grocy = { enable = mkEnableOption "grocy"; hostName = mkOption { type = types.str; description = '' FQDN for the grocy instance. ''; }; nginx.enableSSL = mkOption { type = types.bool; default = true; description = '' Whether or not to enable SSL (with ACME and let's encrypt) for the grocy vhost. ''; }; phpfpm.settings = mkOption { type = with types; attrsOf (oneOf [ int str bool ]); default = { "pm" = "dynamic"; "php_admin_value[error_log]" = "stderr"; "php_admin_flag[log_errors]" = true; "listen.owner" = "nginx"; "catch_workers_output" = true; "pm.max_children" = "32"; "pm.start_servers" = "2"; "pm.min_spare_servers" = "2"; "pm.max_spare_servers" = "4"; "pm.max_requests" = "500"; }; description = '' Options for grocy's PHPFPM pool. ''; }; dataDir = mkOption { type = types.str; default = "/var/lib/grocy"; description = '' Home directory of the grocy user which contains the application's state. ''; }; settings = { currency = mkOption { type = types.str; default = "USD"; example = "EUR"; description = '' ISO 4217 code for the currency to display. ''; }; culture = mkOption { type = types.enum [ "de" "en" "da" "en_GB" "es" "fr" "hu" "it" "nl" "no" "pl" "pt_BR" "ru" "sk_SK" "sv_SE" "tr" ]; default = "en"; description = '' Display language of the frontend. ''; }; calendar = { showWeekNumber = mkOption { default = true; type = types.bool; description = '' Show the number of the weeks in the calendar views. ''; }; firstDayOfWeek = mkOption { default = null; type = types.nullOr (types.enum (range 0 6)); description = '' Which day of the week (0=Sunday, 1=Monday etc.) should be the first day. ''; }; }; }; }; config = mkIf cfg.enable { environment.etc."grocy/config.php".text = ''