NixOS / NixOS/nix.dev

Nix language primer with `shell.nix`

Open
#516 13 comments 1 reaction 1 assignee View on GitHub

@roberth is already working on this.

Since Jun 19, 2023.

guide (2) tracking
Dominant language
Nix
Stars
4k
Forks
339
Avg merge
2d 11h
Merged PRs (30d)
7

Description

The Learning Journey WG identified that the second tutorial in the learning journey should be a tutorial walking the user through creating a shell.nix. This is the tracking issue for discussion on this tutorial and related work.

  • Compile a survey of shell.nix tutorials (@khaled)
  • Consider if there are elements of existing tutorials that we should include
  • Prepare an outline of the tutorial
  • Prepare a draft of the tutorial
  • Submit the draft as a PR

Tutorial contents

  • Provide the reader with a small, functioning shell.nix installing Python
  • Explain that once you've experimented with packages via nix-shell -p you can enter the same environment repeatedly by declaring it in a shell.nix file.
  • You can also use shell.nix to configure other aspects of the environment:
    • Environment variables
    • Shell hooks
    • Shell prompts
  • Illustrate how to add packages to the shell, explaining the basic differences between buildInputs and packages
  • This shell.nix will just grab nixpkgs from <nixpkgs>, leaving pinning, channels, etc to later tutorials

How

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.