-
Notifications
You must be signed in to change notification settings - Fork 0
/
timetagger.nix
75 lines (71 loc) · 2.06 KB
/
timetagger.nix
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Auto-generated using compose2nix v0.2.1-pre.
{ pkgs, lib, ... }:
{
# Runtime
virtualisation.docker = {
enable = true;
autoPrune.enable = true;
};
virtualisation.oci-containers.backend = "docker";
# Containers
virtualisation.oci-containers.containers."timetagger-timetagger" = {
image = "ghcr.io/almarklein/timetagger:v23.9.2-nonroot";
environment = {
TIMETAGGER_BIND = "0.0.0.0:8030";
TIMETAGGER_CREDENTIALS = "atarbinian:$2a$08$dnvtuebZQcSW078bwhJ8luOJO2YxXKZRzt4Jy6XVZfirey.c9wgom";
TIMETAGGER_DATADIR = "/opt/_timetagger";
TIMETAGGER_LOG_LEVEL = "info";
};
volumes = [
"/data/timetagger/:/opt/_timetagger:rw"
];
ports = [
"8030:8030/tcp"
];
log-driver = "journald";
extraOptions = [
"--network-alias=timetagger"
"--network=timetagger_default"
];
};
systemd.services."docker-timetagger-timetagger" = {
serviceConfig = {
Restart = lib.mkOverride 500 "no";
};
after = [
"docker-network-timetagger_default.service"
];
requires = [
"docker-network-timetagger_default.service"
];
partOf = [
"docker-compose-timetagger-root.target"
];
wantedBy = [
"docker-compose-timetagger-root.target"
];
};
# Networks
systemd.services."docker-network-timetagger_default" = {
path = [ pkgs.docker ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStop = "docker network rm -f timetagger_default";
};
script = ''
docker network inspect timetagger_default || docker network create timetagger_default
'';
partOf = [ "docker-compose-timetagger-root.target" ];
wantedBy = [ "docker-compose-timetagger-root.target" ];
};
# Root service
# When started, this will automatically create all resources and start
# the containers. When stopped, this will teardown all resources.
systemd.targets."docker-compose-timetagger-root" = {
unitConfig = {
Description = "Root target generated by compose2nix.";
};
wantedBy = [ "multi-user.target" ];
};
}