-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.nix
More file actions
78 lines (69 loc) · 3.47 KB
/
Copy pathshell.nix
File metadata and controls
78 lines (69 loc) · 3.47 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
pkgs ? import <nixpkgs> { },
}:
pkgs.mkShell {
buildInputs = with pkgs; [
# Python 3.13
python313
python313Packages.pip
python313Packages.venvShellHook # For automatic virtual environment
python313Packages.hatchling # Build system requirement
# Development tools
black # Code formatter
python313Packages.flake8 # Linter
python313Packages.mypy # Type checker
python313Packages.pytest # Testing framework
mkdocs
gum
];
# Set environment variables
VIRTUAL_ENV = "./.venv";
PYTHONPATH = "${placeholder "out"}/lib/python3.13/site-packages";
# Create shell hook to initialize virtual environment if needed
shellHook = ''
gum style --foreground="#ebba34" "█████▄ ▄▄ ▄▄ ▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄ ▄▄▄▄ ";
gum style --foreground="#ebba34" "██▄▄█▀ ██ ███▄██ ██ ██▄▄ ███▄▄ ";
gum style --foreground="#ebba34" "██ ██ ██ ▀██ ██ ██▄▄▄ ▄▄██▀ ";
gum style --foreground="#f0c348" "▄▄▄▄▄▄ ▄▄ ▄▄▄▄▄▄▄ ▄▄ ▄▄ ▄▄ ";
gum style --foreground="#f0c348" "███▀▀██▄ ██ █████▀▀▀ ██ ██ ██ ";
gum style --foreground="#f0c348" "███ ███ ▄█▀█▄ ██ ██ ▄█▀█▄ ██ ▄███▄ ████▄ ▄█▀█▄ ████▄ ▀████▄ ████▄ ▄█▀█▄ ██ ██ ";
gum style --foreground="#f0c348" "███ ███ ██▄█▀ ██▄██ ██▄█▀ ██ ██ ██ ██ ██ ██▄█▀ ██ ▀▀ ▀████ ██ ██ ██▄█▀ ██ ██ ";
gum style --foreground="#f0c348" "██████▀ ▀█▄▄▄ ▀█▀ ▀█▄▄▄ ██ ▀███▀ ████▀ ▀█▄▄▄ ██ ███████▀ ██ ██ ▀█▄▄▄ ██ ██ ";
echo ""
gum style --foreground="#00ffcc" "All packages have been downloaded."
gum style --foreground="#00ffcc" "Python version: $(gum style --foreground="#ccff00" $(python --version))"
gum style --foreground="#00deb1" "(if it isn't 3.13 something went wrong, but as long as it's above 3.11 it should be fine.)"
echo ""
# Detect shell type and activate the right venv script
if [ -n "$FISH_VERSION" ]; then
# Fish shell
VENV_ACTIVATE=".venv/bin/activate.fish"
else
# Default to POSIX shell
VENV_ACTIVATE=".venv/bin/activate"
fi
# Check if virtual environment exists, create it if it doesn't
if [ ! -d ".venv" ]; then
echo "Creating a venv since one doesn't exist"
python -m venv .venv
source $VENV_ACTIVATE
pip install --upgrade pip
echo "Everything looks alright"
else
echo "venv already exists, activating that"
source $VENV_ACTIVATE
fi
# Install the package in development mode if not already installed
if ! python -c "import pintes" &> /dev/null; then
echo "Installing Pintes in development mode (changes are applied instantly)"
pip install -e .
fi
echo "venv activated: $VIRTUAL_ENV"
echo ""
echo "to run the demo, use:"
echo "cd demo && python demo.py"
echo ""
echo "current packages installed:"
pip list
'';
}