64 lines
1.6 KiB
Nix
64 lines
1.6 KiB
Nix
self:
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
utils,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.services.cozybot;
|
|
in
|
|
{
|
|
meta.maintainers = with lib.maintainers; [ quadradical ];
|
|
options.services.cozybot = {
|
|
enable = lib.mkEnableOption "the cozybot server";
|
|
package = lib.mkPackageOption self.packages.${pkgs.system} "default" { };
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
systemd.services.cozybot = {
|
|
description = "cozybot server";
|
|
documentation = [ "https://git.federated.nexus/Henry-Hiles/cozybot" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
wants = [ "network-online.target" ];
|
|
after = [ "network-online.target" ];
|
|
|
|
serviceConfig = {
|
|
ExecStart = lib.getExe cfg.package;
|
|
DynamicUser = true;
|
|
LockPersonality = true;
|
|
MemoryDenyWriteExecute = true;
|
|
ProtectClock = true;
|
|
ProtectControlGroups = true;
|
|
ProtectHostname = true;
|
|
ProtectKernelLogs = true;
|
|
ProtectKernelModules = true;
|
|
ProtectKernelTunables = true;
|
|
PrivateDevices = true;
|
|
PrivateMounts = true;
|
|
RestrictAddressFamilies = [
|
|
"AF_UNIX"
|
|
"AF_INET"
|
|
"AF_INET6"
|
|
];
|
|
RestrictNamespaces = true;
|
|
RestrictRealtime = true;
|
|
ProtectHome = true;
|
|
SystemCallArchitectures = "native";
|
|
SystemCallFilter = [
|
|
"@system-service"
|
|
"~@privileged"
|
|
"~@resources"
|
|
];
|
|
Restart = "always";
|
|
RestartSec = 5;
|
|
UMask = 007;
|
|
|
|
RuntimeDirectory = "cozybot";
|
|
RuntimeDirectoryMode = 0770;
|
|
Group = "caddy";
|
|
};
|
|
};
|
|
};
|
|
}
|