Skip to content

Commit

Permalink
Merge pull request #74 from lheckemann/nixos-module-mode
Browse files Browse the repository at this point in the history
nixos: allow setting mode
  • Loading branch information
zhaofengli authored Jan 2, 2024
2 parents 40b869b + 9f742b4 commit 8c8d9d9
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion nixos/atticd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,24 @@ in
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
useFlakeCompatOverlay = lib.mkOption {
description = ''
Expand Down Expand Up @@ -168,7 +186,7 @@ in
after = [ "network.target" ]
++ lib.optionals hasLocalPostgresDB [ "postgresql.service" "nss-lookup.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/atticd -f ${checkedConfigFile}";
ExecStart = "${cfg.package}/bin/atticd -f ${checkedConfigFile} --mode ${cfg.mode}";
EnvironmentFile = cfg.credentialsFile;
StateDirectory = "atticd"; # for usage with local storage and sqlite
DynamicUser = true;
Expand Down

0 comments on commit 8c8d9d9

Please sign in to comment.