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

Use nix eval instead of nix-instantiate for gomod2nix import #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jjthiessen
Copy link

Fixes #72

@adisbladis
Copy link
Member

What are you trying to do which isn't possible with the stable CLI interface? I'm extremely reluctant to rely on the 2.4+ commands as they haven't been the most stable and have weird assumptions around flake usage that keeps changing.

@jjthiessen
Copy link
Author

The existing single nix-instantiate call does not seem to work. However, using the nix command isn't necessary.
It seems as though running nix-instantiate --expr ...; nix-instantiate --eval --expr ... would also work.
My reasons for proposing nix eval --impure --expr ... over the two calls to nix-instantiate is that:

  • It's shorter (single exec vs two)
  • It doesn't produce an error when it succeeds (nix-instantiate will complain without --eval, but it appears necessary to run it without --eval first)

It may be possible to make it work with a single invocation of one of the older Nix commands (possibly adjusting the provided expression?), but I haven't really tried.
If the new commands are still deemed to be too experimental (or insufficiently available/you explicitly want to support older Nix versions), then opting for the double/back-to-back exec would work (if you don't mind the error: expression does not evaluate to a derivation (or a set or list of those) error).

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

Successfully merging this pull request may close these issues.

gomod2nix generate results in error path is not valid
2 participants