2021-03-23 19:22:30 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.inspircd;
|
|
|
|
|
|
|
|
configFile = pkgs.writeText "inspircd.conf" cfg.config;
|
|
|
|
|
|
|
|
in {
|
|
|
|
meta = {
|
|
|
|
maintainers = [ lib.maintainers.sternenseemann ];
|
|
|
|
};
|
|
|
|
|
|
|
|
options = {
|
|
|
|
services.inspircd = {
|
2022-09-09 14:08:57 +00:00
|
|
|
enable = lib.mkEnableOption (lib.mdDoc "InspIRCd");
|
2021-03-23 19:22:30 +00:00
|
|
|
|
|
|
|
package = lib.mkOption {
|
|
|
|
type = lib.types.package;
|
|
|
|
default = pkgs.inspircd;
|
2021-10-06 13:57:05 +00:00
|
|
|
defaultText = lib.literalExpression "pkgs.inspircd";
|
|
|
|
example = lib.literalExpression "pkgs.inspircdMinimal";
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2021-03-23 19:22:30 +00:00
|
|
|
The InspIRCd package to use. This is mainly useful
|
|
|
|
to specify an overridden version of the
|
2022-08-12 12:06:08 +00:00
|
|
|
`pkgs.inspircd` dervivation, for
|
2021-03-23 19:22:30 +00:00
|
|
|
example if you want to use a more minimal InspIRCd
|
|
|
|
distribution with less modules enabled or with
|
|
|
|
modules enabled which can't be distributed in binary
|
|
|
|
form due to licensing issues.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkOption {
|
|
|
|
type = lib.types.lines;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
Verbatim `inspircd.conf` file.
|
2021-03-23 19:22:30 +00:00
|
|
|
For a list of options, consult the
|
2022-08-12 12:06:08 +00:00
|
|
|
[InspIRCd documentation](https://docs.inspircd.org/3/configuration/), the
|
|
|
|
[Module documentation](https://docs.inspircd.org/3/modules/)
|
2021-03-23 19:22:30 +00:00
|
|
|
and the example configuration files distributed
|
2022-08-12 12:06:08 +00:00
|
|
|
with `pkgs.inspircd.doc`
|
2021-03-23 19:22:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
systemd.services.inspircd = {
|
|
|
|
description = "InspIRCd - the stable, high-performance and modular Internet Relay Chat Daemon";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
requires = [ "network.target" ];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
ExecStart = ''
|
|
|
|
${lib.getBin cfg.package}/bin/inspircd start --config ${configFile} --nofork --nopid
|
|
|
|
'';
|
|
|
|
DynamicUser = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|