Skip to content

Commit 6ee5ae4

Browse files
committed
nix flake build static with sqlite support
1 parent 65cd3f5 commit 6ee5ae4

File tree

2 files changed

+33
-25
lines changed

2 files changed

+33
-25
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ security-check:
746746
go run $(GOVULNCHECK_PACKAGE) -show color ./...
747747

748748
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
749-
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
749+
CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w -extldflags "-static" $(LDFLAGS)' -o $@
750750

751751
.PHONY: release
752752
release: frontend generate release-windows release-linux release-darwin release-freebsd release-copy release-compress vendor release-sources release-check

flake.nix

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,41 @@
1111
pkgs = nixpkgs.legacyPackages.${system};
1212
in
1313
{
14-
devShells.default = pkgs.mkShell {
15-
buildInputs = with pkgs; [
16-
# generic
17-
git
18-
git-lfs
19-
gnumake
20-
gnused
21-
gnutar
22-
gzip
14+
devShells.default =
15+
with pkgs;
16+
let
17+
go = go_1_24;
18+
in
19+
pkgs.mkShell {
20+
buildInputs = [
21+
# generic
22+
git
23+
git-lfs
24+
gnumake
25+
gnused
26+
gnutar
27+
gzip
2328

24-
# frontend
25-
nodejs_22
29+
# frontend
30+
nodejs_22
2631

27-
# linting
28-
python312
29-
uv
32+
# linting
33+
python312
34+
uv
3035

31-
# backend
32-
go_1_24
33-
gofumpt
34-
sqlite
35-
];
36-
shellHook = ''
37-
export GO="${pkgs.go_1_24}/bin/go"
38-
export GOROOT="${pkgs.go_1_24}/share/go"
39-
'';
40-
};
36+
# backend
37+
go
38+
glibc.static
39+
gofumpt
40+
sqlite
41+
];
42+
CFLAGS = "-I${glibc.static.dev}/include";
43+
LDFLAGS = "-L ${glibc.static}/lib";
44+
GO = "${go}/bin/go";
45+
GOROOT = "${go}/share/go";
46+
47+
TAGS = "sqlite sqlite_unlock_notify";
48+
};
4149
}
4250
);
4351
}

0 commit comments

Comments
 (0)