ma uhub: move to new configuration, add more groups to users

This commit is contained in:
makefu 2021-12-05 14:04:25 +01:00
parent 3045a2c57b
commit 74ac65471e
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225
3 changed files with 28 additions and 71 deletions

View File

@ -39,7 +39,9 @@ in {
home = stateDir;
isSystemUser = true;
createHome = true;
group = ddclientUser;
};
users.groups.${ddclientUser} = {};
systemd.services = {
ddclient-nsupdate-uhub = {
@ -86,29 +88,30 @@ in {
users.groups.uhub = {};
services.uhub.home = {
enable = true;
port = 1511;
enableTLS = true;
hubConfig = ''
hub_name = "krebshub"
tls_certificate = ${uhubDir}/uhub.crt
tls_private_key = ${uhubDir}/uhub.key
registered_users_only = true
'';
plugins = {
welcome = {
enable = true;
motd = "shareit";
rules = "1. Don't be an asshole";
};
history = {
enable = true;
};
authSqlite = {
enable = true;
file = "${uhubDir}/uhub.sql";
};
settings = {
server_port = 1511;
hub_name = "krebshub";
tls_certificate = "${uhubDir}/uhub.crt";
tls_private_key = "${uhubDir}/uhub.key";
registered_users_only = true;
};
plugins = [
{
plugin = "${pkgs.uhub}/plugins/mod_auth_sqlite.so";
settings.file = "${uhubDir}/uhub.sql";
}
{
plugin = "${pkgs.uhub}/plugins/mod_welcome.so";
settings.motd = "shareit";
settings.rules = "1. Don't be an asshole";
}
{
plugin = "${pkgs.uhub}/plugins/mod_history.so";
settings.motd = "shareit";
settings.rules = "1. Don't be an asshole";
}
];
};
networking.firewall.allowedTCPPorts = [ 411 1511 ];
}

View File

@ -28,14 +28,16 @@ let
'';
in {
users.extraUsers = singleton {
users.users.${ddclientUser} = {
name = ddclientUser;
uid = genid "ddclient";
uid = genid ddclientUser;
description = "ddclient daemon user";
home = stateDir;
createHome = true;
isSystemUser = true;
group = ddclientUser;
};
users.groups.${ddclientUser} = {};
systemd.services = {
ddclient-nsupdate-elchos = {

View File

@ -1,48 +0,0 @@
{ stdenv, lib, fetchpatch, fetchFromGitHub, cmake, openssl, sqlite, pkgconfig, systemd
, tlsSupport ? false }:
assert tlsSupport -> openssl != null;
stdenv.mkDerivation rec {
pname = "uhub";
version = "2019-06-18";
src = fetchFromGitHub {
owner = "janvidar";
repo = "uhub";
rev = "78a703924064a92cedeb0a5aab5a80d8f77db73e";
sha256 = "1dqmj08salhbcdlkglbi03hn9jzgmhjqlb0iysafpzrrwi0mca1z";
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ cmake sqlite systemd ] ++ lib.optional tlsSupport openssl;
outputs = [ "out"
"mod_example"
"mod_welcome"
"mod_logging"
"mod_auth_simple"
"mod_auth_sqlite"
"mod_chat_history"
"mod_chat_only"
"mod_topic"
"mod_no_guest_downloads"
];
patches = [
<nixpkgs/pkgs/servers/uhub/plugin-dir.patch>
];
cmakeFlags = ''
-DSYSTEMD_SUPPORT=ON
${if tlsSupport then "-DSSL_SUPPORT=ON" else "-DSSL_SUPPORT=OFF"}
'';
meta = with lib; {
description = "High performance peer-to-peer hub for the ADC network";
homepage = https://www.uhub.org/;
license = licenses.gpl3;
maintainers = [ maintainers.ehmry ];
platforms = platforms.unix;
};
}