-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdevenv.nix
65 lines (60 loc) · 1.41 KB
/
devenv.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
{ pkgs, config, ... }:
{
env = {
UV_PYTHON_DOWNLOADS = "never";
};
# https://devenv.sh/packages/
packages = with pkgs; [
just
mdsh
];
# https://devenv.sh/languages/
languages.python = {
enable = true;
venv.enable = true;
uv = {
enable = true;
sync.enable = true;
};
};
scripts.project-version = {
exec = ''
import tomllib
with open("pyproject.toml", "rb") as f:
pyproject = tomllib.load(f)
print("v" + pyproject["project"]["version"], end="")
'';
package = config.languages.python.package;
};
# https://devenv.sh/tests/
enterTest = "python -m pytest";
# https://devenv.sh/pre-commit-hooks/
pre-commit.default_stages = [
"pre-push"
"manual"
];
pre-commit.hooks = {
ruff = {
enable = true;
args = [ "--select" "I" ];
excludes = [ "migrations/" ];
};
ruff-format.enable = true;
check-added-large-files.enable = true;
check-json.enable = true;
check-toml.enable = true;
check-yaml.enable = true;
trim-trailing-whitespace = {
enable = true;
excludes = [ ".*.md$" ];
};
end-of-file-fixer.enable = true;
cli-help-output = {
enable = true;
name = "Update CLI help output in README.md";
entry = "bash -c '2>/dev/null mdsh -i'";
files = "README\.md";
};
};
# See full reference at https://devenv.sh/reference/options/
}