-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevenv.nix
98 lines (84 loc) · 2.2 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{ pkgs, lib, config, inputs, ... }:
{
name = "dmv";
# https://devenv.sh/basics/
env = { GREET = "🛠️ Let's hack "; };
# https://devenv.sh/scripts/
scripts.hello.exec = "echo $GREET";
scripts.cat.exec = ''
bat "$@";
'';
# This script is temporary due to two problems:
# 1. `cz` requires a personal github token to publish a release https://commitizen-tools.github.io/commitizen/tutorials/github_actions/
# 2. `cz bump` fails to sign in a terminal: https://github.com/commitizen-tools/commitizen/issues/1184
scripts.release = {
exec = ''
rm CHANGELOG.md
cz bump --files-only --check-consistency
git tag $(python -c "from src.dmv import __version__; print(__version__)")
'';
description = ''
Release a new version and update the CHANGELOG.
'';
};
# https://devenv.sh/packages/
packages = with pkgs; [ nixfmt-rfc-style bat jq tealdeer git ];
languages = {
# pyright requires npm
javascript = {
enable = true;
package = pkgs.nodejs_21;
npm = {
enable = true;
package = pkgs.nodejs_21;
install.enable = true;
};
};
python = {
enable = true;
venv = {
enable = true;
requirements = ''
pdm
python-lsp-server
importmagic
epc
black
'';
};
};
};
# Java is required for PySpark
languages.java.enable = true;
languages.java.jdk.package = pkgs.jdk8; # Java version running on AWS Glue
enterShell = ''
hello
pdm install
'';
# https://devenv.sh/pre-commit-hooks/
pre-commit.hooks = {
nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
excludes = [ ".devenv.flake.nix" ];
};
yamllint = {
enable = true;
settings.preset = "relaxed";
settings.configuration = ''
---
extends: relaxed
rules:
line-length: disable
'';
};
ruff.enable = true;
editorconfig-checker.enable = true;
};
# Make diffs fantastic
difftastic.enable = true;
# https://devenv.sh/integrations/dotenv/
dotenv.enable = true;
# https://devenv.sh/integrations/codespaces-devcontainer/
devcontainer.enable = true;
}