mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-02 13:33:10 +00:00
57 lines
1.6 KiB
Nix
57 lines
1.6 KiB
Nix
{ self, config, lib, pkgs, circomCompatPkg, ... }:
|
|
|
|
let
|
|
inherit (lib)
|
|
types mkEnableOption mkOption mkIf literalExpression
|
|
mdDoc;
|
|
|
|
toml = pkgs.formats.toml { };
|
|
|
|
cfg = config.services.logos-storage-nim;
|
|
in
|
|
{
|
|
options = {
|
|
services.logos-storage-nim = {
|
|
enable = mkEnableOption "Logos Storage Node service.";
|
|
|
|
package = mkOption {
|
|
type = types.package;
|
|
default = pkgs.callPackage ./default.nix { src = self; inherit circomCompatPkg; };
|
|
defaultText = literalExpression "pkgs.codex";
|
|
description = mdDoc "Package to use as Nim Logos Storage node.";
|
|
};
|
|
|
|
settings = mkOption {
|
|
default = { };
|
|
type = toml.type;
|
|
description = ''Structured settings object that will be used to generate a TOML config file.'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
environment.etc = {
|
|
"logos-storage-nim/config.toml".source = toml.generate "config.toml" cfg.settings;
|
|
};
|
|
systemd.services.logos-storage-nim = {
|
|
description = "Logos Storage Node";
|
|
wantedBy = [ "multi-user.target" ];
|
|
requires = [ "network.target" ];
|
|
serviceConfig = {
|
|
DynamicUser = true;
|
|
PrivateTmp = true;
|
|
ProtectHome = true;
|
|
ProtectSystem = "full";
|
|
NoNewPrivileges = true;
|
|
PrivateDevices = true;
|
|
MemoryDenyWriteExecute = true;
|
|
ExecStart = "${cfg.package}/bin/storage --config-file=/etc/logos-storage-nim/config.toml";
|
|
Restart = "on-failure";
|
|
};
|
|
restartIfChanged = true;
|
|
restartTriggers = [
|
|
"/etc/logos-storage-nim/config.toml"
|
|
];
|
|
};
|
|
};
|
|
} |