How to move from building sd card images, to be able to remotely deploy new versions?

Thanks for responding!

I was able to extract that part, and now my configuration looks ike this:

{
  description = "NixOS Raspberry Pi configuration flake";
  outputs = { self, nixpkgs }: {
    nixosConfigurations = {
      rpi = nixpkgs.lib.nixosSystem {
        system = "aarch64-linux";
        modules = [
          "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
          ./configuration.nix
        ];
      };
    };
  };
}

But my configuration.nix still contains this:

  # This makes the build be a .img instead of a .img.zst
  sdImage.compressImage = false;

My first step to create two different nixos configurations is this:

{
  description = "NixOS Raspberry Pi configuration flake";
  outputs = { self, nixpkgs }: {
    nixosConfigurations = {
      rpi = nixpkgs.lib.nixosSystem {
        system = "aarch64-linux";
        modules = [
          "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
          ./configuration.nix
        ];
      };
      rpiImage = nixpkgs.lib.nixosSystem {
        system = "aarch64-linux";
        modules = [
          "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
          ./configuration.nix
        ];
      };
    };
  };
}

But I don’t want to include any of the sd image-stuff in the first one, only in the second one. So I remove the sdImage.compressImage from configuration.nix and add it into the nixosConfigurations.rpiImage block. Now it looks like this:

{
  description = "NixOS Raspberry Pi configuration flake";
  outputs = { self, nixpkgs }: {
    nixosConfigurations = {
      rpi = nixpkgs.lib.nixosSystem {
        system = "aarch64-linux";
        modules = [
          ./configuration.nix
        ];
      };
      rpiImage = nixpkgs.lib.nixosSystem {
        system = "aarch64-linux";
        modules = [
          "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
          ./configuration.nix
          # Inline configuration here
          ({ ... }: {
            config = {
              # This makes the build be a .img instead of a .img.zst
              sdImage.compressImage = false;
            };
          })
        ];
      };
    };
  };
}

And building with nix build .#nixosConfigurations.rpiImage.config.system.build.sdImage seems to still work as before. However, how do I build nixosConfigurations.rpi? My goal is to build that and get something in my nix store that I can copy over to the running raspberry.