Nix

Install

Nix package manager

Linux

# Install Nix via the recommended multi-user installation:
sh <(curl -L https://nixos.org/nix/install) --daemon

# Single-user installation
sh <(curl -L https://nixos.org/nix/install) --no-daemon

Docker

# Start a Docker shell with Nix
docker run -it nixos/nix
# Or start a Docker shell with Nix exposing a workdir directory
mkdir workdir
docker run -it -v $(pwd)/workdir:/workdir nixos/nix
# The workdir example from above can be also used to start hacking on nixpkgs
git clone --depth=1 https://github.com/NixOS/nixpkgs.git
docker run -it -v $(pwd)/nixpkgs:/nixpkgs nixos/nix
docker> nix-build -I nixpkgs=/nixpkgs -A hello
docker> find ./result # this symlink points to the build package


# Start a Docker shell with NixOS
docker run -it --name nix-flakes -d --rm nixpkgs/nix-flakes
docker exec -it nix-flakes bash
bash-5.2# nix run github:helix-editor/helix/master

NixOS

2. Manual Installation

Partitioning

![[/DevOps/System/attachements/nix-1.png]]

Formatting

Installing

3. Upgrading

NixCommand

nixos-rebuild

nix-channel

nix-shell

nix-build

Flakes

nix flake

enable experimental features

init flake.nix

nix-command

home-manager

module imports

Reference:

Last updated