Home

Awesome

nix-shorts

A collection of short notes about Nix, boiled down to what is immediately needed by users.

The aim of this collection is to provide some instantly usable information with clear code demonstrations.

Guide

While you can read the posts in this repo in any order, here's a suggestion:

From there on you should learn the Nix language (1, 2, 3) and try to read and customize more complex Nix expressions.

Requirements

Install Nix

The best way to install Nix at the moment is with the Determinate Nix Installer. Details of how to install Nix using the installer are in chapter 1 of Zero to Nix.

While you are there you may as well complete Zero To Nix which is a very good starting point to Nix.

Enable flakes

This guide will be flakes first and to be able to use that you'll have to enable what is at this moment still an ‘experimental’ feature.

If you installed using the Determinate Nix Installer linked in the previous section, then you don't have to do anything and flakes are already enabled for you.

If not, the wiki page on Flakes has a section on how to enable flakes permanently. The most common way of doing this is by adding this line to the file /etc/nix/nix.conf on your system:

experimental-features = nix-command flakes

Stylistic notes

All articles are meant to be easy enough to approach with clear examples of terminal commands, code, or file setups. When project setups are needed, appropriate directories will be in this repo and referenced.

When applicable, usernames are replaced with your-user and hashes replaced with some-hash. E.g.

$ readlink ~/.nix-profile
/nix/var/nix/profiles/per-user/justin/profile
$ readlink -f ~/.nix-profile
/nix/store/mwgv8fzlr6n9kkb5nyz27fv1l66jc7nf-user-environment

...will be shown as

$ readlink ~/.nix-profile
/nix/var/nix/profiles/per-user/your-user/profile
$ readlink -f ~/.nix-profile
/nix/store/some-hash-user-environment

Contributing

This document intentionally simplifies and omits a large part of the Nix ecosystem. NixOS, Home Manager and many other tools are out of scope.

Small fixes and elaborations can be contributed via PR. Content suggestions can be done via issues.

This guide itself is a fork of Justin's original with a large number of updates and changes.

Resources

Some clear and well-written tutorials that can be found around the web:

FAQ

Why not Nix Pills?

Readers of Nix Pills should well know that the purpose of the Nix Pills are clearly stated multiple times in its contents:

These articles are not a tutorial on using Nix. Instead, we're going to walk through the Nix system to understand the fundamentals.