about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2022-05-07 02:40:37 +0900
committerNguyễn Gia Phong <mcsinyx@disroot.org>2022-05-07 02:40:37 +0900
commit04713bb59f5ddf7daa94555d23a527b31864d71a (patch)
treebf1b6a43ad7111ab35b08daabd908bd78170a6f6
parent5df41fd81317983f53f91d5885e032bc0873b708 (diff)
downloadnixos-conf-04713bb59f5ddf7daa94555d23a527b31864d71a.tar.gz
Enable IPFS gateway
-rw-r--r--configuration.nix26
1 files changed, 20 insertions, 6 deletions
diff --git a/configuration.nix b/configuration.nix
index 0fa2b44..414af1a 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -52,20 +52,34 @@ in {
   };
 
   services = {
+    ipfs = {
+      enable = true;
+      enableGC = true;
+      extraConfig.GateWay = {
+        NoFetch = true;
+        PublicGateways.${domain} = {
+          Paths =  [ "/ipfs" "/ipns" ];
+          UseSubdomains = true;
+        };
+      };
+    };
+
     nginx = {
       enable = true;
+      recommendedProxySettings = true;
       virtualHosts.${domain} = {
         enableACME = true;
         forceSSL = true;
-        root = "/var/www/${domain}";
+        locations = let
+          ipfsGateway = "http://localhost:8080";
+        in {
+          "/ipfs".proxyPass = ipfsGateway;
+          "/ipns".proxyPass = ipfsGateway;
+        };
+        root = "/var/lib/www/${domain}";
       };
     };
 
-    ipfs = {
-      enable = true;
-      enableGC = true;
-    };
-
     openssh = {
       enable = true;
       passwordAuthentication = false;