Compare commits

...

2 Commits

Author SHA1 Message Date
Sam 2533603b65 update nix-bitcoin and use network bridge for semita 2024-10-05 16:42:16 +01:00
Sam 25dfe2cf37 Update flake 2024-10-05 16:41:56 +01:00
3 changed files with 96 additions and 65 deletions

View File

@ -185,11 +185,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1722555600, "lastModified": 1727826117,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d", "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -230,11 +230,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1724857454, "lastModified": 1727854478,
"narHash": "sha256-Qyl9Q4QMTLZnnBb/8OuQ9LSkzWjBU1T5l5zIzTxkkhk=", "narHash": "sha256-/odH2nUMAwkMgOS2nG2z0exLQNJS4S2LfMW0teqU7co=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "git-hooks.nix",
"rev": "4509ca64f1084e73bc7a721b20c669a8d4c5ebe6", "rev": "5f58871c9657b5fc0a7f65670fe2ba99c26c1d79",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -310,11 +310,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1720042825, "lastModified": 1726989464,
"narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -332,11 +332,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1720042825, "lastModified": 1726989464,
"narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -348,11 +348,11 @@
}, },
"impermanence": { "impermanence": {
"locked": { "locked": {
"lastModified": 1724489415, "lastModified": 1727649413,
"narHash": "sha256-ey8vhwY/6XCKoh7fyTn3aIQs7WeYSYtLbYEG87VCzX4=", "narHash": "sha256-FA53of86DjFdeQzRDVtvgWF9o52rWK70VHGx0Y8fElQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "impermanence", "repo": "impermanence",
"rev": "c7f5b394397398c023000cf843986ee2571a1fd7", "rev": "d0b38e550039a72aff896ee65b0918e975e6d48e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -412,11 +412,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1724561770, "lastModified": 1727707210,
"narHash": "sha256-zv8C9RNa86CIpyHwPIVO/k+5TfM8ZbjGwOOpTe1grls=", "narHash": "sha256-8XZp5XO2FC6INZEZ2WlwErtvFVpl45ACn8CJ2hfTA0Y=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "ac5694a0b855a981e81b4d9f14052e3ff46ca39e", "rev": "f61d5f2051a387a15817007220e9fb3bbead57b3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -474,11 +474,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1721524707, "lastModified": 1725762081,
"narHash": "sha256-5NctRsoE54N86nWd0psae70YSLfrOek3Kv1e8KoXe/0=", "narHash": "sha256-vNv+aJUW5/YurRy1ocfvs4q/48yVESwlC/yHzjkZSP8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "556533a23879fc7e5f98dd2e0b31a6911a213171", "rev": "dc454045f5b5d814e5862a6d057e7bb5c29edc05",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -506,11 +506,11 @@
}, },
"nixpkgs-unstable_2": { "nixpkgs-unstable_2": {
"locked": { "locked": {
"lastModified": 1724819573, "lastModified": 1728018373,
"narHash": "sha256-GnR7/ibgIH1vhoy8cYdmXE6iyZqKqFxQSVkFgosBh6w=", "narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "71e91c409d1e654808b2621f28a327acfdad8dc2", "rev": "bc947f541ae55e999ffdb4013441347d83b00feb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -522,11 +522,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1724855419, "lastModified": 1728067476,
"narHash": "sha256-WXHSyOF4nBX0cvHN3DfmEMcLOVdKH6tnMk9FQ8wTNRc=", "narHash": "sha256-/uJcVXuBt+VFCPQIX+4YnYrHaubJSx4HoNsJVNRgANM=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ae2fc9e0e42caaf3f068c1bfdc11c71734125e06", "rev": "6e6b3dd395c3b1eb9be9f2d096383a8d05add030",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -550,11 +550,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1724910205, "lastModified": 1728083208,
"narHash": "sha256-eH2yPsTkaGp87rtxATx9d2dGBQUXH3kQPEOTKmaEb0s=", "narHash": "sha256-jaoWQm2+oAUDU1ft+RWrxcgc/4lHGE0AkZlIBiVjQiQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "d150ce320e4eda99d8865bbd4c74ee8c47a88097", "rev": "e246bd57da2a09b18b0667f7de40dc1c55a94667",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -566,11 +566,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1725083573, "lastModified": 1728121595,
"narHash": "sha256-F9WeDQi+U1+y6BDGvW8PYyi9LALbpo4DlpzfZONh5a0=", "narHash": "sha256-e9kRLdv2D4Lk6obeLEzm/m2TYcnZuMnVtqtQUKBCMVs=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "83ead973ba76b6ecf2d72dff9b60b56749e29518", "rev": "b638dbc3cd5ecae15140d2de7897dc9395cd128e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -603,11 +603,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1723501126, "lastModified": 1727734513,
"narHash": "sha256-N9IcHgj/p1+2Pvk8P4Zc1bfrMwld5PcosVA0nL6IGdE=", "narHash": "sha256-i47LQwoGCVQq4upV2YHV0OudkauHNuFsv306ualB/Sw=",
"owner": "mic92", "owner": "mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "be0eec2d27563590194a9206f551a6f73d52fa34", "rev": "3198a242e547939c5e659353551b0668ec150268",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -639,11 +639,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1724833132, "lastModified": 1727984844,
"narHash": "sha256-F4djBvyNRAXGusJiNYInqR6zIMI3rvlp6WiKwsRISos=", "narHash": "sha256-xpRqITAoD8rHlXQafYZOLvUXCF6cnZkPfoq67ThN0Hc=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "3ffd842a5f50f435d3e603312eefa4790db46af5", "rev": "4446c7a6fc0775df028c5a3f6727945ba8400e64",
"type": "github" "type": "github"
}, },
"original": { "original": {

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;