This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / modules / reaktor2.nix
3.3 kB 110 lines
1# Copied from stockholm krebs/3modules/reaktor2.nix (cc283503); the daemon is 2# pkgs/reaktor2, stockholm's packages output does not include it. 3{ 4 config, 5 pkgs, 6 self, 7 ... 8}: 9with self.inputs.stockholm.lib; 10{ 11 12 options.krebs.reaktor2 = mkOption { 13 default = { }; 14 type = types.attrsOf ( 15 types.submodule ( 16 self: 17 let 18 name = self.config._module.args.name; 19 in 20 { 21 options = { 22 nick = mkOption { 23 default = name; 24 # TODO types.irc.nickname 25 type = types.str; 26 }; 27 hostname = mkOption { 28 default = "irc.r"; 29 type = types.hostname; 30 }; 31 port = mkOption { 32 default = "6667"; 33 type = types.str; 34 }; 35 plugins = mkOption { 36 default = [ ]; 37 type = types.listOf types.attrs; 38 }; 39 stateDir = mkOption { 40 default = "/var/lib/${self.config.username}"; 41 defaultText = "/var/lib/‹username›"; 42 readOnly = true; 43 type = types.absolute-pathname; 44 }; 45 systemd-service-name = mkOption { 46 default = "reaktor2${optionalString (name != "default") "-${name}"}"; 47 defaultText = "reaktor2-‹name› or just reaktor2 if ‹name› is \"default\""; 48 type = types.filename; 49 }; 50 sendDelaySec = mkOption { 51 default = 0.7; 52 type = types.nullOr types.float; 53 }; 54 username = mkOption { 55 default = self.config.systemd-service-name; 56 defaultText = "‹systemd-service-name›"; 57 type = types.username; 58 }; 59 useTLS = mkOption { 60 default = self.config.port == "6697"; 61 type = types.bool; 62 }; 63 API.listen = mkOption { 64 default = null; 65 type = types.nullOr types.str; 66 }; 67 }; 68 } 69 ) 70 ); 71 }; 72 73 config = { 74 systemd.services = flip mapAttrs' config.krebs.reaktor2 ( 75 _: cfg: 76 nameValuePair cfg.systemd-service-name { 77 after = [ "network.target" ]; 78 environment = { 79 LC_ALL = "en_US.UTF-8"; 80 }; 81 wantedBy = [ "multi-user.target" ]; 82 serviceConfig = { 83 User = cfg.username; 84 Group = "reaktor2"; 85 DynamicUser = true; 86 StateDirectory = cfg.username; 87 #ExecStartPre = [ 88 # (pkgs.writers.writeDash "test-dynamic-user" '' 89 # set -efux 90 # ${pkgs.coreutils}/bin/id 91 # '') 92 #]; 93 ExecStart = 94 let 95 configFile = pkgs.writers.writeJSON configFileName configValue; 96 configFileName = "${cfg.systemd-service-name}.config.json"; 97 configValue = stripAttr ( 98 recursiveUpdate { 99 logTime = false; 100 } (removeAttrs cfg [ "_module" ]) 101 ); 102 in 103 "${self.packages.${pkgs.stdenv.hostPlatform.system}.reaktor2}/bin/reaktor ${configFile}"; 104 Restart = "always"; 105 RestartSec = "30"; 106 }; 107 } 108 ); 109 }; 110}