deploy-rs
deploy-rs copied to clipboard
deploy from darwin to nixos and vice versa
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).
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:
Does your profile use IFD by any chance?
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 , 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.
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.
Bumping this as I am facing the same kind of issue right now. Skipping checks helped!
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}
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.
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?
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.
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
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-rsexpectsdeployflake outputs that aren't "standard" flake outputs and thusnixemits a warning during the evaluation
I see. And there is no way for nix to accept the output as expected?
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