-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
160 lines (134 loc) · 3.72 KB
/
flake.nix
File metadata and controls
160 lines (134 loc) · 3.72 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
158
159
160
{
description = "Prism - Development Environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
};
go = pkgs.go;
devTools = with pkgs; [
# Go development
go
gopls
gotools
go-tools
delve
# Build tools
gnumake
gcc
pkg-config
# Templ + Tailwind
templ
nodejs_20
# Development utilities
air
curl
jq
git
# Nix tools
nixpkgs-fmt
nil
# Playwright for E2E testing
playwright-driver
];
# Playwright runtime dependencies
playwrightRuntimeDeps = with pkgs; [
glib
nss
nspr
dbus
atk
at-spi2-core
at-spi2-atk
cups
libdrm
expat
libxkbcommon
xorg.libxcb
xorg.libX11
xorg.libXcomposite
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXrandr
mesa
libgbm
pango
cairo
alsa-lib
];
shellHook = ''
echo "Prism development environment"
echo ""
echo "Commands:"
echo " make dev - Start dev server with hot reload"
echo " make build - Build the binary"
echo " make test - Run tests"
echo " make generate - Generate templ files"
echo " make css - Build Tailwind CSS"
echo ""
echo "Go version: $(go version)"
echo ""
# Go environment
export GOPATH="$PWD/.go"
export GOCACHE="$PWD/.go/cache"
export GOMODCACHE="$PWD/.go/mod"
export PATH="$GOPATH/bin:$PWD/node_modules/.bin:$PATH"
export CGO_ENABLED=0
export GO111MODULE=on
mkdir -p .go/{bin,cache,mod}
# Playwright runtime dependencies
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath playwrightRuntimeDeps}:$LD_LIBRARY_PATH"
export PS1='\[\033[1;35m\][prism]\[\033[0m\] \[\033[1;32m\]\u@\h\[\033[0m\]:\[\033[1;36m\]\w\[\033[0m\]\$ '
'';
in
{
devShells.default = pkgs.mkShell {
buildInputs = devTools ++ playwrightRuntimeDeps;
inherit shellHook;
};
packages.default = pkgs.buildGoModule {
pname = "prism";
version = "0.1.0";
src = ./.;
vendorHash = null;
env.CGO_ENABLED = 0;
ldflags = [
"-s" "-w"
"-X github.com/withObsrvr/prism/cmd/prism.version=${self.shortRev or "dev"}"
];
meta = with pkgs.lib; {
description = "Prism";
license = licenses.mit;
};
};
packages.docker = pkgs.dockerTools.buildLayeredImage {
name = "prism";
tag = "latest";
contents = with pkgs; [
self.packages.${system}.default
cacert
tzdata
];
config = {
Cmd = [ "${self.packages.${system}.default}/bin/prism" "serve" ];
ExposedPorts = {
"8080/tcp" = {};
};
Env = [
"PORT=8080"
];
};
};
formatter = pkgs.nixpkgs-fmt;
});
}