Skip to content

Commit

Permalink
Add user, group, and extraServiceConfig to erigon module
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Warfield committed Apr 1, 2024
1 parent d8511b1 commit 2311874
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/erigon/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ in {
serviceConfig = mkMerge [
baseServiceConfig
{
User = serviceName;
StateDirectory = serviceName;
ExecStartPre =
mkIf (cfg.subVolume && cfg.args.datadir == null) (mkBefore [
Expand All @@ -126,9 +125,20 @@ in {
ReadWritePaths =
mkIf (cfg.args.datadir != null) cfg.args.datadir;
}
(mkIf (cfg.user == null) {
User = serviceName;
})
(mkIf (cfg.user != null) {
DynamicUser = false;
User = cfg.user;
})
(mkIf (cfg.group != null) {
Group = cfg.group;
})
(mkIf (cfg.args.authrpc.jwtsecret != null) {
LoadCredential = ["jwt-secret:${cfg.args.authrpc.jwtsecret}"];
})
cfg.extraServiceConfig
];
})
)
Expand Down
18 changes: 18 additions & 0 deletions modules/erigon/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@
default = false;
description = lib.mdDoc "Open ports in the firewall for any enabled networking services";
};

user = mkOption {
type = types.nullOr types.str;
default = null;
description = mdDoc "User to run the systemd service.";
};

group = mkOption {
type = types.nullOr types.str;
default = null;
description = mdDoc "Primary group for the systemd service.";
};

extraServiceConfig = mkOption {
type = types.attrsOf types.str;
default = {};
description = mdDoc "Extra settings for the systemd [Service] stanza.";
};
};
};
in {
Expand Down

0 comments on commit 2311874

Please sign in to comment.