nixos/radicle: add httpd.aliases option

This commit is contained in:
Defelo
2025-08-30 19:52:59 +02:00
parent 5d8f4beac0
commit 8b4862c608

View File

@@ -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}" ];