nix-infra/config/hosts/yate/service.nix
2024-08-05 20:58:09 +02:00

34 lines
1.1 KiB
Nix

{ config, pkgs, ... }:
{
systemd.services.yate = {
enable = true;
description = "Yate telehony engine";
unitConfig = {
Type = "simple";
After="network.target";
};
serviceConfig = {
ExecStart = "${pkgs.yate}/bin/yate -c /etc/yate -e /etc/yate/share -Do";
Type="simple";
Restart="always";
Group="yate-config";
StateDirectory = "yate";
StateDirectoryMode = "0775";
# ...
};
wantedBy = [ "default.target" ];
requiredBy = [ "network.target" ];
preStart = "if ! [ -d \"/var/lib/yate/.git\" ]
then
${pkgs.git}/bin/git init /var/lib/yate
${pkgs.git}/bin/git -C /var/lib/yate remote add origin forgejo@git.hamburg.ccc.de:echtnurich/yate-config.git
${pkgs.git}/bin/git -C /var/lib/yate pull -f --set-upstream
echo \"New repo set up.\"
fi
${pkgs.git}/bin/git -C /var/lib/yate fetch --all
${pkgs.git}/bin/git -C /var/lib/yate checkout --track -f origin/master";
# ...
};
}