-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
Tutorial: ad hoc developer environments #18
Conversation
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.
I wish I had this last year :(
This is a great way to play with Nix tooling and see some of its potential. | ||
|
||
|
||
When are such environments useful? |
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.
Before answering “when are such environments useful?” you should probably answer “what is a shell environment?” so that the reader can more easily objectivize this idea. People have an easier time understanding things they can point a finger at.
It's fine if the answers to these to questions overlap a bit, it'll only reinforce the idea.
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.
I recommend a snippet similar to the following showing the general idea.
$ hello
The program ‘hello’ is currently not installed.
$ nix-shell -p hello
[nix-shell:~]$ hello
Hello, world!
[nix-shell:~]$ exit
exit
$ hello
The program ‘hello’ is currently not installed.
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.
Great tip!
|
||
Sometimes you'd like **to provide a script that is reproducible**, meaning it will also provide the tooling. | ||
|
||
Searching package attribute names |
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.
Some didactic wording for this section:
“What can I put in my shell environment?”
“To start, anything that's in the official package list can become part of the shell environment.”
“You can search the package list using…”
“Once you are comfortable doing this, you can add other things too. For example, packages of your own or custom shell aliases.”
Improving reproducability | ||
------------------------- | ||
|
||
These environments are **really convenient**, but they are **not yet reproducible**. |
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.
This makes it sound like they are not reproducible because Nix doesn't support this yet. This can be fixed by switching the order of the first two paragraphs and making some minor storytelling adjustments.
This is useful for one-liners and scripts that run for example on a CI. While developing however, we'd like to have our editor around and | ||
a bunch of other things. | ||
|
||
2. ``--run`` will execute a command instead of entering shell. This is only a demonstration how to automate things rather than reproducability improvement. |
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.
“… execute a command while having access to the shell environment, instead of entering the shell.”
Reproducible executables | ||
------------------------ | ||
|
||
Finally, we can wrap scripts to provide a reproducible environment that we can commit to a git repository. |
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.
“… and share with strangers online. As long as they have Nix installed, they'll be able to execute the script without worrying about manually installing and later uninstalling dependencies at all”
cc @lucperkins |
bebdf11
to
b19d35a
Compare
Thanks all 🙇 |
Planning to merge this tomorrow, if someone wants to leave a review until then. |
First tutorial is available as a draft!
I'd love to hear comments from @zupo @k0001 @zimbatm @brodul
Rendered