NixOS / nix.dev

Official documentation for getting things done with Nix.
https://nix.dev
Creative Commons Attribution Share Alike 4.0 International
2.45k stars 245 forks source link

Nix language primer with `shell.nix` #516

Open zmitchell opened 1 year ago

zmitchell commented 1 year ago

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.

Tutorial contents

How

nixos-discourse commented 1 year ago

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

https://discourse.nixos.org/t/2023-04-13-learning-journey-working-group-meeting-notes-4/27255/1

khaled commented 1 year ago

A collection of existing tutorials with notes about what they cover:

Posts

Videos


From existing doc survey:

Tutorials

Ad hoc Shell Environments

References

Comand Reference -> Main Commands -> nix-shell Nix-shell shebang

nixos-discourse commented 1 year ago

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

https://discourse.nixos.org/t/2023-04-20-learning-journey-working-group-meeting-notes-5/27460/1

alper commented 1 year ago

I have a flake.nix with a mkShell in it. Is that equivalent?

The tutorial also does not mention whether shell.nix is a hard convention or something.

fricklerhandwerk commented 1 year ago

The agreed-upon tenet at the moment is to only teach using the stable interface, and Flakes are an experimental feature. Other than that, yes, it's equivalent.

shell.nix is the default filename taken by nix-shell (see the Nix manual).

alper commented 1 year ago

OK. In his tutorial here Amos focuses heavily on flake: https://fasterthanli.me/series/building-a-rust-service-with-nix/part-9

zmitchell commented 1 year ago

@roberth assigned to you for feedback

bew commented 1 year ago
  • This shell.nix will just grab nixpkgs from <nixpkgs>, leaving pinning, channels, etc to later tutorials

I think the guide should still mention this in a warning / note, or at least the kind of issues that comes from not pinning

roberth commented 1 year ago

Regarding not using flakes, it would be beneficial to make clear in the tutorial which parts of the file are about bring things into scope, and which part is the actual shell expression. As this is "First steps" they're not too familiar with the language yet, so some extra guidance as to what's what will help them transfer this knowledge to a flake context.

Furthermore some of these points apply; some context to keep in mind while writing this tutorial

nixos-discourse commented 1 year ago

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

https://discourse.nixos.org/t/2023-07-13-learning-journey-working-group-meeting-notes-17/30393/1

nixos-discourse commented 1 year ago

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

https://discourse.nixos.org/t/2023-07-17-tutorial-series-call-for-feedback/30616/1

nixos-discourse commented 1 year ago

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

https://discourse.nixos.org/t/2023-07-27-learning-journey-working-group-meeting-notes-19/31151/1

fricklerhandwerk commented 7 months ago

Cleaning out issues and compiling a refreshed overview, I think what we're still missing is a smooth transition between a very superficial look at Nix expressions (e.g. in the context of shell.nix) and the hefty Nix language basics tutorial. I renamed the issue accordingly to make it fit into the new overview.