{ description = "BTCPay Server NixOS module"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; nix-bitcoin.url = "github:fort-nix/nix-bitcoin/release"; }; outputs = { self, nixpkgs, nix-bitcoin, ... }: { # Export a module for others to use nixosModules.btcpay-server = { config, lib, pkgs, ... }: { imports = [ nix-bitcoin.nixosModules.default ]; options.services.btcpay-full = { enable = lib.mkEnableOption "BTCPay Server with Bitcoin node"; }; # Disable debugfs mount in LXC containers config = lib.mkIf config.services.btcpay-full.enable { nix-bitcoin.generateSecrets = true; nix-bitcoin.operator = { enable = true; name = "btcpay"; }; services.bitcoind = { enable = true; prune = 100000; dbCache = 8000; rpc.port = 8332; }; # Enable BTCPay Server with network binding services.btcpayserver = { enable = true; # Configure BTCPay Server to listen on all interfaces address = "0.0.0.0"; port = 23000; }; networking.firewall.allowedTCPPorts = [ config.services.btcpayserver.port config.services.bitcoind.port ]; }; }; # System configuration for deployment - REMOVED duplicate nix-bitcoin import nixosConfigurations.btcpay = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ({ ... }: { # Minimal system configuration for containers boot.isContainer = true; system.stateVersion = "25.05"; # Enable our BTCPay service services.btcpay-full.enable = true; # Basic SSH access services.openssh = { enable = true; settings = { PermitRootLogin = "yes"; PasswordAuthentication = true; }; }; }) # This module already imports nix-bitcoin.nixosModules.default self.nixosModules.btcpay-server ]; }; }; }