-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
70 lines (63 loc) · 2.11 KB
/
Copy pathflake.nix
File metadata and controls
70 lines (63 loc) · 2.11 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
{
description = "Slung";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
zig-overlay.url = "github:mitchellh/zig-overlay";
zig-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
flake-utils,
zig-overlay,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ zig-overlay.overlays.default ];
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Use Zig 0.15.2 from the overlay
zigpkgs."0.15.2"
# Additional libraries
pkg-config
# File watching for hot reload
entr
watchexec
];
shellHook = ''
echo "Zig version: $(zig version)"
echo "Development environment!"
echo ""
echo "Commands:"
echo " zig build run - Build and run once"
echo " zig-watch - Watch files and auto-rebuild/run"
echo " zig-watch-test - Watch files and auto-rebuild/test"
echo ""
# Create helper scripts for file watching
cat > zig-watch << 'EOF'
#!/usr/bin/env bash
echo "Watching Zig files for changes... (Press Ctrl+C to stop)"
find src -name "*.zig" | entr -c -r zig build run
EOF
chmod +x zig-watch
alias zig-watch=./zig-watch
cat > zig-watch-test << 'EOF'
#!/usr/bin/env bash
echo "Watching Zig files for changes (test)... (Press Ctrl+C to stop)"
find src -name "*.zig" | entr -c zig build test
EOF
chmod +x zig-watch-test
alias zig-watch-test=./zig-watch-test
'';
};
}
);
}