update nix-bitcoin and use network bridge for semita

This commit is contained in:
Sam 2024-10-05 16:42:16 +01:00
parent 25dfe2cf37
commit 2533603b65
2 changed files with 57 additions and 26 deletions

View File

@ -20,16 +20,15 @@ in {
networking.nat.enable = true; networking.nat.enable = true;
networking.nat.internalInterfaces = ["ve-+"]; networking.nat.internalInterfaces = ["ve-+"];
networking.nat.externalInterface = "eth0"; networking.nat.externalInterface = "br0";
networking.firewall.enable = true; # networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [80 443 22]; # networking.firewall.allowedTCPPorts = [80 443 22];
networking.firewall.trustedInterfaces = ["ve-+" "ve-bitcoin-node"]; # networking.firewall.trustedInterfaces = ["ve-btcnode"];
containers.bitcoin-node = { containers.bitcoin-node = {
autoStart = true; autoStart = true;
privateNetwork = true; privateNetwork = true;
hostAddress = "10.0.21.1"; hostBridge = "br0";
localAddress = "10.0.21.2";
nixpkgs = pkgs.path; nixpkgs = pkgs.path;
bindMounts = { bindMounts = {
"/etc/nix-bitcoin-secrets/bitcoin-rpcpassword-privileged" = { "/etc/nix-bitcoin-secrets/bitcoin-rpcpassword-privileged" = {
@ -48,19 +47,31 @@ in {
hostPath = "${bitcoin-HMAC-public}"; hostPath = "${bitcoin-HMAC-public}";
isReadOnly = false; isReadOnly = false;
}; };
"/var/lib/nix-bitcoin" = { "/var/lib/bitcoind" = {
hostPath = "/media/main-ssd/nix-bitcoin"; hostPath = "/media/main-ssd/nix-bitcoin/bitcoind";
isReadOnly = false;
};
"/var/lib/electrs" = {
hostPath = "/media/main-ssd/nix-bitcoin/electrs";
isReadOnly = false;
};
"/var/lib/mysql" = {
hostPath = "/media/main-ssd/nix-bitcoin/mysql";
isReadOnly = false;
};
"/var/lib/tor" = {
hostPath = "/media/main-ssd/nix-bitcoin/tor";
isReadOnly = false; isReadOnly = false;
}; };
}; };
forwardPorts = [ # forwardPorts = [
{ # {
containerPort = 80; # containerPort = 50001;
hostPort = 8080; # hostPort = 50001;
protocol = "tcp"; # protocol = "tcp";
} # }
]; # ];
config = { config = {
pkgs, pkgs,
@ -76,6 +87,8 @@ in {
jq jq
]; ];
networking = { networking = {
defaultGateway = "10.0.10.1";
interfaces.eth0.ipv4.addresses = [ { "address" = "10.0.10.4"; "prefixLength" = 24; } ];
firewall = { firewall = {
enable = true; enable = true;
allowedTCPPorts = [ allowedTCPPorts = [
@ -84,6 +97,7 @@ in {
22 22
config.containers.bitcoin-node.config.services.bitcoind.rpc.port config.containers.bitcoin-node.config.services.bitcoind.rpc.port
config.containers.bitcoin-node.config.services.mempool.frontend.port config.containers.bitcoin-node.config.services.mempool.frontend.port
config.containers.bitcoin-node.config.services.electrs.port
]; ];
}; };
useHostResolvConf = lib.mkForce false; useHostResolvConf = lib.mkForce false;
@ -112,7 +126,7 @@ in {
tor.proxy = true; tor.proxy = true;
tor.enforce = true; tor.enforce = true;
enable = true; enable = true;
dataDir = "/var/lib/nix-bitcoin/bitcoind"; dataDir = "/var/lib/bitcoind";
dbCache = 5000; dbCache = 5000;
txindex = true; txindex = true;
rpc = { rpc = {
@ -134,7 +148,8 @@ in {
electrs = { electrs = {
tor.enforce = true; tor.enforce = true;
enable = true; enable = true;
dataDir = "/var/lib/nix-bitcoin/electrs"; dataDir = "/var/lib/electrs";
address = "0.0.0.0";
}; };
mempool = { mempool = {
enable = true; enable = true;

View File

@ -47,6 +47,7 @@ in {
../common/optional/nfs-mounts/homeshare.nix ../common/optional/nfs-mounts/homeshare.nix
../common/optional/printing.nix ../common/optional/printing.nix
../common/optional/docker ../common/optional/docker
../common/optional/docker/postgres.nix
../common/optional/nix-bitcoin.nix ../common/optional/nix-bitcoin.nix
]; ];
@ -86,20 +87,35 @@ in {
networking = { networking = {
hostName = "semita"; hostName = "semita";
nameservers = ["10.0.10.60" "8.8.8.8"]; nameservers = ["10.0.10.60" "10.0.10.1" "8.8.8.8"];
interfaces.eth0 = { defaultGateway = "10.0.10.1";
useDHCP = false; useDHCP = false;
bridges = {
br0 = {
interfaces = ["eth0"];
};
};
interfaces.br0 = {
ipv4.addresses = [ ipv4.addresses = [
{ {
address = "10.0.10.3"; "address" = "10.0.10.3";
prefixLength = 24; "prefixLength" = 24;
} }
]; ];
}; };
defaultGateway = { # interfaces.br0 = {
address = "10.0.10.1"; # useDHCP = false;
interface = "eth0"; # ipv4.addresses = [
}; # {
# address = "10.0.10.3";
# prefixLength = 24;
# }
# ];
# };
# defaultGateway = {
# address = "10.0.10.1";
# interface = "eth0";
# };
}; };
services.libinput.enable = true; services.libinput.enable = true;