···11+# Grocy {#module-services-grocy}
22+33+[Grocy](https://grocy.info/) is a web-based self-hosted groceries
44+& household management solution for your home.
55+66+## Basic usage {#module-services-grocy-basic-usage}
77+88+A very basic configuration may look like this:
99+```
1010+{ pkgs, ... }:
1111+{
1212+ services.grocy = {
1313+ enable = true;
1414+ hostName = "grocy.tld";
1515+ };
1616+}
1717+```
1818+This configures a simple vhost using [nginx](#opt-services.nginx.enable)
1919+which listens to `grocy.tld` with fully configured ACME/LE (this can be
2020+disabled by setting [services.grocy.nginx.enableSSL](#opt-services.grocy.nginx.enableSSL)
2121+to `false`). After the initial setup the credentials `admin:admin`
2222+can be used to login.
2323+2424+The application's state is persisted at `/var/lib/grocy/grocy.db` in a
2525+`sqlite3` database. The migration is applied when requesting the `/`-route
2626+of the application.
2727+2828+## Settings {#module-services-grocy-settings}
2929+3030+The configuration for `grocy` is located at `/etc/grocy/config.php`.
3131+By default, the following settings can be defined in the NixOS-configuration:
3232+```
3333+{ pkgs, ... }:
3434+{
3535+ services.grocy.settings = {
3636+ # The default currency in the system for invoices etc.
3737+ # Please note that exchange rates aren't taken into account, this
3838+ # is just the setting for what's shown in the frontend.
3939+ currency = "EUR";
4040+4141+ # The display language (and locale configuration) for grocy.
4242+ culture = "de";
4343+4444+ calendar = {
4545+ # Whether or not to show the week-numbers
4646+ # in the calendar.
4747+ showWeekNumber = true;
4848+4949+ # Index of the first day to be shown in the calendar (0=Sunday, 1=Monday,
5050+ # 2=Tuesday and so on).
5151+ firstDayOfWeek = 2;
5252+ };
5353+ };
5454+}
5555+```
5656+5757+If you want to alter the configuration file on your own, you can do this manually with
5858+an expression like this:
5959+```
6060+{ lib, ... }:
6161+{
6262+ environment.etc."grocy/config.php".text = lib.mkAfter ''
6363+ // Arbitrary PHP code in grocy's configuration file
6464+ '';
6565+}
6666+```
+2
nixos/modules/services/web-apps/grocy.nix
···167167168168 meta = {
169169 maintainers = with maintainers; [ ma27 ];
170170+ # Don't edit the docbook xml directly, edit the md and generate it:
171171+ # `pandoc grocy.md -t docbook --top-level-division=chapter --extract-media=media -f markdown-smart --lua-filter ../../../../doc/build-aux/pandoc-filters/myst-reader/roles.lua --lua-filter ../../../../doc/build-aux/pandoc-filters/docbook-writer/rst-roles.lua > grocy.xml`
170172 doc = ./grocy.xml;
171173 };
172174}
+40-41
nixos/modules/services/web-apps/grocy.xml
···11-<chapter xmlns="http://docbook.org/ns/docbook"
22- xmlns:xlink="http://www.w3.org/1999/xlink"
33- xmlns:xi="http://www.w3.org/2001/XInclude"
44- version="5.0"
55- xml:id="module-services-grocy">
66-11+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="module-services-grocy">
72 <title>Grocy</title>
83 <para>
99- <link xlink:href="https://grocy.info/">Grocy</link> is a web-based self-hosted groceries
1010- & household management solution for your home.
44+ <link xlink:href="https://grocy.info/">Grocy</link> is a web-based
55+ self-hosted groceries & household management solution for your
66+ home.
117 </para>
1212-138 <section xml:id="module-services-grocy-basic-usage">
1414- <title>Basic usage</title>
1515- <para>
1616- A very basic configuration may look like this:
1717-<programlisting>
99+ <title>Basic usage</title>
1010+ <para>
1111+ A very basic configuration may look like this:
1212+ </para>
1313+ <programlisting>
1814{ pkgs, ... }:
1915{
2016 services.grocy = {
2117 enable = true;
2222- hostName = "grocy.tld";
1818+ hostName = "grocy.tld";
2319 };
2420}
2521</programlisting>
2626- This configures a simple vhost using <link linkend="opt-services.nginx.enable">nginx</link>
2727- which listens to <literal>grocy.tld</literal> with fully configured ACME/LE (this can be
2828- disabled by setting <link linkend="opt-services.grocy.nginx.enableSSL">services.grocy.nginx.enableSSL</link>
2929- to <literal>false</literal>). After the initial setup the credentials <literal>admin:admin</literal>
3030- can be used to login.
3131- </para>
3232- <para>
3333- The application's state is persisted at <literal>/var/lib/grocy/grocy.db</literal> in a
3434- <literal>sqlite3</literal> database. The migration is applied when requesting the <literal>/</literal>-route
3535- of the application.
3636- </para>
2222+ <para>
2323+ This configures a simple vhost using
2424+ <link linkend="opt-services.nginx.enable">nginx</link> which
2525+ listens to <literal>grocy.tld</literal> with fully configured
2626+ ACME/LE (this can be disabled by setting
2727+ <link linkend="opt-services.grocy.nginx.enableSSL">services.grocy.nginx.enableSSL</link>
2828+ to <literal>false</literal>). After the initial setup the
2929+ credentials <literal>admin:admin</literal> can be used to login.
3030+ </para>
3131+ <para>
3232+ The application's state is persisted at
3333+ <literal>/var/lib/grocy/grocy.db</literal> in a
3434+ <literal>sqlite3</literal> database. The migration is applied when
3535+ requesting the <literal>/</literal>-route of the application.
3636+ </para>
3737 </section>
3838-3938 <section xml:id="module-services-grocy-settings">
4040- <title>Settings</title>
4141- <para>
4242- The configuration for <literal>grocy</literal> is located at <literal>/etc/grocy/config.php</literal>.
4343- By default, the following settings can be defined in the NixOS-configuration:
4444-<programlisting>
3939+ <title>Settings</title>
4040+ <para>
4141+ The configuration for <literal>grocy</literal> is located at
4242+ <literal>/etc/grocy/config.php</literal>. By default, the
4343+ following settings can be defined in the NixOS-configuration:
4444+ </para>
4545+ <programlisting>
4546{ pkgs, ... }:
4647{
4748 services.grocy.settings = {
4849 # The default currency in the system for invoices etc.
4950 # Please note that exchange rates aren't taken into account, this
5051 # is just the setting for what's shown in the frontend.
5151- currency = "EUR";
5252+ currency = "EUR";
52535354 # The display language (and locale configuration) for grocy.
5454- culture = "de";
5555+ culture = "de";
55565657 calendar = {
5758 # Whether or not to show the week-numbers
···6566 };
6667}
6768</programlisting>
6868- </para>
6969- <para>
7070- If you want to alter the configuration file on your own, you can do this manually with
7171- an expression like this:
7272-<programlisting>
6969+ <para>
7070+ If you want to alter the configuration file on your own, you can
7171+ do this manually with an expression like this:
7272+ </para>
7373+ <programlisting>
7374{ lib, ... }:
7475{
7575- environment.etc."grocy/config.php".text = lib.mkAfter ''
7676+ environment.etc."grocy/config.php".text = lib.mkAfter ''
7677 // Arbitrary PHP code in grocy's configuration file
7778 '';
7879}
7980</programlisting>
8080- </para>
8181 </section>
8282-8382</chapter>