mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
lambdabot: add nixos service
This commit is contained in:
parent
4947f918ad
commit
1d6723c085
@ -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
|
||||
|
72
nixos/modules/services/networking/lambdabot.nix
Normal file
72
nixos/modules/services/networking/lambdabot.nix
Normal file
@ -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…
Reference in New Issue
Block a user