lambdabot: add nixos service

wip/yesman
Nikolay Amiantov 9 years ago
parent 4947f918ad
commit 1d6723c085
  1. 2
      nixos/modules/misc/ids.nix
  2. 1
      nixos/modules/module-list.nix
  3. 72
      nixos/modules/services/networking/lambdabot.nix

@ -216,6 +216,7 @@
rdnssd = 188;
ihaskell = 189;
i2p = 190;
lambdabot = 191;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@ -409,6 +410,7 @@
#rdnssd = 188; # unused
ihaskell = 189;
i2p = 190;
lambdabot = 191;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal

@ -273,6 +273,7 @@
./services/networking/iodined.nix
./services/networking/ircd-hybrid/default.nix
./services/networking/kippo.nix
./services/networking/lambdabot.nix
./services/networking/mailpile.nix
./services/networking/minidlna.nix
./services/networking/mstpd.nix

@ -0,0 +1,72 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.lambdabot;
rc = builtins.toFile "script.rc" cfg.script;
in
{
### configuration
options = {
services.lambdabot = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable the Lambdabot IRC bot";
};
package = mkOption {
type = types.package;
default = pkgs.lambdabot;
description = "Used lambdabot package";
};
script = mkOption {
type = types.str;
default = "";
description = "Lambdabot script";
};
};
};
### implementation
config = mkIf cfg.enable {
systemd.services.lambdabot = {
description = "Lambdabot daemon";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
# Workaround for https://github.com/lambdabot/lambdabot/issues/117
script = ''
mkdir -p ~/.lambdabot
cd ~/.lambdabot
exec ${cfg.package}/bin/lambdabot -e 'rc ${rc}'
'';
serviceConfig.User = "lambdabot";
};
users.extraUsers.lambdabot = {
group = "lambdabot";
description = "Lambdabot daemon user";
home = "/var/lib/lambdabot";
createHome = true;
uid = config.ids.uids.lambdabot;
};
users.extraGroups.lambdabot.gid = config.ids.gids.lambdabot;
};
}
Loading…
Cancel
Save