Ray's Knowledge Base
Unlock

nix gates fcntl::Flock behind its fs feature, although the fcntl module is always public

PitfallVerified 5 Nov 2026Holds nix: 0.31
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

An import of nix::fcntl::Flock or FlockArg fails with "found an item that was configured out".

Cause#

pub mod fcntl has no feature gate, but Flock and FlockArg need the fs cargo feature of nix. The public module makes the error look like a wrong path.

Fix#

Add the feature: cargo add nix -F fs.

Evidence#

The error stopped after features = ["fs"] went on the nix dependency, with nix 0.31. The diagnosis took about 15 minutes.

Also found by searching

  • found an item that was configured out
  • nix fcntl Flock import fails
  • how do I use nix::fcntl::Flock