at 25.11-pre 1.8 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7let 8 cfg = config.services.irkerd; 9 ports = [ 6659 ]; 10in 11{ 12 options.services.irkerd = { 13 enable = lib.mkOption { 14 description = "Whether to enable irker, an IRC notification daemon."; 15 default = false; 16 type = lib.types.bool; 17 }; 18 19 openPorts = lib.mkOption { 20 description = "Open ports in the firewall for irkerd"; 21 default = false; 22 type = lib.types.bool; 23 }; 24 25 listenAddress = lib.mkOption { 26 default = "localhost"; 27 example = "0.0.0.0"; 28 type = lib.types.str; 29 description = '' 30 Specifies the bind address on which the irker daemon listens. 31 The default is localhost. 32 33 Irker authors strongly warn about the risks of running this on 34 a publicly accessible interface, so change this with caution. 35 ''; 36 }; 37 38 nick = lib.mkOption { 39 default = "irker"; 40 type = lib.types.str; 41 description = "Nick to use for irker"; 42 }; 43 }; 44 45 config = lib.mkIf cfg.enable { 46 systemd.services.irkerd = { 47 description = "Internet Relay Chat (IRC) notification daemon"; 48 documentation = [ 49 "man:irkerd(8)" 50 "man:irkerhook(1)" 51 "man:irk(1)" 52 ]; 53 after = [ "network.target" ]; 54 wantedBy = [ "multi-user.target" ]; 55 serviceConfig = { 56 ExecStart = "${pkgs.irker}/bin/irkerd -H ${cfg.listenAddress} -n ${cfg.nick}"; 57 User = "irkerd"; 58 }; 59 }; 60 61 environment.systemPackages = [ pkgs.irker ]; 62 63 users.users.irkerd = { 64 description = "Irker daemon user"; 65 isSystemUser = true; 66 group = "irkerd"; 67 }; 68 users.groups.irkerd = { }; 69 70 networking.firewall.allowedTCPPorts = lib.mkIf cfg.openPorts ports; 71 networking.firewall.allowedUDPPorts = lib.mkIf cfg.openPorts ports; 72 }; 73}