Nix: Difference between revisions
From wikinotes
No edit summary |
|||
Line 8: | Line 8: | ||
* '''nixos''' (optional) is a linux distro built around the use of nix | * '''nixos''' (optional) is a linux distro built around the use of nix | ||
The tool [[nix home-manager]] is useful for configuring user environments. | |||
= Documentation = | = Documentation = |
Revision as of 14:37, 30 July 2021
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
General nixos docs https://nixos.org/nix/manual/ nixos unstable docs https://nixos.org/manual/nix/unstable/introduction.html nixpkgs docs https://nixos.org/nixpkgs/manual/ nix pills https://nixos.org/nixos/nix-pills/index.html github (nix) https://github.com/NixOS/nix github (nixpkgs) https://github.com/NixOS/nixpkgs homepage https://nixos.org/ wiki https://nixos.wiki/wiki/Main_Page forum https://discourse.nixos.org/ Syntax expressions https://nixos.org/nix/manual/#chap-writing-nix-expressions builtins.*
https://nixos.org/nix/manual/#ssec-builtins nixpkgs.lib.*
https://github.com/NixOS/nixpkgs/blob/master/lib
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/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
Usage
nix tutorials nix install nix configuration nixpkgs configuration nix usage
nix packages nix shells
nix channels nix troubleshooting nix tips and tricks
Syntax
See https://nixos.wiki/wiki/Nix_Expression_Language
nix files nix datatypes nix variables nix functions nix operators nix conditionals
Language Support
nix libraries nix python nix ruby nix java