let krops = builtins.fetchGit { url = "https://cgit.krebsco.de/krops/"; ref = "master"; }; lib = import "${krops}/lib"; pkgs = import "${krops}/pkgs" {}; # Define sources for each machine source = name: lib.evalSource [ { # NixOS configuration entry point nixos-config.symlink = "config-machine/configuration.nix"; # Use nixpkgs from local NIX_PATH (much smaller than git clone) # This copies your local without .git history (~400MB vs 6GB) nixpkgs.file = { path = toString ; useChecksum = true; }; # Shared configuration files (only shared modules and files) config-shared.file = toString ./config/shared.nix; config-modules.file = toString ./config/modules; config-nginx.file = toString ./config/nginx.nix; config-pict-rs.file = toString ./config/pict-rs.nix; config-lnbits.file = toString ./config/lnbits.nix; # Machine-specific configuration files (only this machine's config) config-machine.file = toString (./config/machines + "/${name}"); # Pre-built web-app (built locally with machine-specific config) web-app-dist.file = toString (./build + "/${name}/dist"); # LNBits flake source lnbits-src.file = toString ./lnbits; # LNBits extensions (deployed to /var/lib/lnbits/extensions) # Uncomment if you have custom extensions to deploy # lnbits-extensions.file = toString ./lnbits-extensions; } ]; # Example machine deployment (copy this block for each machine) # Replace "example-machine" with your machine name # Replace "root@your-host" with your SSH target example-machine = pkgs.krops.writeDeploy "deploy-example-machine" { source = source "example-machine"; target = "root@your-host-or-ip"; # Avoid having to create a sentinel file. # Otherwise /var/src/.populate must be created on the target node to signal krops # that it is allowed to deploy. force = true; }; # Add more machines here following the same pattern: # machine1 = pkgs.krops.writeDeploy "deploy-machine1" { # source = source "machine1"; # target = "root@machine1-host"; # force = true; # }; # Deploy to all machines (update this list with your machines) all = pkgs.writeScript "deploy-all" '' #!${pkgs.bash}/bin/bash set -e echo "Deploying to example-machine..." ${example-machine} # Add your machines here: # echo "Deploying to machine1..." # ${machine1} echo "All deployments completed!" ''; in { # Export your machine deployments here inherit example-machine all; # Add your machines to the inherit list: # inherit example-machine machine1 machine2 all; }