Skip to content

Commit 4411b94

Browse files
authored
Merge pull request #23 from ryanbas21/feat/flake-nix
feat: add flake.nix for reproducible dev environment
2 parents 359a5c7 + 4ba462c commit 4411b94

4 files changed

Lines changed: 96 additions & 0 deletions

File tree

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ elm-stuff/
1010
*.zip
1111
packged/
1212
out-tsc/
13+
.direnv/
14+
.corepack/

flake.lock

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
description = "wolfcola-devtools development environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6+
systems.url = "github:nix-systems/default";
7+
};
8+
9+
outputs =
10+
{
11+
nixpkgs,
12+
systems,
13+
...
14+
}:
15+
let
16+
eachSystem = nixpkgs.lib.genAttrs (import systems);
17+
in
18+
{
19+
devShells = eachSystem (
20+
system:
21+
let
22+
pkgs = nixpkgs.legacyPackages.${system};
23+
in
24+
{
25+
default = pkgs.mkShell {
26+
packages = with pkgs; [
27+
nodejs_24
28+
corepack
29+
lefthook
30+
];
31+
32+
shellHook = ''
33+
corepack enable --install-directory "$PWD/.corepack" >/dev/null 2>&1
34+
export PATH="$PWD/.corepack:$PATH"
35+
36+
if [ ! -d node_modules ]; then
37+
echo "node_modules missing — running pnpm install..."
38+
pnpm install
39+
elif [ pnpm-lock.yaml -nt node_modules ]; then
40+
echo "pnpm-lock.yaml is newer than node_modules — running pnpm install..."
41+
pnpm install
42+
fi
43+
'';
44+
};
45+
}
46+
);
47+
48+
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt);
49+
};
50+
}

0 commit comments

Comments
 (0)