/nix-cookbook

A cookbook of snippets that show you how you can accomplish common tasks using the Nix expression language

Primary LanguageNix

Nix Cookbook

A collection of Nix expressions and snippets that show you how you can get common tasks done in Nix.

Target audience are those that have read the Nix Manual and found it great reference material but need more examples to be more productive with the following toolset:

Prerequisites

I recommend Nix 1.9+ (although most exercises should work in 1.8) and installing nix-repl:

$ nix-env -i nix-repl

Alternatively just start the nix-shell at the root of this repository:

$ nix-shell

Basics

To get started doing warmups the following snippets provide examples and exercises to get acquainted with the different builtin types in the Nix expression language.

Start by using the nix-repl.

Packaging

TODO: Provide examples for packaging different types of projects.

Basic introductory packaging slides for Nix can be found at Nix By Example.

Modules

TODO: Provide examples of using existing modules and writing your own custom NixOS modules.

Basic introductory NixOS slides can be found at NixOS By Example.

Deployments

TODO: Provide examples of writing your own NixOps based deployments.

Basic introductory NixOps slides can be found at NixOps By Example.

Jobs

TODO: Provide examples of writing your own Hydra jobsets and jobs.