Skip to content

kravemir/nix-shells

Repository files navigation

nix-shells

Repository contains configurations for nix-shell to create virtual environment with specific software versions.

Usage

Basic usage:

# assuming this repository is cloned in ~/nix-shells

# enter specific shell using one of following commands
nix-shell ~/nix-shells/node-v16.12.0.nix
nix-shell ~/nix-shells/node-v16.15.0.nix

# instantiate shells to prevent GC cleaning them (or to build them in advance)
cd ~/nix-shells/ && ./instantiate-shells.sh

Automatic shell loading

To automatically load a shell when entering a project directory, install direnv and execute following in the project directory:

# configure direnv profile to use nix
echo 'use_nix' > .envrc

# reuse shell
ln -s ~/nix-shells/node-v16.12.0.nix shell.nix

# allow direnv in current directory
direnv allow .

See full docs.

Documentation

Useful documentation used to build this and work with nix shells: