Nix (the purely functional package manager)

#nix Nix is a package manager available for Linux and MacOS (and apparently it can work on Windows via WSL too).

Some key features of Nix mentioned in this Nix guide are:

  • Multiple versions: You can have multiple versions of a package installed at the same time. This is due to path based exactly on what is being built being used for install paths (see also this Tweag article on content/input-addressed storage).
  • Complete dependencies: All dependencies have to be declared which helps eliminate issues like “It works on my system”.
  • Non-priveleged users can install software: A useful side-effect of the way Nix works, not particularly useful to me personally but still.
  • Atomic upgrades and rollbacks: It is easy to roll-back to a previous version of software, or even of the whole system if using NixOS.
  • Garbage collection: nix-collect-garbage will delete any unused packages.
  • Functional package language: The language defining the packages is a functional language. Here is an example:
let
  my-python-packages = python-packages: with python-packages; [
    matplotlib
    numpy
    # other python packages you want
  ]; 
  python-with-my-packages = python3.withPackages my-python-packages;
in
{
  # Let Home Manager install and manage itself.
  programs.home-manager.enable = true;
  
  home.packages = with pkgs; [
    python-with-my-packages
  ]
}

For more information see the guide.

Links to this page
  • Switching from macOS to NixOS (Talk, Sweden Meetup)

    I had begun to use Nix (the purely functional package manager) and was really impressed by it. I was also curious about using Linux day-to-day (having used Windows then macOS so far), but I wasn’t particularly impressed with Ubuntu, Arch or anything else as it seemed likely to become tricky to manage if I was trying out different programs and setups in order to make it work for me. I thought those Linux distros (and indeed any Linux distro) would get messy. My MacBook had also gotten messy - in the sense that there was a lot on there (like old Haskell stack versions) that I didn’t use anymore but didn’t quite have the time to work out how to best uninstall it all. NixOS offered the solution - all my programs and system configuration could be defined in two text files with the ability to easily experiment and rollback if need be - ideal.

  • Switching from macOS to NixOS (Talk, Auckland Meetup)

    I had begun to use Nix (the purely functional package manager) and was really impressed by it. I was also curious about using Linux day-to-day (having used Windows then macOS so far), but I wasn’t particularly impressed with Ubuntu, Arch or anything else as it seemed likely to become tricky to manage if I was trying out different programs and setups in order to make it work for me. I thought those Linux distros (and indeed any Linux distro) would get messy. My MacBook had also gotten messy - in the sense that there was a lot on there (like old Haskell stack versions) that I didn’t use anymore but didn’t quite have the time to work out how to best uninstall it all. NixOS offered the solution - all my programs and system configuration could be defined in two text files with the ability to easily experiment and rollback if need be - ideal.

  • NixOS

    #nix NixOS, the “Purely Functional Linux Distribution” is an opinionated Linux distribution. It is based around the Nix package manager with similar advantages to using Nix, but applied to the whole system configuration rather than just installed packages.

  • NixOS

    #nix NixOS, the “Purely Functional Linux Distribution” is an opinionated Linux distribution. It is based around the Nix package manager with similar advantages to using Nix, but applied to the whole system configuration rather than just installed packages.

#nix