1# Grocy {#module-services-grocy}
2
3[Grocy](https://grocy.info/) is a web-based self-hosted groceries
4& household management solution for your home.
5
6## Basic usage {#module-services-grocy-basic-usage}
7
8A very basic configuration may look like this:
9```nix
10{ pkgs, ... }:
11{
12 services.grocy = {
13 enable = true;
14 hostName = "grocy.tld";
15 };
16}
17```
18This configures a simple vhost using [nginx](#opt-services.nginx.enable)
19which listens to `grocy.tld` with fully configured ACME/LE (this can be
20disabled by setting [services.grocy.nginx.enableSSL](#opt-services.grocy.nginx.enableSSL)
21to `false`). After the initial setup the credentials `admin:admin`
22can be used to login.
23
24The application's state is persisted at `/var/lib/grocy/grocy.db` in a
25`sqlite3` database. The migration is applied when requesting the `/`-route
26of the application.
27
28## Settings {#module-services-grocy-settings}
29
30The configuration for `grocy` is located at `/etc/grocy/config.php`.
31By default, the following settings can be defined in the NixOS-configuration:
32```nix
33{ pkgs, ... }:
34{
35 services.grocy.settings = {
36 # The default currency in the system for invoices etc.
37 # Please note that exchange rates aren't taken into account, this
38 # is just the setting for what's shown in the frontend.
39 currency = "EUR";
40
41 # The display language (and locale configuration) for grocy.
42 culture = "de";
43
44 calendar = {
45 # Whether or not to show the week-numbers
46 # in the calendar.
47 showWeekNumber = true;
48
49 # Index of the first day to be shown in the calendar (0=Sunday, 1=Monday,
50 # 2=Tuesday and so on).
51 firstDayOfWeek = 2;
52 };
53 };
54}
55```
56
57If you want to alter the configuration file on your own, you can do this manually with
58an expression like this:
59```nix
60{ lib, ... }:
61{
62 environment.etc."grocy/config.php".text = lib.mkAfter ''
63 // Arbitrary PHP code in grocy's configuration file
64 '';
65}
66```