Official Nix Language Cheat Sheet

Hey everyone

I’ve just submitted a PR to add an official Nix language cheat sheet to the marketing repository (Add cheat sheets #7). The cheat sheet is available in A4 and Letter paper sizes and in full color and (mostly) grayscale. This is part of a larger effort by the marketing team to create and collect swag that we can distribute at future NixCon and other large events.

26 Likes

I would so much appreciate a cheat sheet for functions from builtins and nixpkgs’s lib (and from packages too, such as buildEnv) - sometimes i just can neither find the one i need at a certain moment, nor remember some function I already used later.

1 Like

That’s a pretty good idea. Although there are a lot of builtins and library functions.

Until one materializes, have you tried using https://noogle.dev/?

3 Likes

oh, interesting resource, thank you.

I notice that there is a lot of 3rd party resources popping up around nix, but unless I manage to catch a discussion about one here on discoruse - i’d probably never find it on my own.

but as for what it is - it’s a good to find a manual entry for a function you know by name, but not that good for discovering a function that you didn’t know exists.
Also I see it misses docs for functions from pkgs, such as all kind of builders. But, unfortunately, for those even nixos/nixpkgs manuals do not contain full reference entries, usually I’m forced to look into their code.

1 Like

Cool… I had the idea to do something similar using Typst to facilitate user contributions.

4 Likes

I’ve looked at Typst but never tried it. It looks really cool and I’ve heard the barrier to entry is a lot lower. What’s your experience with it?

Honestly, a whole series of cheat sheets like this would be really nice to have in general, bite-size format for information like this is generally nice to see.

2 Likes

I do have plans to add a nix commands (and maybe repl) cheat sheet. And @sirphobos’s comment has me thinking about one for builtins and functions.

Any other thoughts about what would make for a helpful cheat sheet?

1 Like

Typst? This is a wonderful piece of software. I was a convinced user of LaTeX (ex: ECPHP / sessions · GitLab) for years… and since I tried Typst, I never went back to using LaTeX…

I’m using Typst for writing letters, making presentations

3 Likes

This is pretty sick! Okay I’m convinced. I’m going to take a look at converting to typst after this PR goes through.

I was poking around a bit in your repo. How do you make it work so you can use packages from the typst universe?

I just uploaded the latest nix files I usually use for Typst projects: Flake for Typst · GitHub

Once in your repo, create the file: src/<name-of-the-document>/main.typ, then the scripts build-<name-of-the-document> and watch-<name-of-the-document> will be available.

The packages from Typst universe should also be available.

4 Likes

I have a note somewhere telling me to look at making builtins and lib cheatsheets for navi… Still haven’t tried it out.

I am pretty convinced that we could generate them as part of the documentation generation process: syntax is pretty simple (c.f. navi/docs/cheatsheet_syntax.md at 7575ca2435c6032881d637135d8f00d4cc1e8f94 · denisidoro/navi · GitHub).

It would make the cheatsheets usable from CLI, interactively, without internet connection.

3 Likes