-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
72 lines (59 loc) · 2.14 KB
/
flake.nix
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
{
description = "AI-powered exploratory testing assistant";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
python3
python3Packages.pip
python3Packages.virtualenv
python3Packages.pytest
python3Packages.ruff
python3Packages.openai
python3Packages.jsonpath-ng
git
];
shellHook = ''
if [ ! -d "venv" ]; then
python -m virtualenv venv
fi
source venv/bin/activate
# Make Nix Python packages visible to IDEs
export PYTHONPATH="$PWD:${pkgs.python3Packages.jsonpath-ng}/lib/python3.11/site-packages:${pkgs.python3Packages.openai}/lib/python3.11/site-packages:$PYTHONPATH"
# Set up a green prompt to indicate nix environment
export PS1="\[\033[1;32m\][nix-dev]\[\033[0m\] \[\033[1;34m\]\w\[\033[0m\] $ "
# Git convenience function
g() {
if [ -z "$1" ]; then
echo "Usage: g <commit message>"
return 1
fi
(
set -e # Exit on any error
echo "Running ruff check --fix ."
ruff check --fix .
echo "Running git add ."
git add .
echo "Running git commit -m \"$1\""
git commit -m "$1"
echo "Running git pull --rebase"
git pull --rebase
echo "Running git push"
git push
echo "All done! 🎉"
)
}
# Export the function so it's available in subshells
export -f g
'';
};
});
}