forked from nrabulinski/attic
nixos: allow setting mode
This commit is contained in:
parent
4902d57f5d
commit
9f742b497f
1 changed files with 19 additions and 1 deletions
|
@ -116,6 +116,24 @@ in
|
||||||
defaultText = "generated from `services.atticd.settings`";
|
defaultText = "generated from `services.atticd.settings`";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mode = lib.mkOption {
|
||||||
|
description = ''
|
||||||
|
Mode in which to run the server.
|
||||||
|
|
||||||
|
'monolithic' runs all components, and is suitable for single-node deployments.
|
||||||
|
|
||||||
|
'api-server' runs only the API server, and is suitable for clustering.
|
||||||
|
|
||||||
|
'garbage-collector' only runs the garbage collector periodically.
|
||||||
|
|
||||||
|
A simple NixOS-based Attic deployment will typically have one 'monolithic' and any number of 'api-server' nodes.
|
||||||
|
|
||||||
|
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.
|
||||||
|
'';
|
||||||
|
type = lib.types.enum ["monolithic" "api-server" "garbage-collector"];
|
||||||
|
default = "monolithic";
|
||||||
|
};
|
||||||
|
|
||||||
# Internal flags
|
# Internal flags
|
||||||
useFlakeCompatOverlay = lib.mkOption {
|
useFlakeCompatOverlay = lib.mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -168,7 +186,7 @@ in
|
||||||
after = [ "network.target" ]
|
after = [ "network.target" ]
|
||||||
++ lib.optionals hasLocalPostgresDB [ "postgresql.service" "nss-lookup.target" ];
|
++ lib.optionals hasLocalPostgresDB [ "postgresql.service" "nss-lookup.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${cfg.package}/bin/atticd -f ${checkedConfigFile}";
|
ExecStart = "${cfg.package}/bin/atticd -f ${checkedConfigFile} --mode ${cfg.mode}";
|
||||||
EnvironmentFile = cfg.credentialsFile;
|
EnvironmentFile = cfg.credentialsFile;
|
||||||
StateDirectory = "atticd"; # for usage with local storage and sqlite
|
StateDirectory = "atticd"; # for usage with local storage and sqlite
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
|
|
Loading…
Reference in a new issue