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 = ''
|
2023-12-09 15:28:00 +01:00
|
|
|
location = /go-get/tvix/build-go {
|
|
|
|
alias ${pkgs.writeText "go-import-metadata.html" ''<html><meta name="go-import" content="code.tvl.fyi/tvix/build-go git https://code.tvl.fyi/depot.git:/tvix/build-go.git"></html>''};
|
|
|
|
}
|
|
|
|
|
2023-10-17 22:10:38 +02:00
|
|
|
location = /go-get/tvix/castore-go {
|
|
|
|
alias ${pkgs.writeText "go-import-metadata.html" ''<html><meta name="go-import" content="code.tvl.fyi/tvix/castore-go git https://code.tvl.fyi/depot.git:/tvix/castore-go.git"></html>''};
|
2023-09-21 21:32:44 +02:00
|
|
|
}
|
|
|
|
|
2023-10-17 22:30:29 +02:00
|
|
|
location = /go-get/tvix/store-go {
|
|
|
|
alias ${pkgs.writeText "go-import-metadata.html" ''<html><meta name="go-import" content="code.tvl.fyi/tvix/store-go git https://code.tvl.fyi/depot.git:/tvix/store-go.git"></html>''};
|
2023-09-10 12:40:13 +02:00
|
|
|
}
|
|
|
|
|
2023-10-09 13:31:21 +02:00
|
|
|
location = /go-get/tvix/nar-bridge {
|
|
|
|
alias ${pkgs.writeText "go-import-metadata.html" ''<html><meta name="go-import" content="code.tvl.fyi/tvix/nar-bridge git https://code.tvl.fyi/depot.git:/tvix/nar-bridge.git"></html>''};
|
|
|
|
}
|
|
|
|
|
2023-12-09 15:28:00 +01:00
|
|
|
location = /tvix/build-go {
|
2023-10-09 13:31:21 +02:00
|
|
|
if ($args ~* "/?go-get=1") {
|
2023-12-09 15:28:00 +01:00
|
|
|
return 302 /go-get/tvix/build-go;
|
2023-10-09 13:31:21 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-17 22:10:38 +02:00
|
|
|
location = /tvix/castore-go {
|
2023-09-22 15:11:53 +02:00
|
|
|
if ($args ~* "/?go-get=1") {
|
2023-10-17 22:10:38 +02:00
|
|
|
return 302 /go-get/tvix/castore-go;
|
2023-09-22 15:11:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-17 22:30:29 +02:00
|
|
|
location = /tvix/store-go {
|
2023-09-10 12:40:13 +02:00
|
|
|
if ($args ~* "/?go-get=1") {
|
2023-10-17 22:30:29 +02:00
|
|
|
return 302 /go-get/tvix/store-go;
|
2023-09-10 12:40:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-09 15:28:00 +01:00
|
|
|
location = /tvix/nar-bridge {
|
|
|
|
if ($args ~* "/?go-get=1") {
|
|
|
|
return 302 /go-get/tvix/nar-bridge;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-16 17:46:17 +02:00
|
|
|
# Git operations on depot.git hit josh
|
|
|
|
location /depot.git {
|
2023-10-09 16:21:57 +02:00
|
|
|
proxy_pass http://127.0.0.1:${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/;
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|