Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


Nix

Nix is a purely functional package manager that aims to make package management reliable and reproducible.

Tip

Although this cheat sheet is categorized as "NixOS-based", the Nix package manager can be installed on any distribution.

Reference(s)

Table of contents


Install

Reference(s)

Prerequisite(s)

  • "Multi-user" installation (recommended):
    $ sh <(curl -L https://nixos.org/nix/install) --daemon
    

Config

  • Switch to a previous Nix version (e.g. 2.4):

    $ cd /tmp
    $ nix build 'nix/2.4'
    $ nix-env -i ./result
    
    Then in a new terminal (or after $ hash -r in a Bash shell, or $ rehash in a Zsh shell):
    $ nix --version
        > nix (Nix) 2.4
    

  • TODO: Switch to NixOS Nix version:


Use

  • Get help:

    $ nix --help
    

  • Search a Nix package:

    $ nix-env -qaP '.*package_name.*'
    
    or
    $ nix search package_name
    

  • Show a package description:

    $ nix-env -qa --description '.*package_name.*'
    

WIP


If this cheat sheet has been useful to you, then please consider leaving a star here.