2021-09-16 17:46:17 +02:00
|
|
|
{ depot, 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
|
|
|
}
|
|
|
|
|
2021-09-16 17:46:17 +02:00
|
|
|
# Git operations on depot.git hit josh
|
|
|
|
location /depot.git {
|
|
|
|
proxy_pass http://localhost:${toString config.services.depot.git-serving.joshPort};
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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/;
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|