bucur/modules/services/nostr-rs-relay.nix

45 lines
1.1 KiB
Nix
Raw Normal View History

{ pkgs, ... }:
let
config = pkgs.writeText "nostr-rs-relay-config.toml" ''
[info]
relay_url = "wss://relay.otherwhere.app/"
name = "Otherwhere Relay"
description = "Test Relay"
pubkey = "2fbfe895d5fa20740e5173e51cb5a64b5699d0cfb5981e856013a755ce4d7da2"
contact = "trl@posteo.net"
[database]
data_directory = "/var/lib/nostr-rs-relay"
[network]
address = "127.0.0.1"
port = 8880
[limits]
event_kind_allowlist = [0, 3, 5, 7, 20, 1111, 1059, 1984, 1985, 2003, 2004, 5392, 30000, 37515, 37518]
'';
in
{
users.users.nostr-rs-relay = {
isSystemUser = true;
group = "nostr-rs-relay";
home = "/var/lib/nostr-rs-relay";
};
users.groups.nostr-rs-relay = {};
systemd.services.nostr-rs-relay = {
description = "Nostr relay";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
User = "nostr-rs-relay";
Group = "nostr-rs-relay";
ExecStart = "${pkgs.nostr-rs-relay}/bin/nostr-rs-relay --config ${config}";
StateDirectory = "nostr-rs-relay";
Restart = "on-failure";
RestartSec = 5;
};
};
}