Deploying with deploy-rs results in failure related to /nix/store/derivations and /nix/store/version directories

Nix version: 2.33.0

I am trying to deploy a nixos vm update using deploy-rs and I keep getting errors like this.

ishan@work:~/nix$ deploy 
๐Ÿš€ โ„น๏ธ [deploy] [INFO] Running checks for flake in .
warning: Git tree '/home/ishan/nix' is dirty
warning: unknown flake output 'self'
warning: unknown flake output 'src'
warning: unknown flake output 'snowfall'
warning: unknown flake output 'deploy'
evaluation warning: 'system' has been renamed to/replaced by 'stdenv.hostPlatform.system'
warning: unknown flake output 'pkgs'
warning: The check omitted these incompatible systems: aarch64-darwin, aarch64-linux, x86_64-darwin
Use '--all-systems' to check all.
๐Ÿš€ โ„น๏ธ [deploy] [INFO] Evaluating flake in .
warning: Git tree '/home/ishan/nix' is dirty
๐Ÿš€ โš ๏ธ [deploy] [WARN] Interactive sudo is enabled! Using a sudo password is less secure than correctly configured SSH keys.
Please use keys in production environments.
๐Ÿš€ โ„น๏ธ [deploy] [INFO] You will now be prompted for the sudo password for kepler.
(sudo for kepler) Password: 
๐Ÿš€ โ„น๏ธ [deploy] [INFO] The following profiles are going to be deployed:
[kepler.system]
user = "kepler"
ssh_user = "kepler"
path = "/nix/store/k4flqnddp9zr0fpsx3c41wrgynnrb08b-activatable-nixos-system-kepler-26.05.20260117.3327b11"
hostname = "kepler"
ssh_opts = ["-t"]

๐Ÿš€ โ„น๏ธ [deploy] [INFO] Building profile `system` for node `kepler`
error: getting status of '/nix/store/derivations': No such file or directory
๐Ÿš€ โŒ [deploy] [ERROR] Failed to build profile on node kepler: kepler

Sometimes it fails with

error: getting status of '/nix/store/derivations': No such file or directory

other times it fails with

error: getting status of '/nix/store/version': No such file or directory

Config files

// flake.nix
{
  description = "Ishan's homelab configuration";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";

    flake-compat.url = "github:nix-community/flake-compat";
    flake-compat.flake = false;

    flake-utils.url = "github:numtide/flake-utils";
    flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus";
    flake-utils-plus.inputs.flake-utils.follows = "flake-utils";

    snowfall-lib.url = "github:snowfallorg/lib/main";
    snowfall-lib.inputs.nixpkgs.follows = "nixpkgs";
    snowfall-lib.inputs.flake-utils-plus.follows = "flake-utils-plus";

    treefmt-nix.url = "github:numtide/treefmt-nix";
    treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";

    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";

    deploy-rs = {
      url = "github:serokell/deploy-rs";
      inputs.flake-compat.follows = "flake-compat";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.utils.follows = "flake-utils";
    };
  };

  outputs = inputs@{ deploy-rs, self, ... }:
    let
      lib = inputs.snowfall-lib.mkLib {
        inherit inputs;
        src = ./.;
        snowfall = {
          namespace = "work";
          meta = {
            name = "ishan-nix-configs";
            title = "Ishan's Nix configuration";
          };
        };
      };
      treefmtModule = inputs.treefmt-nix.lib.evalModule;
    in lib.mkFlake {
      inherit inputs;
      src = ./.;

      # deploy = lib.mkDeploy { inherit (inputs) self pkgs; };

      deploy.nodes.kepler = {
        hostname = "kepler";
        sshUser = "kepler";
        sshOpts = [ "-t" ];
        interactiveSudo = true;
        remoteBuild = false;
        profiles.system = {
          user = "kepler";
          sshUser = "kepler";
          path = deploy-rs.lib.x86_64-linux.activate.nixos
            self.nixosConfigurations.kepler;
        };
      };

      checks = builtins.mapAttrs
        (system: deployLib: deployLib.deployChecks inputs.self.deploy)
        inputs.deploy-rs.lib;

      devShells.x86_64-linux.default =
        let pkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
        in pkgs.mkShell {
          packages = [ inputs.deploy-rs.packages.${pkgs.system}.deploy-rs ];
        };

      outputs-builder = channels: {
        formatter =
          (treefmtModule channels.nixpkgs ./treefmt.nix).config.build.wrapper;
      };
    } // {
      inherit (inputs) self;
    };
}

// systems/x86_64-linux/kepler/default.nix
{ lib, pkgs, namespace, ... }:
with lib;
with lib.${namespace};
let hostName = "kepler";
in {
  imports = [ ./hardware-configuration.nix ];

  # Bootloader.
  boot.loader.grub.enable = true;
  boot.loader.grub.device = "/dev/sda";
  boot.loader.grub.useOSProber = true;

  # Use latest kernel.
  boot.kernelPackages = pkgs.linuxPackages_latest;

  networking.hostName = hostName;

  # Enable networking
  networking.networkmanager.enable = true;

  # Select internationalisation properties.
  i18n.defaultLocale = "en_IN";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_IN";
    LC_IDENTIFICATION = "en_IN";
    LC_MEASUREMENT = "en_IN";
    LC_MONETARY = "en_IN";
    LC_NAME = "en_IN";
    LC_NUMERIC = "en_IN";
    LC_PAPER = "en_IN";
    LC_TELEPHONE = "en_IN";
    LC_TIME = "en_IN";
  };

  time.timeZone = "Asia/Kolkata";

  # Enable passwordless sudo.
  security.sudo.extraRules = [{
    users = [ "kepler" ];
    commands = [{
      command = "ALL";
      options = [ "NOPASSWD" ];
    }];
  }];

  services.openssh = enabled // {
    settings = {
      PasswordAuthentication = false;
      PermitRootLogin = "prohibit-password";
    };
  };

  systemd.targets.multi-user.enable = true;

  nix = mkNixConfig { inherit lib pkgs; } // { optimise.automatic = true; };

  users.users.kepler.packages = with pkgs; [ nix-output-monitor ];

  users = {
    mutableUsers = false;
    users.kepler = {
      uid = 501;
      extraGroups = [ "wheel" "networkmanager" ];
      isSystemUser = true;
      group = "users";
      createHome = true;
      home = "/home/kepler";
      homeMode = "700";
      useDefaultShell = true;
      openssh.authorizedKeys.keys = [
        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAX88KLYCUWS1IKTGsgIRIHwGxTyfhsiRyAgtv65GEEm ishan@turquoise"
      ];
      isNormalUser = false;
      ignoreShellProgramCheck = true;
    };
  };

  system.stateVersion = "25.11";
}

// systems/x86_64-linux/kepler/hardware-configuration.nix
{ config, lib, modulesPath, ... }: {
  imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];

  boot.initrd.availableKernelModules = [
    "ata_piix"
    "uhci_hcd"
    "ahci"
    "virtio_pci"
    "virtio_scsi"
    "sd_mod"
    "sr_mod"
  ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ ];
  boot.extraModulePackages = [ ];

  fileSystems."/" = {
    device = "/dev/disk/by-uuid/da361663-426e-47a2-9c68-b0339a37741e";
    fsType = "ext4";
  };

  networking.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

deploy-rs mainline is currently incompatible with nix 2.33.0+. The fix was to temporarily switch to this branch. fix compatibility with nix 2.33+ show-derivation output by szlend ยท Pull Request #359 ยท serokell/deploy-rs ยท GitHub