From 4ffe2ca16c2a125f97f17e0740dc44d7c95f80a9 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Thu, 9 May 2024 11:50:37 +0100 Subject: [PATCH] feat: add CGO dependencies to devshell Required for running tests with bench and/or race enabled. Signed-off-by: Brian McGee --- nix/devshell.nix | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/nix/devshell.nix b/nix/devshell.nix index 21d36670..ded57147 100644 --- a/nix/devshell.nix +++ b/nix/devshell.nix @@ -4,10 +4,13 @@ ]; config.perSystem = { + lib, pkgs, config, ... - }: { + }: let + inherit (pkgs.stdenv) isLinux isDarwin; + in { config.devshells.default = { env = [ { @@ -20,17 +23,24 @@ } ]; - packages = with pkgs; - [ + packages = lib.mkMerge [ + (with pkgs; [ # golang go delve pprof graphviz - ] - ++ + ]) + # platform dependent CGO dependencies + (lib.mkIf isLinux [ + pkgs.gcc + ]) + (lib.mkIf isDarwin [ + pkgs.darwin.cctools + ]) # include formatters for development and testing - (import ./formatters.nix pkgs); + (import ./formatters.nix pkgs) + ]; commands = [ {