Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate remote machines locally from mac #23

Closed
srid opened this issue Nov 27, 2022 · 5 comments
Closed

Activate remote machines locally from mac #23

srid opened this issue Nov 27, 2022 · 5 comments

Comments

@srid
Copy link
Owner

srid commented Nov 27, 2022

https://github.com/serokell/deploy-rs

Work on my primary machine (macOS) and remotely activate new configuration for Linux machines and such.

@srid
Copy link
Owner Author

srid commented Feb 6, 2023

or,

nix run nixpkgs#nixos-rebuild -- switch --fast --flake .#pinch --target-host root@pinch --build-host root@pinch

https://www.haskellforall.com/2023/01/announcing-nixos-rebuild-new-deployment.html

@srid srid changed the title Use deploy-rs to activate remote machines Activate remote machines locally from mac Feb 6, 2023
@srid
Copy link
Owner Author

srid commented Feb 21, 2024

This works for non-trivial configurations:

nixos-config/justfile

Lines 4 to 9 in 0196461

# Remote deploy to a host
remote host='here':
nixos-rebuild switch --fast --use-remote-sudo \
--flake .#{{host}} \
--target-host $USER@{{host}} \
--build-host $USER@{{host}}

But not when using certain packages, like nixvim:

https://nixos.zulipchat.com/#narrow/stream/413948-nixos/topic/NixOS.20tutorial.20series/near/422506285

@LovingMelody
Copy link
Contributor

Per nixos-rebuild(8), you may wish to consider dropping "--fast"

       --fast  Equivalent to --no-build-nix.  This  op‐
               tion is useful if you call nixos-rebuild
               frequently  (e.g. if you’re hacking on a
               NixOS module).

@srid
Copy link
Owner Author

srid commented Feb 22, 2024

I'd think --fast actually helps. If I remove it, it will try to build the Linux configuration on macOS (not what I want),

Note that, if --no-build-nix is not specified, Nix will be built
both locally and remotely. This is because the configuration will
always be evaluated locally even though the building might be per‐
formed remotely.

Indeed, when I remove it - the deployment from mac does fail:

❯ j remote
nixos-rebuild switch --use-remote-sudo --flake .#here --target-host $USER@here --build-host $USER@here
warning: Git tree '/Users/srid/code/nixos-config' is dirty
warning: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled
warning: Ignoring setting 'impure-env' because experimental feature 'configurable-impure-env' is not enabled
error: a 'aarch64-linux' with features {} is required to build '/nix/store/z2548rnzrzpmx2gynnjrq2lyn10pkfna-nixos-rebuild.drv', but I am a 'aarch64-darwin' with features {apple-virt, benchmark, big-parallel, nixos-test}
error: Recipe `remote` failed on line 9 with exit code 1

@srid
Copy link
Owner Author

srid commented Jun 26, 2024

Resolved in srid/nixos-flake#54

@srid srid closed this as completed Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants