2023-09-10 12:40:13 +02:00
|
|
|
{ depot, pkgs, config, ... }:
|
2020-07-12 15:02:50 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
./base.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
config = {
|
|
|
|
services.nginx.virtualHosts.cgit = {
|
|
|
|
serverName = "code.tvl.fyi";
|
2021-04-02 12:52:55 +02:00
|
|
|
serverAliases = [ "code.tvl.su" ];
|
2020-07-12 15:02:50 +02:00
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
|
|
|
|
extraConfig = ''
|
2021-04-01 00:49:21 +02:00
|
|
|
# Serve the rendered Tvix component SVG.
|
|
|
|
#
|
|
|
|
# TODO(tazjin): Implement a way of serving this dynamically
|
|
|
|
location = /about/tvix/docs/component-flow.svg {
|
2021-04-02 14:18:50 +02:00
|
|
|
alias ${depot.tvix.docs.svg}/component-flow.svg;
|
2021-04-01 00:49:21 +02:00
|
|
|
}
|
|
|
|
|
2023-09-21 21:32:44 +02:00
|
|
|
location = /go-get/tvix/castore/protos {
|
|
|
|
alias ${pkgs.writeText "go-import-metadata.html" ''<html><meta name="go-import" content="code.tvl.fyi/tvix/castore/protos git https://code.tvl.fyi/depot.git:/tvix/castore/protos.git"></html>''};
|
|
|
|
}
|
|
|
|
|
2023-09-10 12:40:13 +02:00
|
|
|
location = /go-get/tvix/store/protos {
|
|
|
|
alias ${pkgs.writeText "go-import-metadata.html" ''<html><meta name="go-import" content="code.tvl.fyi/tvix/store/protos git https://code.tvl.fyi/depot.git:/tvix/store/protos.git"></html>''};
|
|
|
|
}
|
|
|
|
|
2023-09-22 15:11:53 +02:00
|
|
|
location = /tvix/castore/protos {
|
|
|
|
if ($args ~* "/?go-get=1") {
|
|
|
|
return 302 /go-get/tvix/castore/protos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-10 12:40:13 +02:00
|
|
|
location = /tvix/store/protos {
|
|
|
|
if ($args ~* "/?go-get=1") {
|
|
|
|
return 302 /go-get/tvix/store/protos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-16 17:46:17 +02:00
|
|
|
# Git operations on depot.git hit josh
|
|
|
|
location /depot.git {
|
2022-02-16 19:34:18 +01:00
|
|
|
proxy_pass http://localhost:${toString config.services.depot.josh.port};
|
2021-09-16 17:46:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Git clone operations on '/' should be redirected to josh now.
|
|
|
|
location = /info/refs {
|
|
|
|
return 302 https://code.tvl.fyi/depot.git/info/refs$is_args$args;
|
|
|
|
}
|
|
|
|
|
2020-07-12 15:02:50 +02:00
|
|
|
# Static assets must always hit the root.
|
|
|
|
location ~ ^/(favicon\.ico|cgit\.(css|png))$ {
|
|
|
|
proxy_pass http://localhost:2448;
|
|
|
|
}
|
|
|
|
|
2021-09-16 17:46:17 +02:00
|
|
|
# Everything else is forwarded to cgit for the web view
|
2020-07-12 15:02:50 +02:00
|
|
|
location / {
|
|
|
|
proxy_pass http://localhost:2448/cgit.cgi/depot/;
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|