build/nix: Missing `libcap` dependency

Open 💬 4 comments Opened Mar 2, 2026 by javierhonduco

I am trying to build using nix but libcap is missing. I've verified that adding the patch below is enough

diff --git a/flake.nix b/flake.nix
index 1fd41c6f1..5aca004b8 100644
--- a/flake.nix
+++ b/flake.nix
@@ -72,6 +72,7 @@
               pkgs.cmake
               pkgs.llvmPackages.clang
               pkgs.llvmPackages.libclang.lib
+              pkgs.libcap
             ];
             PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
             LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";

View original on GitHub ↗

4 Comments

unguentum · 5 months ago

Can confirm. Requesting fix.

SergioChan · 5 months ago

Prepared a fix branch for this (SergioChan:fix-nix-libpcap-13263) with the following changes:

  • add pkgs.libpcap to devShells.default.buildInputs
  • expand PKG_CONFIG_PATH to include both OpenSSL and libpcap pkg-config dirs

Commit: https://github.com/SergioChan/codex/commit/2fce9ae4f8abf9dfe8ea6a034117ca7f6cf2a305

Patch (for easy cherry-pick):

@@
-              pkgs.openssl
+              pkgs.openssl
+              pkgs.libpcap
@@
-            PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
+            PKG_CONFIG_PATH = pkgs.lib.makeSearchPath "lib/pkgconfig" [
+              pkgs.openssl.dev
+              pkgs.libpcap
+            ];
Acture · 5 months ago

@javierhonduco The issue title says libpcap which is a different package, but your
patch body has the right one.

@SergioChan Heads up — your commit adds pkgs.libpcap (packet capture)
instead of pkgs.libcap (Linux capabilities). Easy to mix up given the
title. Also the full commit link above returns 404 for some reason, but
the short hash works: https://github.com/SergioChan/codex/commit/2fce9ae

I put together a more complete fix building on both of your work
(Acture:fix/nix-libpcap-13263):

  • Add pkgs.libcap to devShells.default.buildInputs (Linux-only,

matching default.nix)

  • Expand PKG_CONFIG_PATH to include both OpenSSL and libcap

Commit: https://github.com/Acture/codex/commit/3ede411
Co-authored-by @javierhonduco and @SergioChan

```diff
@@ flake.nix @@
pkgs.llvmPackages.libclang.lib

  • ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
  • pkgs.libcap

];

  • PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
  • PKG_CONFIG_PATH = pkgs.lib.makeSearchPathOutput "dev" "lib/pkgconfig" (
  • [ pkgs.openssl ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.libcap ]
  • );
Verified locally: `nix flake check` passes on aarch64-darwin.
Unable to verify the Linux-only `libcap` addition without a Linux builder.
                                              
javierhonduco · 5 months ago

Oops, well spotted. Just edited the title and contents