-
Notifications
You must be signed in to change notification settings - Fork 0
/
devenv.nix
70 lines (66 loc) · 1.45 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
66
67
68
69
70
{
pkgs,
lib,
config,
...
}: {
pre-commit = {
hooks = {
check-merge-conflicts.enable = true;
check-added-large-files.enable = true;
editorconfig-checker.enable = true;
ruff = {
enable = true;
entry = "ruff check --fix";
};
poetry-check.enable = true;
mypy = {
enable = true;
settings.binPath = ''.venv/bin/mypy'';
excludes = ["tests/.*"];
};
};
};
enterTest = ''
pytest --cov=./ --cov-report=xml --cache-clear --new-first --failed-first --verbose
'';
scripts = {
run-docs = {
exec = ''
mkdocs serve
'';
description = "Run the documentation server";
};
pi = {
exec = ''
${pkgs.uv} pip $@
'';
description = "Replacing pip with uv pip";
};
};
languages.python = {
enable = true;
uv = {
enable = true;
package = pkgs.uv;
};
poetry = {
enable = true;
activate.enable = true;
install = {
installRootPackage = true;
enable = true;
quiet = true;
};
};
};
enterShell = ''
echo
echo 🦾 Useful project scripts:
echo 🦾
${pkgs.gnused}/bin/sed -e 's| |••|g' -e 's|=| |' <<EOF | ${pkgs.util-linuxMinimal}/bin/column -t | ${pkgs.gnused}/bin/sed -e 's|^|🦾 |' -e 's|••| |g'
${lib.generators.toKeyValue {} (lib.mapAttrs (name: value: value.description) config.scripts)}
EOF
echo
'';
}