mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 01:43:15 +00:00
Supybot/limnoria: add service module
This commit is contained in:
parent
96be2d5a7d
commit
90554a03c7
@ -76,6 +76,7 @@ in
|
||||
nslcd = 58;
|
||||
nginx = 60;
|
||||
chrony = 61;
|
||||
supybot = 62;
|
||||
|
||||
# When adding a uid, make sure it doesn't match an existing gid.
|
||||
|
||||
|
@ -169,6 +169,7 @@
|
||||
./services/networking/rdnssd.nix
|
||||
./services/networking/rpcbind.nix
|
||||
./services/networking/sabnzbd.nix
|
||||
./services/networking/supybot.nix
|
||||
./services/networking/ssh/lshd.nix
|
||||
./services/networking/ssh/sshd.nix
|
||||
./services/networking/tftpd.nix
|
||||
|
97
modules/services/networking/supybot.nix
Normal file
97
modules/services/networking/supybot.nix
Normal file
@ -0,0 +1,97 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.supybot;
|
||||
configFile = pkgs.writeText "supybot.cfg" cfg.config;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
services.supybot = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "Enable the supybot IRC bot";
|
||||
};
|
||||
|
||||
homeDir = mkOption {
|
||||
default = "/home/supybot";
|
||||
description = "
|
||||
Directory holding all state for nginx to run.
|
||||
";
|
||||
};
|
||||
|
||||
config = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Verbatim contents of the supybot config, this can be
|
||||
generated by supybot-wizard
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
default = "supybot";
|
||||
description = "User account under which supybot runs.";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
default = "supybot";
|
||||
description = "Group account under which supybot runs.";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = [ pkgs.pythonPackages.limnoria ];
|
||||
|
||||
users.extraUsers = singleton
|
||||
{ name = cfg.user;
|
||||
uid = config.ids.uids.supybot;
|
||||
group = "supybot";
|
||||
description = "Supybot IRC bot user";
|
||||
home = cfg.homeDir;
|
||||
createHome = true;
|
||||
};
|
||||
|
||||
users.extraGroups.supybot = {};
|
||||
|
||||
systemd.services.supybot =
|
||||
{ description = "Supybot IRC bot";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
path = [ pkgs.pythonPackages.limnoria ];
|
||||
preStart = ''
|
||||
cd ${cfg.homeDir}
|
||||
mkdir -p logs/plugins backup conf data plugins tmp
|
||||
'';
|
||||
serviceConfig =
|
||||
{ ExecStart =
|
||||
"${pkgs.pythonPackages.limnoria}/bin/supybot ${cfg.homeDir}/supybot.cfg";
|
||||
PIDFile = "/run/supybot.pid";
|
||||
User = "${cfg.user}";
|
||||
Group = "${cfg.group}";
|
||||
UMask = "0007";
|
||||
Restart = "on-abort";
|
||||
StartLimitInterval = "5m";
|
||||
StartLimitBurst = "1";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user