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

Flakes UX: nix run: unusable with --store "{remote}" #6317

Closed
colemickens opened this issue Mar 25, 2022 · 3 comments · Fixed by #6330
Closed

Flakes UX: nix run: unusable with --store "{remote}" #6317

colemickens opened this issue Mar 25, 2022 · 3 comments · Fixed by #6330

Comments

@colemickens
Copy link
Member

Describe the bug

I am trying to remove my devenv-driven bash scripts by instead wrapping these scripts into derivations and exposing them via nix run.

What I'd like to do is this:

nix run '.#flash-blueline-boot' \
  --eval-store auto \
  --store 'ssh-ng://[email protected]' \
  --override-input mobile-nixos "${HOME}/code/mobile-nixos"

But what I get is:

ls: cannot access '/nix/store/9cr0zplqxzpwcl6blmlz5dpclh3z3mbh-flash-blueline.sh': No such file or directory

Despite:

❯ ssh [email protected] \
  "ls -al /nix/store/9cr0zplqxzpwcl6blmlz5dpclh3z3mbh-flash-blueline.sh"
-r-xr-xr-x 1 root root 292 Jan  1  1970 /nix/store/9cr0zplqxzpwcl6blmlz5dpclh3z3mbh-flash-blueline.sh

This mirrors behavior of using --store in other scenarios where the remote built store path is not copied back.

With nix build I can understand it, but not nix run.

nix version

nix (Nix) 2.8.0pre20220322_d5d4d98
@thufschmitt thufschmitt moved this to To discuss in Nix UX Mar 28, 2022
@thufschmitt
Copy link
Member

Just a side remark, but you probably don’t want to have nix run always copy back to the local store. For example with --store /some/dir you probably just want to run the thing from your chrooted store.

Maybe that could be solved by #5025 : If we’re able to differentiate the build store and the one used to store the final outputs, then you could do:

nix run '.#flash-blueline-boot' \
  --eval-store auto \
  --build-store 'ssh-ng://[email protected]' \
  --store auto \ # Would probably be the default
  --override-input mobile-nixos "${HOME}/code/mobile-nixos"

@edolstra
Copy link
Member

nix run does not support remote execution, and probably won't because the store abstraction doesn't support executing arbitrary commands on a store. It should probably give a nicer error message if the store is not a LocalFSStore.

@colemickens
Copy link
Member Author

Huh, I missed all the replies here. I agree with @thufschmitt's assessment and appreciate the error message that was committed. Thank you!

@thufschmitt thufschmitt moved this from To discuss to Done in Nix UX Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants