modules/rnsd: init
- add md2mu (non-working) - enable rnsd on h
This commit is contained in:
parent
9ea9eae3b6
commit
0b32761492
@ -324,6 +324,9 @@
|
||||
kobuddy = upkgs.python3Packages.callPackage ./pkgs/kobuddy.nix {
|
||||
inherit upkgs;
|
||||
};
|
||||
md2mu = upkgs.python3Packages.callPackage ./pkgs/md2mu.nix {
|
||||
inherit upkgs;
|
||||
};
|
||||
bandcamp-downloader = upkgs.python3Packages.callPackage ./pkgs/bandcamp-downloader.nix {
|
||||
inherit upkgs;
|
||||
};
|
||||
|
@ -180,6 +180,45 @@ in
|
||||
services.xinCA = { enable = false; };
|
||||
|
||||
services = {
|
||||
rnsd = {
|
||||
enable = false;
|
||||
settings = {
|
||||
reticulum = {
|
||||
enable_transport = true;
|
||||
};
|
||||
logging = {
|
||||
loglevel = 4;
|
||||
};
|
||||
interfaces = {
|
||||
"Default Interface" = {
|
||||
type = "AutoInterface";
|
||||
enabled = true;
|
||||
};
|
||||
"UDP Interface" = {
|
||||
type = "UDPInterface";
|
||||
enabled = true;
|
||||
listen_ip = "0.0.0.0";
|
||||
listen_port = 4242;
|
||||
forward_ip = "255.255.255.255";
|
||||
forward_port = 4242;
|
||||
};
|
||||
"TCP Interface" = {
|
||||
type = "TCPServerInterface";
|
||||
enabled = true;
|
||||
listen_ip = "0.0.0.0";
|
||||
listen_port = 4242;
|
||||
forward_ip = "255.255.255.255";
|
||||
forward_port = 4242;
|
||||
};
|
||||
"RNS Testnet BetweenTheBorders" = {
|
||||
type = "TCPClientInterface";
|
||||
enabled = true;
|
||||
target_host = "betweentheborders.com";
|
||||
target_port = 4242;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
power-profiles-daemon.enable = false;
|
||||
tlp = {
|
||||
enable = true;
|
||||
|
@ -306,6 +306,45 @@ in
|
||||
};
|
||||
|
||||
services = {
|
||||
rnsd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
reticulum = {
|
||||
enable_transport = true;
|
||||
};
|
||||
logging = {
|
||||
loglevel = 4;
|
||||
};
|
||||
interfaces = {
|
||||
"Default Interface" = {
|
||||
type = "AutoInterface";
|
||||
enabled = true;
|
||||
};
|
||||
"UDP Interface" = {
|
||||
type = "UDPInterface";
|
||||
enabled = true;
|
||||
listen_ip = "0.0.0.0";
|
||||
listen_port = 4242;
|
||||
forward_ip = "255.255.255.255";
|
||||
forward_port = 4242;
|
||||
};
|
||||
"TCP Interface" = {
|
||||
type = "TCPServerInterface";
|
||||
enabled = true;
|
||||
listen_ip = "0.0.0.0";
|
||||
listen_port = 4242;
|
||||
forward_ip = "255.255.255.255";
|
||||
forward_port = 4242;
|
||||
};
|
||||
"RNS Testnet BetweenTheBorders" = {
|
||||
type = "TCPClientInterface";
|
||||
enabled = true;
|
||||
target_host = "betweentheborders.com";
|
||||
target_port = 4242;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
wallabag = {
|
||||
enable = false;
|
||||
secretPath = config.sops.secrets.wallabag_secret.path;
|
||||
|
@ -2,6 +2,7 @@
|
||||
imports = [
|
||||
./golink.nix
|
||||
./gotosocial.nix
|
||||
./rnsd.nix
|
||||
./rtlamr2mqtt.nix
|
||||
./sliding-sync.nix
|
||||
./ssh-fido-agent.nix
|
||||
|
96
modules/rnsd.nix
Normal file
96
modules/rnsd.nix
Normal file
@ -0,0 +1,96 @@
|
||||
{ lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.rnsd;
|
||||
defaultSettings = { };
|
||||
settingsFormat = pkgs.formats.toml { };
|
||||
settingsFile = settingsFormat.generate "config.toml" cfg.settings;
|
||||
in
|
||||
{
|
||||
options = with lib; {
|
||||
services.rnsd = {
|
||||
enable = lib.mkEnableOption "Enable rnsd";
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/rnsd";
|
||||
description = "Path rnsd home directory";
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = with types; oneOf [ str int ];
|
||||
default = "rnsd";
|
||||
description = ''
|
||||
The user the service will use.
|
||||
'';
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = with types; oneOf [ str int ];
|
||||
default = "rnsd";
|
||||
description = ''
|
||||
The group the service will use.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.python3Packages.rns;
|
||||
defaultText = literalExpression "pkgs.python3Packages.rns";
|
||||
description = "The package to use for rnsd";
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = settingsFormat.type;
|
||||
default = defaultSettings;
|
||||
description = lib.mdDoc ''
|
||||
run `rnsd --exampleconfig` to see an example.
|
||||
'';
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "enable veilid-server in the firewall";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [ 4242 ];
|
||||
allowedUDPPorts = [ 4242 ];
|
||||
};
|
||||
|
||||
users.groups.${cfg.group} = { };
|
||||
users.users.${cfg.user} = {
|
||||
description = "rnsd service user";
|
||||
isSystemUser = true;
|
||||
home = "${cfg.dataDir}";
|
||||
createHome = true;
|
||||
group = "${cfg.group}";
|
||||
};
|
||||
systemd.services.rnsd = {
|
||||
enable = true;
|
||||
description = "rnsd server";
|
||||
wantedBy = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
#DynamicUser = true;
|
||||
#User = "rnsd";
|
||||
#Group = "rnsd";
|
||||
#StateDirectory = "rnsd";
|
||||
#CacheDirectory = "rnsd";
|
||||
#LogsDirectory = "rnsd";
|
||||
#ProtectHome = true;
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/ln -sf ${settingsFile} ${cfg.dataDir}/config";
|
||||
ExecStart = "${cfg.package}/bin/rnsd -v --config ${cfg.dataDir}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
36
pkgs/md2mu.nix
Normal file
36
pkgs/md2mu.nix
Normal file
@ -0,0 +1,36 @@
|
||||
{ lib
|
||||
, fetchFromGitHub
|
||||
, buildPythonPackage
|
||||
#, fetchPypi
|
||||
#, setuptools-scm
|
||||
, mistune
|
||||
#, alembic
|
||||
#, banal
|
||||
#, sqlalchemy
|
||||
, ...
|
||||
}:
|
||||
buildPythonPackage rec {
|
||||
pname = "md2mu";
|
||||
version = "unstable-2023-05-16";
|
||||
format = "setuptools";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "randogoth";
|
||||
repo = pname;
|
||||
rev = "baf662b97fde0b2456fb3da725f1caf14882d60e";
|
||||
hash = "sha256-93fr1EV4UfRPq1MQSffoHtLvTYFQeaqHQ+BtsTlH8Ec=";
|
||||
};
|
||||
|
||||
doCheck = true;
|
||||
|
||||
#nativeBuildInputs = [ setuptools-scm ];
|
||||
|
||||
propagatedBuildInputs = [ mistune ];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/randogoth/md2mu";
|
||||
description = "Markdown to micron converter";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ qbit ];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user