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
nixos-rebuild: use remote $PATH in buildHostCmd #107684
Conversation
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-run-nixos-rebuild-target-host-from-darwin/9488/3 |
096423a
to
70b6479
Compare
@ofborg eval |
@zimbatm @lopsided98 @grahamc You've been working on that code in the past ~1 year, can anyone take a quick look? |
Good catch, but I don't think that the solution is working as expected. Did you test this? $ BAR=3 env FOO='$BAR' bash -c 'echo $FOO'
$BAR |
I think the point is that e.g. the TL;DR: It's expected the single quotes prevent expansion on the local system. Compare |
this fixes the issue when using nixos-rebuild switch --target-host <target> --use-remote-sudo when the local machine does not have anything in `$PATH` that would resolve to `sudo` on the remote machine. the single quotes prevent expansion of `$PATH` on the local machine, such that the remote machine's value of that variable is used.
70b6479
to
50a2503
Compare
@cole-h Thanks for the explanation, I have amended the commit message to make it clearer for the future reader. |
I don't understand what does the path expansion, but it seems to work. $ ssh build01.nix-community.org env FOO='$HOSTNAME' env | grep FOO
FOO=nix-community-build01 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-run-nixos-rebuild-target-host-from-darwin/9488/4 |
Motivation for this change
I was trying to port
nixos-rebuild --target-host <target>
to Darwin and noticed that the$PATH
to run commands on the build host was actually the local one. It should of course be the remote one.This fixes the issue when using
and the local machine does not have anything in
$PATH
that would resolve tosudo
on the remote machine.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)