Merge pull request #258520 from Benjamin-L/soju-admin-socket

authored by Sandro and committed by GitHub b32f206f a1693337

+56 -2
+2
nixos/doc/manual/release-notes/rl-2405.section.md
··· 513 513 514 514 - The `krb5` module has been rewritten and moved to `security.krb5`, moving all options but `security.krb5.enable` and `security.krb5.package` into `security.krb5.settings`. 515 515 516 + - `services.soju` now has a wrapper for the `sojuctl` command, pointed at the service config file. It also has the new option `adminSocket.enable`, which creates a unix admin socket at `/run/soju/admin`. 517 + 516 518 - Gitea 1.21 upgrade has several breaking changes, including: 517 519 - Custom themes and other assets that were previously stored in `custom/public/*` now belong in `custom/public/assets/*` 518 520 - New instances of Gitea using MySQL now ignore the `[database].CHARSET` config option and always use the `utf8mb4` charset, existing instances should migrate via the `gitea doctor convert` CLI command.
+22 -2
nixos/modules/services/networking/soju.nix
··· 5 5 let 6 6 cfg = config.services.soju; 7 7 stateDir = "/var/lib/soju"; 8 - listenCfg = concatMapStringsSep "\n" (l: "listen ${l}") cfg.listen; 8 + runtimeDir = "/run/soju"; 9 + listen = cfg.listen 10 + ++ optional cfg.adminSocket.enable "unix+admin://${runtimeDir}/admin"; 11 + listenCfg = concatMapStringsSep "\n" (l: "listen ${l}") listen; 9 12 tlsCfg = optionalString (cfg.tlsCertificate != null) 10 13 "tls ${cfg.tlsCertificate} ${cfg.tlsCertificateKey}"; 11 14 logCfg = optionalString cfg.enableMessageLogging ··· 22 25 23 26 ${cfg.extraConfig} 24 27 ''; 28 + 29 + sojuctl = pkgs.writeShellScriptBin "sojuctl" '' 30 + exec ${cfg.package}/bin/sojuctl --config ${configFile} "$@" 31 + ''; 25 32 in 26 33 { 27 34 ###### interface 28 35 29 36 options.services.soju = { 30 37 enable = mkEnableOption (lib.mdDoc "soju"); 38 + 39 + package = mkPackageOption pkgs "soju" { }; 31 40 32 41 listen = mkOption { 33 42 type = types.listOf types.str; ··· 66 75 description = lib.mdDoc "Whether to enable message logging."; 67 76 }; 68 77 78 + adminSocket.enable = mkOption { 79 + type = types.bool; 80 + default = true; 81 + description = lib.mdDoc '' 82 + Listen for admin connections from sojuctl at /run/soju/admin. 83 + ''; 84 + }; 85 + 69 86 httpOrigins = mkOption { 70 87 type = types.listOf types.str; 71 88 default = []; ··· 107 124 } 108 125 ]; 109 126 127 + environment.systemPackages = [ sojuctl ]; 128 + 110 129 systemd.services.soju = { 111 130 description = "soju IRC bouncer"; 112 131 wantedBy = [ "multi-user.target" ]; ··· 115 134 serviceConfig = { 116 135 DynamicUser = true; 117 136 Restart = "always"; 118 - ExecStart = "${pkgs.soju}/bin/soju -config ${configFile}"; 137 + ExecStart = "${cfg.package}/bin/soju -config ${configFile}"; 119 138 StateDirectory = "soju"; 139 + RuntimeDirectory = "soju"; 120 140 }; 121 141 }; 122 142 };
+1
nixos/tests/all-tests.nix
··· 826 826 soapui = handleTest ./soapui.nix {}; 827 827 soft-serve = handleTest ./soft-serve.nix {}; 828 828 sogo = handleTest ./sogo.nix {}; 829 + soju = handleTest ./soju.nix {}; 829 830 solanum = handleTest ./solanum.nix {}; 830 831 sonarr = handleTest ./sonarr.nix {}; 831 832 sonic-server = handleTest ./sonic-server.nix {};
+31
nixos/tests/soju.nix
··· 1 + import ./make-test-python.nix ({ pkgs, lib, ... }: 2 + let 3 + certs = import ./common/acme/server/snakeoil-certs.nix; 4 + domain = certs.domain; 5 + 6 + user = "testuser"; 7 + pass = "hunter2"; 8 + in 9 + { 10 + name = "soju"; 11 + meta.maintainers = with lib.maintainers; [ Benjamin-L ]; 12 + 13 + nodes.machine = { ... }: { 14 + services.soju = { 15 + enable = true; 16 + adminSocket.enable = true; 17 + hostName = domain; 18 + tlsCertificate = certs.${domain}.cert; 19 + tlsCertificateKey = certs.${domain}.key; 20 + }; 21 + }; 22 + 23 + testScript = '' 24 + start_all() 25 + 26 + machine.wait_for_unit("soju") 27 + machine.wait_for_file("/run/soju/admin") 28 + 29 + machine.succeed("sojuctl user create -username ${user} -password ${pass}") 30 + ''; 31 + })