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

deploy from darwin to nixos and vice versa

Open happysalada opened this issue 2 years ago â€ĸ 15 comments
trafficstars

Remote builds have been implemented, but trying to deploy a nixos flake from a darwin machine complains

error: a 'x86_64-linux' with features {} is required to build '/nix/store/b1ajwc4fb2zj6pr0hkbdv1cjx4kxf75s-default-conf.json.drv', but I am a 'x86_64-darwin' with features {benchmark, big-parallel, nixos-test}

it would be nice to be able to do the build process completely remotely so as to do os hybrid deployments. (I thought I would open another issue since the remote-build feature doesn't solve this use case).

happysalada avatar May 21 '23 04:05 happysalada

Hmm, x86_64-linux deployments to x86_64-darwin work for me with --remote-build. I didn't really try to deploy anything the other way around :thinking:

rvem avatar May 22 '23 03:05 rvem

Does your profile use IFD by any chance?

rvem avatar May 22 '23 09:05 rvem

no It doesn't. here is my flake https://github.com/happysalada/dotfiles I'm deploying the "bee" profile. For that my only way to deploy is to use nixinate for now. I've just double checked with a --no-allow-import-from-derivation to be sure, and I still managed to deploy.

happysalada avatar May 23 '23 01:05 happysalada

@happysalada , on my side I was able to deploy from a x86_64-darwin to a x86_64-linux by skipping checks

deploy --remote-build --skip-checks .#foo

Obviously it's not a good idea to deploy without checks, but it's a good starting point.

eliandoran avatar Jul 02 '23 10:07 eliandoran

Nice ! I thought i had tried without checks, i must have just imagined it. Im going to give this another go in 6 months time.

happysalada avatar Jul 04 '23 06:07 happysalada

Bumping this as I am facing the same kind of issue right now. Skipping checks helped!

bachrc avatar Nov 30 '23 11:11 bachrc

This also happens to me!

error: a 'x86_64-linux' with features {} is required to build '/nix/store/88r7cxcy27fhsysc7fzrwhlfc4vpxr2c-builder.pl.drv', but I am a 'aarch64-darwin' with features {apple-virt, benchmark, big-parallel, nixos-test}

rbreslow avatar Dec 30 '23 19:12 rbreslow

See also: https://github.com/serokell/deploy-rs/issues/167#issuecomment-1325946289

The problem is that deployChecks runs locally, even if --remote-build is provided. So if your deploy target's architecture differs from your local machine's, it won't work, until checks are rewritten to run remotely as well.

JeanMertz avatar Mar 07 '24 20:03 JeanMertz

I don't get this working - at all.

  outputs =
    { self
    , deploy-rs
    , ...
    } @ inputs:
    {
      # ...

      deploy.nodes.utm = {
        hostname = "192.168.71.3";
        remoteBuild = true;
        profiles.system = {
          user = "root";
          path = deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.utm;
        };
      };
      # checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
    }

I had to disable the checks - but I am still getting a warning

$ nix flake check --show-trace
warning: unknown flake output 'deploy'

What am I missing?

tcurdt avatar Mar 16 '24 23:03 tcurdt

Hm. Seems to work anyway.

$ nix run github:serokell/deploy-rs .
🚀 â„šī¸ [deploy] [INFO] Running checks for flake in .
warning: unknown flake output 'deploy'
🚀 â„šī¸ [deploy] [INFO] Evaluating flake in .
🚀 â„šī¸ [deploy] [INFO] The following profiles are going to be deployed:
[utm.system]
user = "root"
ssh_user = "tcurdt"
path = "/nix/store/z2nsrr89fsjap88b6vpdy3ziwrpicqqs-activatable-nixos-system-nixos-24.05.20240314.d691274"
hostname = "192.168.71.3"
ssh_opts = []

🚀 â„šī¸ [deploy] [INFO] Building profile `system` for node `utm` on remote host
🚀 â„šī¸ [deploy] [INFO] Activating profile `system` for node `utm`
🚀 â„šī¸ [deploy] [INFO] Creating activation waiter
⭐ â„šī¸ [activate] [INFO] Activating profile
👀 â„šī¸ [wait] [INFO] Waiting for confirmation event...
updating GRUB 2 menu...
activating the configuration...
setting up /etc...
reloading user units for root...
reloading user units for tcurdt...
restarting sysinit-reactivation.target
⭐ â„šī¸ [activate] [INFO] Activation succeeded!
⭐ â„šī¸ [activate] [INFO] Magic rollback is enabled, setting up confirmation hook...
👀 â„šī¸ [wait] [INFO] Found canary file, done waiting!
⭐ â„šī¸ [activate] [INFO] Waiting for confirmation event...
🚀 â„šī¸ [deploy] [INFO] Success activating, attempting to confirm activation
🚀 â„šī¸ [deploy] [INFO] Deployment confirmed.

tcurdt avatar Mar 16 '24 23:03 tcurdt

I had to disable the checks - but I am still getting a warning

The warning is somewhat expected since deploy-rs expects deploy flake outputs that aren't "standard" flake outputs and thus nix emits a warning during the evaluation

rvem avatar Mar 18 '24 10:03 rvem

I had to disable the checks

I suspect there are no tangible plans to support this scenario?

So if your deploy target's architecture differs from your local machine's, it won't work, until checks are rewritten to run remotely as well

The warning is somewhat expected since deploy-rs expects deploy flake outputs that aren't "standard" flake outputs and thus nix emits a warning during the evaluation

I see. And there is no way for nix to accept the output as expected?

tcurdt avatar Mar 18 '24 10:03 tcurdt

I suspect there are no tangible plans to support this scenario?

there is no way currently to run checks remotely and running darwin checks on a linux machine is quite the endeavour. we could possibly implement a check that emulates what nix does but runs it remotely, however the introduced complexity would be significant compared to using magic-rollback for these cases

PhilTaken avatar Mar 18 '24 12:03 PhilTaken