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