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

working on #PR 325 - nix shell and shellbang #427

Merged
merged 14 commits into from
Feb 16, 2023

Conversation

henrik-ch
Copy link
Contributor

I hope that I am not committing a faux pas here.

This is basically the work from @rapenne-s with the comments and suggested changes from @fricklerhandwerk and @n8henrie. The reason that I started a new PR was that I wasn't sure how to continue inside the #325 itself.

@henrik-ch
Copy link
Contributor Author

I see that the CI (continuous integration) is failing, is that something that needs to be fixed for the PR to be valid?

@n8henrie
Copy link

I have no issue with you assuming charge of this PR. I would consider expanding more on the --pure part, as I think this is one of the most important flags one can use to ensure portability on non-NixOS systems.

@henrik-ch
Copy link
Contributor Author

henrik-ch commented Jan 17, 2023

Thank you for giving feedback and guidance here @n8henrie.

The info that I have found on the --pure parameter is on this webpage:
https://nixos.org/manual/nix/stable/command-ref/nix-shell.html
the screenshot pure section specifically:
image
Is that what you were thinking about?
In that case, I could either link to it, or bring parts of it over to the tutorial page.
What do you think is better?

If you know of a different/better source than that man page linked above, I am of course very happy to hear about that too.

@fricklerhandwerk
Copy link
Collaborator

fricklerhandwerk commented Jan 18, 2023

In that case, I could either link to it, or bring parts of it over to the tutorial page.
What do you think is better?

I wasn't asked, but still: Definitely link, to unambiguously keep a single source of truth. In case the manual doesn't do a good-enough job, let's improve the manual.

@henrik-ch
Copy link
Contributor Author

I wasn't asked, but still: Definitely link, to unambiguously keep a single source of truth. In case the manual doesn't do a good-enough job, let's improve the manual.

I tried to follow this advice. Please let me know if you see any further changes on this.

@henrik-ch
Copy link
Contributor Author

On another note - I am tempted to suggest changing the heading of this tutorial:

Current heading:
Reproducible interpreted scripts

New heading suggestion:
Interpreted scripts with shebang

Please do thumbs up or thumbs down as a quick feedback on this comment/suggestion.

```shell
#!/usr/bin/env nix-shell
#! nix-shell -i bash --pure
#! nix-shell -p cacert curl jq python3Packages.xmljson

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also include -p bash; while implicit in this case (it is included by something else), this omission in the prior tutorial led to me wasting a fair chunk of my time! See also: https://discourse.nixos.org/t/nix-shell-shebang-default-nix-no-such-file-or-directory/24246/2?u=n8henrie

EDIT: (Adding -p bash was the main reason I was tagged to contribute to this PR :) thanks for picking up and running with it!)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback Nathan, this is included now.

source/tutorials/nix-shell-in-shebang.md Outdated Show resolved Hide resolved
@henrik-ch
Copy link
Contributor Author

I think this may be ready to be included now.

I was thinking of adding instructions on how to find versions for pinning nixpkgs, but I will omit that as I believe it would fit better under source/reference/pinning-nixpkgs.md

@fricklerhandwerk
Copy link
Collaborator

I'll get back to reviewing this once #325 is merged.

@henrik-ch
Copy link
Contributor Author

As the original PR has now been merged, this one can be closed.

@henrik-ch henrik-ch closed this Feb 14, 2023
@fricklerhandwerk
Copy link
Collaborator

fricklerhandwerk commented Feb 14, 2023

#325 is merged, please rebase. I try to make time a review next week, but no promises.

Edit: @henrik-ch Seems we missed each other closely. You had a valuable addition there, please rebase so we can incorporate that.

@henrik-ch
Copy link
Contributor Author

Took some extra steps to get a sensible merge to current master, but I think this should be okay now.

Copy link
Collaborator

@fricklerhandwerk fricklerhandwerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs to update the provenance of commands, since you added bash and cacert. Probably you should say that adding the interpreter package is required to make sure the exact right version is used.

Now that NixOS/nixos-search#610 is merged we can actually tell people to just use search.nixos.org to find what they need. Thanks a lot @ncfavier!

We could add right after that line:

Use [search.nixos.org](https://search.nixos.org/packages) to find packages providing the program you need.

source/tutorials/reproducible-scripts.md Outdated Show resolved Hide resolved
source/tutorials/reproducible-scripts.md Outdated Show resolved Hide resolved
henrik-ch and others added 3 commits February 16, 2023 07:23
as suggested by @fricklerhandwerk.

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Copy link
Collaborator

@fricklerhandwerk fricklerhandwerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good, just minor suggestions on wording. Thanks a lot!

source/tutorials/reproducible-scripts.md Outdated Show resolved Hide resolved
source/tutorials/reproducible-scripts.md Outdated Show resolved Hide resolved
source/tutorials/reproducible-scripts.md Outdated Show resolved Hide resolved
henrik-ch and others added 3 commits February 16, 2023 15:31
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
@fricklerhandwerk fricklerhandwerk merged commit fda85e2 into NixOS:master Feb 16, 2023
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-44/25546/1

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.

None yet

4 participants