mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-11 18:32:23 +08:00
nixos/radicle: add httpd.aliases option
This commit is contained in:
@@ -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}" ];
|
||||
|
||||
Reference in New Issue
Block a user