summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/dcpp
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2018-09-13 22:54:55 +0200
committermakefu <github@syntax-fehler.de>2018-09-13 22:54:55 +0200
commitbdf8d7a94d71e82a980392633f84842eb4084291 (patch)
treeea6f7e6e745edc29ab7d7995fa3f0d1c157bde8b /makefu/2configs/dcpp
parent6c5d362662713894091f2d97fdd9fa7aff03f70c (diff)
ma dcpp: add client
Diffstat (limited to 'makefu/2configs/dcpp')
-rw-r--r--makefu/2configs/dcpp/client.nix9
-rw-r--r--makefu/2configs/dcpp/hub.nix26
2 files changed, 27 insertions, 8 deletions
diff --git a/makefu/2configs/dcpp/client.nix b/makefu/2configs/dcpp/client.nix
new file mode 100644
index 000000000..3b27778e5
--- /dev/null
+++ b/makefu/2configs/dcpp/client.nix
@@ -0,0 +1,9 @@
+{ pkgs, ... }:
+{ # ncdc
+ environment.systemPackages = [ pkgs.ncdc ];
+ networking.firewall = {
+ allowedUDPPorts = [ 51411 ];
+ allowedTCPPorts = [ 51411 ];
+ };
+}
+
diff --git a/makefu/2configs/dcpp/hub.nix b/makefu/2configs/dcpp/hub.nix
index a121157d4..92977b4c8 100644
--- a/makefu/2configs/dcpp/hub.nix
+++ b/makefu/2configs/dcpp/hub.nix
@@ -30,6 +30,7 @@ let
'') dict)}
'';
+ uhubDir = "/var/lib/uhub";
in {
users.extraUsers = singleton {
@@ -65,22 +66,31 @@ in {
PrivateTmp = true;
PermissionsStartOnly = true;
ExecStartPre = pkgs.writeDash "uhub-pre" ''
- cp ${toString <secrets/wildcard.krebsco.de.crt>} /tmp/uhub.crt
- cp ${toString <secrets/wildcard.krebsco.de.key>} /tmp/uhub.key
- cp ${toString <secrets/uhub.sql>} /tmp/uhub.sql
- chown uhub /tmp/*
+ cp -f ${toString <secrets/wildcard.krebsco.de.crt>} ${uhubDir}/uhub.crt
+ cp -f ${toString <secrets/wildcard.krebsco.de.key>} ${uhubDir}/uhub.key
+ if test -d ${uhubDir};then
+ echo "Directory ${uhubDir} already exists, skipping db init"
+ else
+ echo "Copying sql user db"
+ cp ${toString <secrets/uhub.sql>} ${uhubDir}/uhub.sql
+ fi
+ chown -R uhub ${uhubDir}
'';
};
+ users.users.uhub = {
+ home = uhubDir;
+ createHome = true;
+ };
services.uhub = {
enable = true;
port = 1511;
enableTLS = true;
hubConfig = ''
hub_name = "krebshub"
- tls_certificate = /tmp/uhub.crt
- tls_private_key = /tmp/uhub.key
- registered_users_only = true
+ tls_certificate = ${uhubDir}/uhub.crt
+ tls_private_key = ${uhubDir}/uhub.key
+ registered_users_only = true
'';
plugins = {
welcome = {
@@ -93,7 +103,7 @@ in {
};
authSqlite = {
enable = true;
- file = "/tmp/uhub.sql";
+ file = "${uhubDir}/uhub.sql";
};
};