Nix is a package manager that enables composing environments with specific versions of packages.
multiple versions of packages can be installed at once, but only one is enabled at a time.
Nix is divided into a few different components.
- nix is a package manager
- nixpkgs exposes/configures/overrides packages from a nix repo
- nixos (optional) is a linux distro built around the use of nix
The tool nix home-manager is useful for configuring user environments.
Documentation
Tutorials
See nix tutorials.
Locations
Global Config
|
/etc/nix/configuration.nix |
nixpkgs config (overrides, overlays, etc)
|
/etc/nix/nix.conf |
nix config (see man nix.conf)
|
User Config
|
~/.config/nix/config.nix |
nix config
|
~/.config/nixpkgs/config.nix |
nixpkgs config (overrides, overlays, etc)
|
~/.config/nixpkgs/overlays.nix |
overlays loaded into every nix env
|
~/.config/nixpkgs/overlays/*.nix |
overlays (loaded in every shell? loaded on demand?)
|
~/.config/nix/nix.conf |
nix config (see man nix.conf)
|
Data
|
/nix/store |
packages downloaded here
|
/var/nix/profiles/ |
user profiles/generations
|
~/.nix-profile |
active profile definition
|
~/.nix-channels |
|
Logs
|
/nix/var/log/nix |
logs stdout/stderr of nix builds
|
Overview
- Nix downloads multiple versions of a package to the nix store (version determined by file-hash)
- Package sources are determined by nix channels
- nix-envs contain a fixed set of packages/versions, and are configured in profiles
Setup
Usage
Package Management
Project Management
General
Syntax
See https://nixos.wiki/wiki/Nix_Expression_Language
Language Support