Initial commit, working configuration

This commit is contained in:
jeirmeister 2025-07-18 10:54:05 -07:00
commit 4327e30ed4
4 changed files with 236 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
repo-to-text_*

141
flake.lock generated Normal file
View file

@ -0,0 +1,141 @@
{
"nodes": {
"extra-container": {
"inputs": {
"flake-utils": [
"nix-bitcoin",
"flake-utils"
],
"nixpkgs": [
"nix-bitcoin",
"nixpkgs"
]
},
"locked": {
"lastModified": 1734005403,
"narHash": "sha256-vgh3TqfkFdnPxREBedw4MQehIDc3N8YyxBOB45n+AvU=",
"owner": "erikarvstedt",
"repo": "extra-container",
"rev": "f4de6c329b306a9d3a9798a30e060c166f781baa",
"type": "github"
},
"original": {
"owner": "erikarvstedt",
"ref": "0.13",
"repo": "extra-container",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nix-bitcoin": {
"inputs": {
"extra-container": "extra-container",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
},
"locked": {
"lastModified": 1751530600,
"narHash": "sha256-9YzlL/TIcVmuqXbN5VKEjzLAUO189h0DOBq9eNGgpaQ=",
"owner": "fort-nix",
"repo": "nix-bitcoin",
"rev": "e2ca2e496769a787a06c068acb43cb077c1fdc8c",
"type": "github"
},
"original": {
"owner": "fort-nix",
"ref": "release",
"repo": "nix-bitcoin",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1750969886,
"narHash": "sha256-zW/OFnotiz/ndPFdebpo3X0CrbVNf22n4DjN2vxlb58=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a676066377a2fe7457369dd37c31fd2263b662f4",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1750994206,
"narHash": "sha256-3u6rEbIX9CN/5A5/mc3u0wIO1geZ0EhjvPBXmRDHqWM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "80d50fc87924c2a0d346372d242c27973cf8cdbf",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1752620740,
"narHash": "sha256-f3pO+9lg66mV7IMmmIqG4PL3223TYMlnlw+pnpelbss=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "32a4e87942101f1c9f9865e04dc3ddb175f5f32e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nix-bitcoin": "nix-bitcoin",
"nixpkgs": "nixpkgs_2"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

74
flake.nix Normal file
View file

@ -0,0 +1,74 @@
{
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
];
};
};
}

20
justfile Normal file
View file

@ -0,0 +1,20 @@
# Variables
REMOTE_HOST := "root@10.1.1.163"
# Default command
default:
@echo "BTCPay Server deployment commands:"
@echo " just build - Build configuration"
@echo " just deploy - Deploy to remote server"
# Build the configuration
build:
NIX_CONFIG="experimental-features = nix-command flakes" nix build .#nixosConfigurations.btcpay.config.system.build.toplevel
# Deploy to remote server
deploy:
NIX_CONFIG="experimental-features = nix-command flakes" nixos-rebuild switch --flake .#btcpay --target-host {{REMOTE_HOST}} --option experimental-features "nix-command flakes"
# Check services status
status:
ssh {{REMOTE_HOST}} "systemctl status bitcoind btcpayserver"