📦 ipfs: adding my own gateway

This commit is contained in:
James Walker 2021-10-30 23:33:26 -04:00
parent f744273d7c
commit 004d0f038e
Signed by: walkah
GPG Key ID: 3C127179D6086E93
6 changed files with 78 additions and 17 deletions

View File

@ -5,7 +5,7 @@
./hardware-configuration.nix
./rpi-poe.nix
../../modules/ipfs
../../modules/ipfs/cluster.nix
];
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)

View File

@ -13,6 +13,7 @@ in {
../../modules/code-server/nginx.nix
../../modules/gitea/nginx.nix
../../modules/home-assistant/nginx.nix
../../modules/ipfs/gateway.nix
../../modules/matrix/nginx.nix
];
@ -24,6 +25,7 @@ in {
networking.hostName = "socrates";
networking.firewall.allowPing = true;
networking.firewall.allowedTCPPorts = [ 80 443 ];
networking.firewall.trustedInterfaces = [ "tailscale0" ];
security.sudo.wheelNeedsPassword = false;

21
modules/ipfs/cluster.nix Normal file
View File

@ -0,0 +1,21 @@
{ config, lib, pkgs, ... }:
{
imports = [ ./default.nix ];
services = {
ipfs = {
enable = true;
extraConfig = {
Swarm = {
AddrFilters = null;
ConnMgr = {
Type = "basic";
LowWater = 25;
HighWater = 50;
GracePeriod = "1m0s";
};
};
};
};
};
}

View File

@ -20,16 +20,6 @@
API = { HTTPHeaders = { Access-Control-Allow-Origin = [ "*" ]; }; };
Discovery = { MDNS = { Enabled = true; }; };
Routing = { Type = "dht"; };
Peering = { Peers = [ ]; };
Swarm = {
AddrFilters = null;
ConnMgr = {
Type = "basic";
LowWater = 25;
HighWater = 50;
GracePeriod = "1m0s";
};
};
};
};
};

48
modules/ipfs/gateway.nix Normal file
View File

@ -0,0 +1,48 @@
{ config, lib, pkgs, ... }:
let
peers = [
{
ID = "12D3KooWMQSgdfa4tUrDhkFx4zP3ZpgT1ryj9KH5RGUae62Vsc7y";
Addrs = [ "/ip4/100.95.167.126/tcp/4001" ];
}
{
ID = "12D3KooWMqSiDukubKNKrK7J4PaF3mfNnZFVAd3Lh7qj3Y3e5bcN";
Addrs = [ "/ip4/100.87.220.71/tcp/4001" ];
}
{
ID = "12D3KooWGmNRyqP969QbyP8NLVRZNK2i6yCcP6N6N2r2DCG4H34v";
Addrs = [ "/ip4/100.126.255.109/tcp/4001" ];
}
{
ID = "12D3KooWFkR8nsG5pzffoAfMzmwBcSakXxnogVa6inRxUbpfN5ua";
Addrs = [ "/ip4/100.74.59.80/tcp/4001" ];
}
];
in {
imports = [ ./default.nix ];
networking.firewall = {
allowedTCPPorts = [ 4001 ];
allowedUDPPorts = [ 4001 ];
};
services = {
ipfs = {
enable = true;
extraConfig = {
Peering = { Peers = peers; };
Swarm = { AddrFilters = null; };
};
};
nginx = {
virtualHosts."walkah.cloud" = {
forceSSL = true;
enableACME = true;
locations."/" = { proxyPass = "http://127.0.0.1:8080"; };
};
};
};
}

View File

@ -5,10 +5,10 @@
"homepage": "https://nix-community.github.io/home-manager/",
"owner": "nix-community",
"repo": "home-manager",
"rev": "cfe82d9f444a1b77f135070f1c1ee63fa061f2fd",
"sha256": "1cf9hjdsqrwgq57qybpx0gql7r14p6ih84f2p45k2zbvg4f4c2vz",
"rev": "71902bc913ccc36baa9ac18dd9b84117a34a36b0",
"sha256": "1vpb75fdy87hmcv2qw2gki6wd2f0hyqc754vgg0syxn4b1axy7mg",
"type": "tarball",
"url": "https://github.com/nix-community/home-manager/archive/cfe82d9f444a1b77f135070f1c1ee63fa061f2fd.tar.gz",
"url": "https://github.com/nix-community/home-manager/archive/71902bc913ccc36baa9ac18dd9b84117a34a36b0.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
@ -29,10 +29,10 @@
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6f0b0bb7028cf612298673bf6b5d453bcc7af965",
"sha256": "0d9b0qp9mv6dm32d3nj58drysi15g2z2xgcvgidzpp26kvv2hf3b",
"rev": "47b36ad103aeff17f9be6fb7b4847d63d53f227a",
"sha256": "109shladi2pj27mmna2g53m59m110pbczhnskrn3knbgpdmd78xz",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/6f0b0bb7028cf612298673bf6b5d453bcc7af965.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/47b36ad103aeff17f9be6fb7b4847d63d53f227a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}