add n0emis, some packages and pre-yate-n0emis
This commit is contained in:
7
modules/default.nix
Normal file
7
modules/default.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./yate
|
||||
];
|
||||
}
|
61
modules/yate/default.nix
Normal file
61
modules/yate/default.nix
Normal 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 = { };
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user