Skip to content

Commit 70d85f3

Browse files
macalinaoclaude
andcommitted
Migrate from Nix flake to devenv and add formatting hooks
Replace Nix flake-based dev environment with devenv for simpler setup. Add git hooks for automatic code formatting: - nixfmt-rfc-style for Nix files - shfmt for shell scripts - biome for JS/TS/CSS files - prettier for markdown/yaml/json files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent ff99e47 commit 70d85f3

File tree

11 files changed

+319
-261
lines changed

11 files changed

+319
-261
lines changed

.envrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
use flake
1+
export DIRENV_WARN_TIMEOUT=20s
2+
3+
eval "$(devenv direnvrc)"
4+
5+
# The use_devenv function supports passing flags to the devenv command
6+
# For example: use devenv --impure --option services.postgres.enable:bool true
7+
use devenv

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
.devenv/
2+
.claude/settings.local.json
13
.direnv/
24
.pre-commit-config.yaml
35
/result
46

57
node_modules/
8+
.devenv.flake.nix

devenv.lock

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"nodes": {
3+
"devenv": {
4+
"locked": {
5+
"dir": "src/modules",
6+
"lastModified": 1749243968,
7+
"owner": "cachix",
8+
"repo": "devenv",
9+
"rev": "f46d6d8f67a44a2a9be862a78a179cfe1bd317fb",
10+
"type": "github"
11+
},
12+
"original": {
13+
"dir": "src/modules",
14+
"owner": "cachix",
15+
"repo": "devenv",
16+
"type": "github"
17+
}
18+
},
19+
"flake-compat": {
20+
"flake": false,
21+
"locked": {
22+
"lastModified": 1747046372,
23+
"owner": "edolstra",
24+
"repo": "flake-compat",
25+
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
26+
"type": "github"
27+
},
28+
"original": {
29+
"owner": "edolstra",
30+
"repo": "flake-compat",
31+
"type": "github"
32+
}
33+
},
34+
"git-hooks": {
35+
"inputs": {
36+
"flake-compat": "flake-compat",
37+
"gitignore": "gitignore",
38+
"nixpkgs": [
39+
"nixpkgs"
40+
]
41+
},
42+
"locked": {
43+
"lastModified": 1747372754,
44+
"owner": "cachix",
45+
"repo": "git-hooks.nix",
46+
"rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46",
47+
"type": "github"
48+
},
49+
"original": {
50+
"owner": "cachix",
51+
"repo": "git-hooks.nix",
52+
"type": "github"
53+
}
54+
},
55+
"gitignore": {
56+
"inputs": {
57+
"nixpkgs": [
58+
"git-hooks",
59+
"nixpkgs"
60+
]
61+
},
62+
"locked": {
63+
"lastModified": 1709087332,
64+
"owner": "hercules-ci",
65+
"repo": "gitignore.nix",
66+
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
67+
"type": "github"
68+
},
69+
"original": {
70+
"owner": "hercules-ci",
71+
"repo": "gitignore.nix",
72+
"type": "github"
73+
}
74+
},
75+
"nixpkgs": {
76+
"locked": {
77+
"lastModified": 1746807397,
78+
"owner": "cachix",
79+
"repo": "devenv-nixpkgs",
80+
"rev": "c5208b594838ea8e6cca5997fbf784b7cca1ca90",
81+
"type": "github"
82+
},
83+
"original": {
84+
"owner": "cachix",
85+
"ref": "rolling",
86+
"repo": "devenv-nixpkgs",
87+
"type": "github"
88+
}
89+
},
90+
"root": {
91+
"inputs": {
92+
"devenv": "devenv",
93+
"git-hooks": "git-hooks",
94+
"nixpkgs": "nixpkgs",
95+
"pre-commit-hooks": [
96+
"git-hooks"
97+
]
98+
}
99+
}
100+
},
101+
"root": "root",
102+
"version": 7
103+
}

devenv.nix

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
pkgs,
3+
lib,
4+
config,
5+
inputs,
6+
...
7+
}:
8+
9+
{
10+
# https://devenv.sh/packages/
11+
packages = with pkgs; [
12+
git
13+
coreutils-full
14+
nixfmt-rfc-style
15+
shfmt
16+
biome
17+
];
18+
19+
# https://devenv.sh/languages/
20+
languages.javascript = {
21+
enable = true;
22+
package = pkgs.nodejs_22;
23+
bun.enable = true;
24+
pnpm = {
25+
enable = true;
26+
package = pkgs.pnpm.override {
27+
nodejs = pkgs.nodejs_22;
28+
};
29+
};
30+
};
31+
32+
# https://devenv.sh/git-hooks/
33+
git-hooks.hooks = {
34+
# Format Nix files
35+
nixfmt-rfc-style = {
36+
enable = true;
37+
entry = "${pkgs.nixfmt-rfc-style}/bin/nixfmt";
38+
files = "\.nix$";
39+
};
40+
# Format shell scripts
41+
shfmt = {
42+
enable = true;
43+
entry = "${pkgs.shfmt}/bin/shfmt -w";
44+
files = "\.(sh|bash|zsh)$";
45+
};
46+
# Format JavaScript/TypeScript/JSON/CSS files with Biome
47+
biome = {
48+
enable = true;
49+
entry = "${pkgs.biome}/bin/biome format --write";
50+
files = "\.(js|jsx|ts|tsx|css|graphql)$";
51+
excludes = [ "config/.*\\.json$" ];
52+
};
53+
# Run prettier on other files that Biome doesn't support
54+
prettier = {
55+
enable = true;
56+
entry = "${pkgs.nodePackages.prettier}/bin/prettier --write --ignore-unknown";
57+
files = "\.(md|html|yml|yaml|json|jsonc)$";
58+
};
59+
};
60+
}

devenv.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
2+
inputs:
3+
nixpkgs:
4+
url: github:cachix/devenv-nixpkgs/rolling
5+
# If you're using non-OSS software, you can set allowUnfree to true.
6+
# allowUnfree: true
7+
8+
# If you're willing to use a package that's vulnerable
9+
# permittedInsecurePackages:
10+
# - "openssl-1.1.1w"
11+
12+
# If you have more than one devenv you can merge them
13+
#imports:
14+
# - ./backend

flake.lock

Lines changed: 0 additions & 96 deletions
This file was deleted.

flake.nix

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)