-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathshell.nix
More file actions
35 lines (29 loc) · 820 Bytes
/
shell.nix
File metadata and controls
35 lines (29 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ pkgs ? import <nixpkgs> { } }:
let
pythonEnv = pkgs.python313.withPackages (ps: with ps; [
ps.pip
ps.numpy
ps.uv
# Include any additional Python packages here
]);
in
pkgs.mkShell {
buildInputs = [
pythonEnv
];
shellHook = ''
# Create a virtual environment with UV if it doesn't exist
if [ ! -d ".venv" ]; then
echo "Creating virtual environment with UV..."
uv venv --python ${pythonEnv}/bin/python .venv
fi
# Activate the virtual environment
source .venv/bin/activate
# Install dependencies with UV directly from pyproject.toml
if [ -f "pyproject.toml" ]; then
echo "Installing dependencies from pyproject.toml..."
uv pip install -e ".[dev]"
fi
echo "UV environment activated with Python $(python --version)"
'';
}