From ad0f2f28ec10f105aaead3e1b71ce91cfd171c47 Mon Sep 17 00:00:00 2001 From: Defelo Date: Sat, 30 Aug 2025 19:52:59 +0200 Subject: [PATCH] nixos/radicle: add httpd.aliases option (cherry picked from commit 8b4862c60819d60b48724814d1aea1003b65deda) --- nixos/modules/services/misc/radicle.nix | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/radicle.nix b/nixos/modules/services/misc/radicle.nix index b85d4f5aacb7..60fccc094236 100644 --- a/nixos/modules/services/misc/radicle.nix +++ b/nixos/modules/services/misc/radicle.nix @@ -227,6 +227,16 @@ in default = 8080; description = "The port on which `radicle-httpd` listens."; }; + aliases = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + description = "Alias and RID pairs to shorten git clone commands for repositories."; + default = { }; + example = lib.literalExpression '' + { + heartwood = "rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5"; + } + ''; + }; nginx = lib.mkOption { # Type of a single virtual host, or null. type = lib.types.nullOr ( @@ -342,7 +352,20 @@ in description = "Radicle HTTP gateway to radicle-node"; documentation = [ "man:radicle-httpd(1)" ]; serviceConfig = { - ExecStart = "${lib.getExe' cfg.httpd.package "radicle-httpd"} --listen ${cfg.httpd.listenAddress}:${toString cfg.httpd.listenPort} ${lib.escapeShellArgs cfg.httpd.extraArgs}"; + ExecStart = lib.escapeShellArgs ( + [ + (lib.getExe' cfg.httpd.package "radicle-httpd") + "--listen=${cfg.httpd.listenAddress}:${toString cfg.httpd.listenPort}" + ] + ++ lib.flatten ( + lib.mapAttrsToList (alias: rid: [ + "--alias" + alias + rid + ]) cfg.httpd.aliases + ) + ++ cfg.httpd.extraArgs + ); Restart = lib.mkDefault "on-failure"; RestartSec = "10"; SocketBindAllow = [ "tcp:${toString cfg.httpd.listenPort}" ];