-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevenv.nix
79 lines (74 loc) · 1.73 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
71
72
73
74
75
76
77
78
79
{ pkgs, lib, config, inputs, ... }:
let
root-dir = config.devenv.root;
in
{
# https://devenv.sh/basics/
# https://devenv.sh/packages/
packages = with pkgs; [
just
watchexec
# needed for lxml
libxml2
libxslt
libz
(buildEnv {
name = "python";
paths = [
inputs.nixpkgs-python.packages.x86_64-linux."3.8"
python39
python310
python311
python312
python313
];
ignoreCollisions = true;
})
];
scripts.run-python-version.exec = ''
#!/usr/bin/env bash
VERSION=$1
shift
COMMAND="$@"
export POETRY_VIRTUALENVS_IN_PROJECT="false"
export POETRY_VIRTUALENVS_PATH="$DEVENV_ROOT/.venvs"
export POETRY_VIRTUALENVS_PREFER_ACTIVE_PYTHON="true"
poetry -C $DEVENV_ROOT env use $VERSION
poetry -C $DEVENV_ROOT run -- $COMMAND
'';
languages.python = {
enable = true;
poetry = {
enable = true;
activate.enable = true;
install.enable = true;
install.verbosity = "little";
};
};
languages.javascript = {
# for compone-stories
bun.enable = true;
};
# https://devenv.sh/pre-commit-hooks/
pre-commit.default_stages = [ "pre-push" "manual" ];
pre-commit.hooks = {
ruff = {
enable = true;
args = [ "--config" "${root-dir}/pyproject.toml" ];
};
ruff-format.enable = true;
check-added-large-files.enable = true;
check-json.enable = true;
check-toml.enable = true;
check-yaml = {
enable = true;
excludes = [ "docs/mkdocs.yml" ];
};
trim-trailing-whitespace = {
enable = true;
excludes = [ ".*.md$" ];
};
end-of-file-fixer.enable = true;
};
# See full reference at https://devenv.sh/reference/options/
}