deploy-rs icon indicating copy to clipboard operation
deploy-rs copied to clipboard

checks don't run on remoteBuild when deploying to a different architecture

Open aristaeus opened this issue 5 months ago • 2 comments

I'm deploying from aarch64-darwin to x86_64-linux. When I run deploy-rs with remoteBuild = True, build are done on the remote host and this works fine. However when I include the checks, as written in the readme, I get an error.

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

results in

error: a 'x86_64-linux' with features {} is required to build '/nix/store/s9188jlmmd8m66iz489w7bi4hl2jpik3-builder.pl.drv', but I am a 'aarch64-darwin' with features {benchmark, big-parallel, nixos-test}
🚀 ❌ [deploy] [ERROR] Failed to check deployment: Nix checking command resulted in a bad exit code: Some(1)

I can't find anyone else with this complaint so I assume it's user error, but I also can't find any documentation of what I'm doing wrong.

aristaeus avatar Aug 01 '25 01:08 aristaeus

Hey, the checks are currently only executed on the host you deploy from and invoked via nix flake check. As you are on Darwin, I don't know if there is a way for simple cross-compiling like boot.binfmt.emulatedSystems = [ "x86_64-linux"]; under NixOS. For now, I would suggest you to skip the checks via the -s flag.

weriomat avatar Aug 01 '25 22:08 weriomat

A suggestion for anyone finding this, so you can still run the full checks as recommended when the platform allows for it, and not need to skip the checks via the CLI flag - you can define your flake's checks like so:

    checks = forAllSystems (system: let
        pkgs = nixpkgs.legacyPackages.${system};
        deploy-rs-checks = deploy-rs.lib.${system}.deployChecks self.deploy;
    in with pkgs; lib.optionalAttrs stdenv.isLinux deploy-rs-checks // {
        # Your other usual checks can go here, e.g. deadnix, formatter, pre-commit, ...
    });

This works for me, even when ran on a darwin host:

$ nix flake check --all-systems
warning: Git tree '~/repos/nixos-configs' is dirty
warning: unknown flake output 'deploy'

Maybe it could make sense to support deploys.nodes per-system, much like devShells and checks work for flakes.
This way, we could use utilities like forAllSystems / flake-utils to make it easy to define everything independent of the host system. Furthermore, we could do things like e.g. set remoteBuild based on the target and host system matching or not 🚀 🙂

miguelpduarte avatar Nov 07 '25 01:11 miguelpduarte