Merge pull request #138051 from ehmry/tox-bootstrapd

This commit is contained in:
Sandro 2021-09-16 20:02:02 +02:00 committed by GitHub
commit 5795c33bdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 14 deletions

View File

@ -201,7 +201,7 @@ in
peerflix = 163; peerflix = 163;
#chronos = 164; # removed 2020-08-15 #chronos = 164; # removed 2020-08-15
gitlab = 165; gitlab = 165;
tox-bootstrapd = 166; # tox-bootstrapd = 166; removed 2021-09-15
cadvisor = 167; cadvisor = 167;
nylon = 168; nylon = 168;
#apache-kafka = 169;# dynamically allocated as of 2021-09-03 #apache-kafka = 169;# dynamically allocated as of 2021-09-03

View File

@ -3,15 +3,15 @@
with lib; with lib;
let let
home = "/var/lib/tox-bootstrapd"; WorkingDirectory = "/var/lib/tox-bootstrapd";
PIDFile = "${home}/pid"; PIDFile = "${WorkingDirectory}/pid";
pkg = pkgs.libtoxcore; pkg = pkgs.libtoxcore;
cfg = config.services.toxBootstrapd; cfg = config.services.toxBootstrapd;
cfgFile = builtins.toFile "tox-bootstrapd.conf" cfgFile = builtins.toFile "tox-bootstrapd.conf"
'' ''
port = ${toString cfg.port} port = ${toString cfg.port}
keys_file_path = "${home}/keys" keys_file_path = "${WorkingDirectory}/keys"
pid_file_path = "${PIDFile}" pid_file_path = "${PIDFile}"
${cfg.extraConfig} ${cfg.extraConfig}
''; '';
@ -36,7 +36,7 @@ in
keysFile = mkOption { keysFile = mkOption {
type = types.str; type = types.str;
default = "${home}/keys"; default = "${WorkingDirectory}/keys";
description = "Node key file."; description = "Node key file.";
}; };
@ -56,13 +56,6 @@ in
config = mkIf config.services.toxBootstrapd.enable { config = mkIf config.services.toxBootstrapd.enable {
users.users.tox-bootstrapd =
{ uid = config.ids.uids.tox-bootstrapd;
description = "Tox bootstrap daemon user";
inherit home;
createHome = true;
};
systemd.services.tox-bootstrapd = { systemd.services.tox-bootstrapd = {
description = "Tox DHT bootstrap daemon"; description = "Tox DHT bootstrap daemon";
after = [ "network.target" ]; after = [ "network.target" ];
@ -70,8 +63,10 @@ in
serviceConfig = serviceConfig =
{ ExecStart = "${pkg}/bin/tox-bootstrapd --config=${cfgFile}"; { ExecStart = "${pkg}/bin/tox-bootstrapd --config=${cfgFile}";
Type = "forking"; Type = "forking";
inherit PIDFile; inherit PIDFile WorkingDirectory;
User = "tox-bootstrapd"; AmbientCapabilities = ["CAP_NET_BIND_SERVICE"];
DynamicUser = true;
StateDirectory = "tox-bootstrapd";
}; };
}; };