From e9c060893ad966ba8803591a985cfdc10b610ffa Mon Sep 17 00:00:00 2001 From: adisbladis Date: Tue, 3 Feb 2026 14:11:12 +1300 Subject: [PATCH] direnv: Disable Cgo to build a static executable To fix segmentation faults happening because of an incompatible libc when setting `LD_LIBRARY_PATH`. This was originally reported to pyproject.nix in https://github.com/pyproject-nix/pyproject.nix/issues/405 but is a nixpkgs issue. --- pkgs/by-name/di/direnv/package.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/by-name/di/direnv/package.nix b/pkgs/by-name/di/direnv/package.nix index cdecb982af97..6c1a1b8ffe7f 100644 --- a/pkgs/by-name/di/direnv/package.nix +++ b/pkgs/by-name/di/direnv/package.nix @@ -25,6 +25,9 @@ buildGoModule rec { # we have no bash at the moment for windows BASH_PATH = lib.optionalString (!stdenv.hostPlatform.isWindows) "${bash}/bin/bash"; + # Build a static executable to avoid environment runtime impurities + env.CGO_ENABLED = 0; + # replace the build phase to use the GNUMakefile instead buildPhase = '' make BASH_PATH=$BASH_PATH