-
Notifications
You must be signed in to change notification settings - Fork 482
Expand file tree
/
Copy pathdevenv.nix
More file actions
157 lines (140 loc) · 4.39 KB
/
devenv.nix
File metadata and controls
157 lines (140 loc) · 4.39 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
{ inputs
, pkgs
, lib
, config
, options
, ...
}:
let
inherit (pkgs.stdenv) system;
in
{
env = {
# The path to the eval cache database (for migrations)
DATABASE_URL = "sqlite:.devenv/nix-eval-cache.db";
# Use sqlite from nixpkgs to match the version used by Nix
LIBSQLITE3_SYS_USE_PKG_CONFIG = "1";
RUST_LOG = "devenv=debug";
RUST_LOG_SPAN_EVENTS = "full";
};
# Configure Claude Code
claude.code = {
enable = true;
commands = {
bump-nix = ''
Bump the nix input in both devenv.lock and flake.lock
1. Run `devenv update nix` and `nix flake update nix` in parallel
2. Commit the changes
'';
release = ''
Release devenv version $ARGUMENTS
1. Update version in Cargo.toml to $ARGUMENTS using `cargo set-version`
2. Run `cargo check` to update Cargo.lock
3. Put today's date in CHANGELOG.md replacing "(unreleased)"
4. Create a new "## X.Y.Z (unreleased)" section above the released version in CHANGELOG.md
5. If this is a major version bump (X.Y.0, not X.Y.Z patch):
- Generate a blog post in docs/src/blog/posts/
- Follow the naming convention: devenv-vX.Y-short-description.md
- Use existing blog posts as reference for format and style
6. Commit the changes
7. Push the commit(s) to GitHub
8. Create a GitHub release with `gh release create v$ARGUMENTS --title "v$ARGUMENTS" --latest --notes "<changelog for this release>"`
9. Bump version to next patch with `cargo set-version --bump patch`
10. Run `devenv tasks run devenv:crate2nix` to regenerate Cargo.nix
11. Commit with message "Next release is <new version>"
12. Push to GitHub
13. At the end, tell the user that the package still needs to be bumped in nixpkgs:
- The package is at pkgs/by-name/de/devenv/package.nix
'';
};
permissions = {
WebFetch = {
allow = [
"domain:github.com"
"domain:docs.rs"
"domain:docs.anthropic.com"
];
};
Bash = {
allow = [
"rg:*"
"cargo test:*"
"nix search:*"
"devenv-run-tests:*"
"nix-instantiate:*"
];
};
};
};
# Project dependencies
packages = [
inputs.nix.packages.${system}.nix # Required for integration tests
pkgs.git
pkgs.xorg.libxcb
pkgs.yaml2json
pkgs.tesh
pkgs.watchexec
pkgs.openssl
pkgs.sqlite
pkgs.sqlx-cli
pkgs.tig
pkgs.process-compose
pkgs.cargo-outdated # Find outdated crates
pkgs.cargo-machete # Find unused crates
pkgs.cargo-edit # Adds the set-version command
pkgs.cargo-insta # Snapshot testing for Rust
pkgs.cargo-nextest # Test runner with process isolation
pkgs.protobuf # snix
pkgs.dbus # secretspec
pkgs.nixd # LSP for devenv lsp command
inputs.crate2nix.packages.${system}.default # Generate Cargo.nix from Cargo.lock
];
languages = {
# For developing the Nix modules
nix.enable = true;
# For developing the devenv CLI
rust.enable = true;
};
devcontainer = {
enable = true;
settings.customizations.vscode.extensions = [ "jnoortheen.nix-ide" ];
};
difftastic.enable = true;
scripts.devenv-generate-languages-example = {
description = "Generate an example enabling every supported language";
exec = ''
cat > examples/supported-languages/devenv.nix <<EOF
# DO NOT MODIFY.
# This file was generated by devenv-generate-languages-example.
{ pkgs, ... }: {
# Enable all languages tooling!
${lib.concatStringsSep "\n " (
map (lang: "languages.${lang}.enable = true;") (builtins.attrNames options.languages)
)}
# If you're missing a language, please contribute it by following examples of other languages <3
}
EOF
'';
};
tasks."devenv:crate2nix" = {
description = "Generate Cargo.nix from Cargo.lock";
exec = "crate2nix generate -h nix/crate-hashes.json";
execIfModified = [ "Cargo.lock" ];
};
git-hooks.package = pkgs.prek;
git-hooks.excludes = [ "Cargo.nix" ];
git-hooks.hooks = {
nixpkgs-fmt.enable = true;
rustfmt.enable = true;
markdownlint = {
settings.configuration = {
MD013 = {
line_length = 120;
};
MD033 = false;
MD034 = false;
};
};
};
}
# reload-test