2024-07-04 19:30:38 +03:00
|
|
|
{ cluster, config, depot, ... }:
|
2023-08-31 01:55:45 +03:00
|
|
|
with depot.lib.nginx;
|
2023-06-02 19:06:34 +03:00
|
|
|
let
|
2023-08-31 01:55:45 +03:00
|
|
|
inherit (depot.lib.meta) domain;
|
2023-06-02 19:06:34 +03:00
|
|
|
cfg = config.services.ipfs;
|
2024-07-04 19:30:38 +03:00
|
|
|
gw = cluster.config.hostLinks.${config.networking.hostName}.ipfsGateway;
|
2023-06-02 19:06:34 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
users.users.nginx.extraGroups = [ cfg.group ];
|
|
|
|
|
|
|
|
services.nginx.virtualHosts = {
|
|
|
|
"ipfs.admin.${domain}" = vhosts.basic // {
|
|
|
|
locations."/api".proxyPass = "http://unix:/run/ipfs/ipfs-api.sock:";
|
|
|
|
locations."/ipns/webui.ipfs.io".proxyPass = "${gw.url}/ipns/webui.ipfs.io";
|
|
|
|
locations."= /".return = "302 /ipns/webui.ipfs.io";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-06-04 15:38:50 +03:00
|
|
|
services.oauth2-proxy.nginx.virtualHosts."ipfs.admin.${domain}" = { };
|
2023-06-02 19:06:34 +03:00
|
|
|
}
|