Nix is

  • An operating system NixOS
  • A functional programming language called Nix. Because it is functional, there are no side-effects
  • A package manager

Through nix, we can generated declarative deterministic builds and development environments. NixOS is an operative system built this way, where the whole OS is generated by evaluating a nix file. NixOS also has rollbacks incorporated, so it is very hard to break unlike other Linux distros. It also solves two big problems with byilding applications: dependency hell and reproducibility.

Nix flavours

I decided on the flavours name after catppuccin, my favourite colorscheme so far.

Flavours of Nix are variants of the nix language/package, brought up by the awesomeness of open source

  • lix: Community-first modern implementation of Nix, which started after some community-issues.
  • tvix: Rust re-implementation of the Nix package manager. Still WIP, but relates to Devenv, and one of the devenv devs is also the creator of nix.dev. Likely might become a main way to use Nix in the future.

Installing Nix

The recommended way to install Nix is by using the lix installer, which is open source.

For an existing installation, it can be upgraded running the following code

sudo --preserve-env=PATH nix run \
     --experimental-features "nix-command flakes" \
     --extra-substituters https://cache.lix.systems --extra-trusted-public-keys "cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o=" \
     'git+https://git.lix.systems/lix-project/lix?ref=refs/tags/2.91.1' -- \
     upgrade-nix \
     --extra-substituters https://cache.lix.systems --extra-trusted-public-keys "cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o="

Another popular way to go about it is to use the Determinate Systems installer.

Installing packages in non-NixOS systems

Besides using flakes and devShells to control environments, the best way (currently) to install a package in an user profile is by running

nix profile install nixpkgs#<package>

This can also use a github or local repo, including a flake-based one

nix profile install github:user/repo#package

Resources

nix.dev