1
0

add n0emis, some packages and pre-yate-n0emis

This commit is contained in:
Ember 'n0emis' Keske
2022-07-07 19:46:59 +02:00
parent b9a581c63f
commit 97ebfe5ad2
21 changed files with 511 additions and 184 deletions

7
modules/default.nix Normal file
View File

@@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./yate
];
}

61
modules/yate/default.nix Normal file
View File

@@ -0,0 +1,61 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.yate;
in {
options = {
services.yate = {
enable = mkEnableOption "yate";
config = mkOption {
type = with types; attrsOf anything;
default = { };
};
};
};
config = let
mkCfgFile = name: config:
let
content =
if (isString config) then config else generators.toINI { } config;
in { "yate/${name}.conf".text = content; };
environmentFiles = mkMerge
(map (key: mkCfgFile key (getAttr key cfg.config))
(attrNames cfg.config));
in mkIf cfg.enable {
environment.etc = environmentFiles;
systemd.services.yate = {
description = "YATE Telephony Server";
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" "postgresql.service" ];
environment = { PWLIB_ASSERT_ACTION = "C"; };
serviceConfig = {
Type = "forking";
ExecStart =
"${pkgs.yate}/bin/yate -d -p /run/yate/yate.pid -c /etc/yate -F -s -q -DF -r -l /var/lib/yate/yate.log";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
User = "yate";
Group = "yate";
AmbientCapabilities = "CAP_NET_BIND_SERVICE";
RuntimeDirectory = "yate";
RuntimeDirectoryMode = "0755";
StateDirectory = "yate";
StateDirectoryMode = "0700";
PIDFile = "/run/yate/yate.pid";
TimeoutSec = 30;
};
reloadTriggers =
map (name: config.environment.etc."yate/${name}.conf".source)
(attrNames cfg.config);
};
users.users.yate = {
isSystemUser = true;
group = "yate";
};
users.groups.yate = { };
};
}