1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[Unit]
Description=twin-towns — hoverable world map of sister cities from Wikidata
Documentation=man:twin-towns(1)
After=network-online.target

[Service]
Type=simple
# The database is read once at startup and held in memory, so a refresh means
# `twin-towns ingest` followed by a restart of this unit — see twin-towns(1).
ExecStart=%h/.nix-profile/bin/twin-towns serve --db %S/twin-towns/twin-towns.db --addr 127.0.0.1:8778
Restart=on-failure
RestartSec=5s

# Owns exactly one directory, ~/.local/state/twin-towns, holding the database.
StateDirectory=twin-towns

# The serving path never writes and never leaves the machine except to answer
# a request; ingest is a separate, manually-run process.
PrivateTmp=true
ProtectSystem=strict
ProtectHome=read-only
NoNewPrivileges=true

[Install]
WantedBy=default.target