at 23.11-pre 1.9 kB view raw
1{ config, lib, pkgs, ... }: 2 3let 4 cfg = config.services.inspircd; 5 6 configFile = pkgs.writeText "inspircd.conf" cfg.config; 7 8in { 9 meta = { 10 maintainers = [ lib.maintainers.sternenseemann ]; 11 }; 12 13 options = { 14 services.inspircd = { 15 enable = lib.mkEnableOption (lib.mdDoc "InspIRCd"); 16 17 package = lib.mkOption { 18 type = lib.types.package; 19 default = pkgs.inspircd; 20 defaultText = lib.literalExpression "pkgs.inspircd"; 21 example = lib.literalExpression "pkgs.inspircdMinimal"; 22 description = lib.mdDoc '' 23 The InspIRCd package to use. This is mainly useful 24 to specify an overridden version of the 25 `pkgs.inspircd` dervivation, for 26 example if you want to use a more minimal InspIRCd 27 distribution with less modules enabled or with 28 modules enabled which can't be distributed in binary 29 form due to licensing issues. 30 ''; 31 }; 32 33 config = lib.mkOption { 34 type = lib.types.lines; 35 description = lib.mdDoc '' 36 Verbatim `inspircd.conf` file. 37 For a list of options, consult the 38 [InspIRCd documentation](https://docs.inspircd.org/3/configuration/), the 39 [Module documentation](https://docs.inspircd.org/3/modules/) 40 and the example configuration files distributed 41 with `pkgs.inspircd.doc` 42 ''; 43 }; 44 }; 45 }; 46 47 config = lib.mkIf cfg.enable { 48 systemd.services.inspircd = { 49 description = "InspIRCd - the stable, high-performance and modular Internet Relay Chat Daemon"; 50 wantedBy = [ "multi-user.target" ]; 51 requires = [ "network.target" ]; 52 53 serviceConfig = { 54 Type = "simple"; 55 ExecStart = '' 56 ${lib.getBin cfg.package}/bin/inspircd start --config ${configFile} --nofork --nopid 57 ''; 58 DynamicUser = true; 59 }; 60 }; 61 }; 62}