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

Tutorial: ad hoc developer environments #18

Merged
merged 2 commits into from
May 22, 2020

Conversation

domenkozar
Copy link
Member

@domenkozar domenkozar commented May 20, 2020

First tutorial is available as a draft!

I'd love to hear comments from @zupo @k0001 @zimbatm @brodul

Rendered

Copy link
Contributor

@zupo zupo left a 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 :(

source/tutorials/ad-hoc-developer-environments.rst Outdated Show resolved Hide resolved
This is a great way to play with Nix tooling and see some of its potential.


When are such environments useful?
Copy link

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.

Copy link

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.

Copy link
Member Author

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
Copy link

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**.
Copy link

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.
Copy link

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.
Copy link

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”

@domenkozar
Copy link
Member Author

cc @lucperkins

@domenkozar domenkozar force-pushed the ad-hoc-developer-environments branch from bebdf11 to b19d35a Compare May 21, 2020 07:54
@domenkozar
Copy link
Member Author

Thanks all 🙇

@domenkozar domenkozar marked this pull request as ready for review May 21, 2020 13:33
@domenkozar
Copy link
Member Author

Planning to merge this tomorrow, if someone wants to leave a review until then.

@domenkozar domenkozar merged commit 5170bfe into master May 22, 2020
@fricklerhandwerk fricklerhandwerk deleted the ad-hoc-developer-environments branch October 9, 2023 15:18
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.

3 participants