mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00
nixos/nostr-rs-relay: init (#365038)
* nixos/modules/services/web-apps: add nostr-rs-relay * add jb55 as maintainer * remove lib.mddoc * mkenable requires name
This commit is contained in:
parent
e83dcc5347
commit
b663e569c7
3 changed files with 99 additions and 0 deletions
|
@ -36,6 +36,8 @@
|
|||
|
||||
- [waagent](https://github.com/Azure/WALinuxAgent), the Microsoft Azure Linux Agent (waagent) manages Linux provisioning and VM interaction with the Azure Fabric Controller. Available with [services.waagent](options.html#opt-services.waagent.enable).
|
||||
|
||||
- [nostr-rs-relay](https://git.sr.ht/~gheartsfield/nostr-rs-relay/), This is a nostr relay, written in Rust. Available as [services.nostr-rs-relay](options.html#opt-services.nostr-rs-relay.enable).
|
||||
|
||||
- [mqtt-exporter](https://github.com/kpetremann/mqtt-exporter/), a Prometheus exporter for exposing messages from MQTT. Available as [services.prometheus.exporters.mqtt](#opt-services.prometheus.exporters.mqtt.enable).
|
||||
|
||||
- [Buffyboard](https://gitlab.postmarketos.org/postmarketOS/buffybox/-/tree/master/buffyboard), a framebuffer on-screen keyboard. Available as [services.buffyboard](option.html#opt-services.buffyboard).
|
||||
|
|
|
@ -1507,6 +1507,7 @@
|
|||
./services/web-apps/nexus.nix
|
||||
./services/web-apps/nifi.nix
|
||||
./services/web-apps/node-red.nix
|
||||
./services/web-apps/nostr-rs-relay.nix
|
||||
./services/web-apps/ocis.nix
|
||||
./services/web-apps/onlyoffice.nix
|
||||
./services/web-apps/openvscode-server.nix
|
||||
|
|
96
nixos/modules/services/web-apps/nostr-rs-relay.nix
Normal file
96
nixos/modules/services/web-apps/nostr-rs-relay.nix
Normal file
|
@ -0,0 +1,96 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.nostr-rs-relay;
|
||||
settingsFormat = pkgs.formats.toml { };
|
||||
configFile = settingsFormat.generate "config.toml" (
|
||||
cfg.settings
|
||||
// {
|
||||
database = {
|
||||
data_directory = config.services.nostr-rs-relay.dataDir;
|
||||
};
|
||||
network = {
|
||||
port = config.services.nostr-rs-relay.port;
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
options.services.nostr-rs-relay = {
|
||||
enable = lib.mkEnableOption "nostr-rs-relay";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nostr-rs-relay" { };
|
||||
|
||||
port = lib.mkOption {
|
||||
default = 12849;
|
||||
type = lib.types.port;
|
||||
description = "Listen on this port.";
|
||||
};
|
||||
|
||||
dataDir = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/lib/nostr-rs-relay";
|
||||
description = "Directory for SQLite files.";
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
inherit (settingsFormat) type;
|
||||
default = { };
|
||||
description = "See https://git.sr.ht/~gheartsfield/nostr-rs-relay/#configuration for documentation.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.nostr-rs-relay = {
|
||||
description = "nostr-rs-relay";
|
||||
wants = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${cfg.package}/bin/nostr-rs-relay --config ${configFile}";
|
||||
DynamicUser = true;
|
||||
Restart = "on-failure";
|
||||
Type = "simple";
|
||||
|
||||
ReadWritePaths = [ cfg.dataDir ];
|
||||
|
||||
RuntimeDirectory = "nostr-rs-relay";
|
||||
StateDirectory = "nostr-rs-relay";
|
||||
|
||||
PrivateTmp = true;
|
||||
PrivateUsers = true;
|
||||
PrivateDevices = true;
|
||||
ProtectSystem = "strict";
|
||||
ProtectHome = true;
|
||||
NoNewPrivileges = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectClock = true;
|
||||
ProtectProc = "invisible";
|
||||
ProcSubset = "pid";
|
||||
ProtectControlGroups = true;
|
||||
LockPersonality = true;
|
||||
RestrictSUIDSGID = true;
|
||||
RemoveIPC = true;
|
||||
RestrictRealtime = true;
|
||||
ProtectHostname = true;
|
||||
CapabilityBoundingSet = "";
|
||||
SystemCallFilter = [
|
||||
"@system-service"
|
||||
];
|
||||
SystemCallArchitectures = "native";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = with lib.maintainers; [
|
||||
felixzieger
|
||||
jb55
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue