Skip to content

shahruk10/nixshells

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flake-Based Development Templates (Research / Python / ML)

This repository provides Nix flake templates for quickly bootstrapping reproducible development environments.

Instead of copying flake.nix files around, you can now initialize new projects directly from this repo using nix flake init -- just like official Nix templates.


Requirements

Install Nix

If you don’t already have Nix installed:

sh <(curl -L https://nixos.org/nix/install) --daemon

Then enable flakes (if not already enabled):

mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf

Using This Repo as a Template Source

This repository is structured as a template registry. Each subdirectory represents a template that can be used with nix flake init.

Current templates:

python/default

Create a New Project

Python Dev Environment

From any empty project directory, run:

nix flake init -t github:shahruk10/nixshells#python

Example:

mkdir my-ml-project
cd my-ml-project

nix flake init -t github:shahruk10/nixshells#python

This will generate:

flake.nix
flake.lock
.envrc

If you have direnv installed (very much recommended), the .envrc file will direct it to automatically activate the shell defined in the flake.nix with your development environment.

There are multiple shells defined in the python template, one without CUDA support, and one without. Enable which ever one you need. You can view the ones available by running:

nix flake show

Each shell will automatically create a .venv directory and initialize a virtual python environment there. You can install almost all python dependencies via pip afterwards.


Updating the Environment

To modify system packages:

  1. Edit flake.nix
  2. Add or remove packages from buildInputs
  3. Reload the shell:
exit
nix develop

To update pinned dependencies:

nix flake update

Resources


About

Frequently used nix shells for Python, CUDA and more.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors