{ description = "BTCPay server, NBXplorer, Bitcoin Core, etc. as a NixOS system/container image"; inputs = { nix-bitcoin.url = "github:fort-nix/nix-bitcoin/release"; nixpkgs.follows = "nix-bitcoin/nixpkgs"; nixos-generators.url = "github:nix-community/nixos-generators"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, nix-bitcoin, nixos-generators, flake-utils, ... }: let system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; }; modules = [ nix-bitcoin.nixosModules.default ./nix/modules/bitcoind ./nix/modules/nbxplorer ./nix/modules/btcpay ]; in { # Top-level nixosConfigurations for proper nixos-rebuild support nixosConfigurations.btc-pay-server = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = modules ++ [ ({ config, ... }: { boot.isContainer = true; system.stateVersion = "25.05"; services.btcpay-full.enable = true; users.users.root.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAaV7JtUWkWrjo5FfCcpTCCEY/OJ+T1mJOLbe4avg0XH sysadmin@skrybit.io" ]; services.openssh = { enable = true; settings = { PermitRootLogin = "prohibit-password"; PasswordAuthentication = false; }; }; }) self.nixosModules.btcpay-server ]; }; # devShells and other per-system outputs, if desired devShells = flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; in { default = pkgs.mkShell { buildInputs = [ nixos-generators.packages.${system}.nixos-generate pkgs.just ]; shellHook = '' echo "💚 Devshell ready: nixos-generate, just available." ''; }; } ); }; }