Skip to content

Commit 4ffe2ca

Browse files
committed
feat: add CGO dependencies to devshell
Required for running tests with bench and/or race enabled. Signed-off-by: Brian McGee <[email protected]>
1 parent 912dcaa commit 4ffe2ca

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

nix/devshell.nix

+16-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
];
55

66
config.perSystem = {
7+
lib,
78
pkgs,
89
config,
910
...
10-
}: {
11+
}: let
12+
inherit (pkgs.stdenv) isLinux isDarwin;
13+
in {
1114
config.devshells.default = {
1215
env = [
1316
{
@@ -20,17 +23,24 @@
2023
}
2124
];
2225

23-
packages = with pkgs;
24-
[
26+
packages = lib.mkMerge [
27+
(with pkgs; [
2528
# golang
2629
go
2730
delve
2831
pprof
2932
graphviz
30-
]
31-
++
33+
])
34+
# platform dependent CGO dependencies
35+
(lib.mkIf isLinux [
36+
pkgs.gcc
37+
])
38+
(lib.mkIf isDarwin [
39+
pkgs.darwin.cctools
40+
])
3241
# include formatters for development and testing
33-
(import ./formatters.nix pkgs);
42+
(import ./formatters.nix pkgs)
43+
];
3444

3545
commands = [
3646
{

0 commit comments

Comments
 (0)