diff --git a/flake.lock b/flake.lock index 73a9f94..530dbe1 100644 --- a/flake.lock +++ b/flake.lock @@ -202,6 +202,24 @@ "inputs": { "systems": "systems" }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" + }, "locked": { "lastModified": 1726560853, "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", @@ -361,10 +379,29 @@ "type": "github" } }, + "lnbits": { + "inputs": { + "nixpkgs": "nixpkgs_2", + "poetry2nix": "poetry2nix" + }, + "locked": { + "lastModified": 1734684489, + "narHash": "sha256-df2CZXIEE8rQPyKNI7dzXzDGxTPERla8hvEiACyObgA=", + "owner": "lnbits", + "repo": "lnbits", + "rev": "3900d2871d2e8ec5a00028eb4e2e59417c4fb08e", + "type": "github" + }, + "original": { + "owner": "lnbits", + "repo": "lnbits", + "type": "github" + } + }, "nix-bitcoin": { "inputs": { "extra-container": "extra-container", - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs" ], @@ -425,6 +462,28 @@ "type": "github" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "lnbits", + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703863825, + "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, "nix-secrets": { "locked": { "lastModified": 1732636943, @@ -520,6 +579,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1723938990, + "narHash": "sha256-9tUadhnZQbWIiYVXH8ncfGXGvkNq3Hag4RCBEMUk7MI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c42fcfbdfeae23e68fc520f9182dde9f38ad1890", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1730481737, "narHash": "sha256-HaUCfqLIFX/4wiSKkKKSTwUNmZd1EMy+lGB+faadQXU=", @@ -546,7 +621,7 @@ "nixpkgs": [ "nixpkgs" ], - "treefmt-nix": "treefmt-nix" + "treefmt-nix": "treefmt-nix_2" }, "locked": { "lastModified": 1729945968, @@ -578,16 +653,42 @@ "type": "github" } }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "lnbits", + "nixpkgs" + ], + "systems": "systems_2", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1724134185, + "narHash": "sha256-nDqpGjz7cq3ThdC98BPe1ANCNlsJds/LLZ3/MdIXjA0=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "5ee730a8752264e463c0eaf06cc060fd07f6dae9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, "root": { "inputs": { "arion": "arion", "disko": "disko", "home-manager": "home-manager", "impermanence": "impermanence", + "lnbits": "lnbits", "nix-bitcoin": "nix-bitcoin", "nix-colors": "nix-colors", "nix-secrets": "nix-secrets", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "nixpkgs-unstable": "nixpkgs-unstable_2", "nixvim": "nixvim", "nur": "nur", @@ -630,7 +731,58 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "lnbits", + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719749022, + "narHash": "sha256-ddPKHcqaKCIFSFc/cvxS14goUhCOAwsM1PbMr0ZtHMg=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "8df5ff62195d4e67e2264df0b7f5e8c9995fd0bd", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { "inputs": { "nixpkgs": [ "nixvim", diff --git a/flake.nix b/flake.nix index 4d351ae..6da2dbb 100644 --- a/flake.nix +++ b/flake.nix @@ -32,6 +32,10 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + lnbits = { + url = "github:lnbits/lnbits"; + }; + # Nix colors nix-colors.url = "github:misterio77/nix-colors"; diff --git a/hosts/common/optional/nixos-containers/nix-bitcoin.nix b/hosts/common/optional/nixos-containers/nix-bitcoin.nix index 99a55c5..3b6b233 100644 --- a/hosts/common/optional/nixos-containers/nix-bitcoin.nix +++ b/hosts/common/optional/nixos-containers/nix-bitcoin.nix @@ -82,6 +82,7 @@ in { }: { imports = [ inputs.nix-bitcoin.nixosModules.default + inputs.lnbits.nixosModules.default ]; environment.systemPackages = with pkgs; [ vim @@ -90,7 +91,12 @@ in { ]; networking = { defaultGateway = "${gatewayIp}"; - interfaces.eth0.ipv4.addresses = [ { "address" = "${containerIp}"; "prefixLength" = 24; } ]; + interfaces.eth0.ipv4.addresses = [ + { + "address" = "${containerIp}"; + "prefixLength" = 24; + } + ]; firewall = { enable = true; allowedTCPPorts = [ @@ -100,6 +106,8 @@ in { config.containers.bitcoin-node.config.services.bitcoind.rpc.port config.containers.bitcoin-node.config.services.mempool.frontend.port config.containers.bitcoin-node.config.services.electrs.port + config.containers.bitcoin-node.config.services.rtl.port + config.containers.bitcoin-node.config.services.lnd.port ]; }; useHostResolvConf = lib.mkForce false; @@ -109,7 +117,9 @@ in { # node services here nix-bitcoin.generateSecrets = true; + nix-bitcoin.nodeinfo.enable = true; services = { + backups.enable = true; tor = { enable = true; client.enable = true; @@ -123,7 +133,6 @@ in { txindex = true; rpc = { address = "0.0.0.0"; - threads = 6; allowip = allowip; users = let name = "bitcoin"; @@ -151,11 +160,38 @@ in { address = "0.0.0.0"; }; }; + lnd = { + enable = true; + lndconnect = { + enable = true; + onion = true; + }; + extraConfig = '' + alias=bitlab21 + ''; + }; + rtl = { + enable = true; + nodes.lnd.enable = true; + address = "0.0.0.0"; + }; + lnbits = { + enable = true; + openFirewall = true; + host = "0.0.0.0"; + port = 8231; + env = {LNBITS_ADMIN_UI = "true";}; + }; }; + + # Add custom systemd overrides for above services + systemd.services.lnbits.after = ["lnd.service"]; + nix-bitcoin.onionServices = { bitcoind.enable = true; electrs.enable = true; mempool-frontend.enable = true; + lnd.public = true; }; services.openssh = {