Skip to content

Commit 8c8d9d9

Browse files
authored
Merge pull request zhaofengli#74 from lheckemann/nixos-module-mode
nixos: allow setting mode
2 parents 40b869b + 9f742b4 commit 8c8d9d9

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

nixos/atticd.nix

+19-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,24 @@ in
116116
defaultText = "generated from `services.atticd.settings`";
117117
};
118118

119+
mode = lib.mkOption {
120+
description = ''
121+
Mode in which to run the server.
122+
123+
'monolithic' runs all components, and is suitable for single-node deployments.
124+
125+
'api-server' runs only the API server, and is suitable for clustering.
126+
127+
'garbage-collector' only runs the garbage collector periodically.
128+
129+
A simple NixOS-based Attic deployment will typically have one 'monolithic' and any number of 'api-server' nodes.
130+
131+
There are several other supported modes that perform one-off operations, but these are the only ones that make sense to run via the NixOS module.
132+
'';
133+
type = lib.types.enum ["monolithic" "api-server" "garbage-collector"];
134+
default = "monolithic";
135+
};
136+
119137
# Internal flags
120138
useFlakeCompatOverlay = lib.mkOption {
121139
description = ''
@@ -168,7 +186,7 @@ in
168186
after = [ "network.target" ]
169187
++ lib.optionals hasLocalPostgresDB [ "postgresql.service" "nss-lookup.target" ];
170188
serviceConfig = {
171-
ExecStart = "${cfg.package}/bin/atticd -f ${checkedConfigFile}";
189+
ExecStart = "${cfg.package}/bin/atticd -f ${checkedConfigFile} --mode ${cfg.mode}";
172190
EnvironmentFile = cfg.credentialsFile;
173191
StateDirectory = "atticd"; # for usage with local storage and sqlite
174192
DynamicUser = true;

0 commit comments

Comments
 (0)