Ways to mark derivations as incompatible with content addressed format

Sometimes packages embed their absolute paths into the output in ways that can’t be detected or overwritten by nix. One example is nodejs that does some checksumming against absolute output paths. Another example is java packages where absolute paths get embedded into .zip files. CA conversion breaks such packages.

Those usually break when the package is built with $ nix build -f. $pkg --arg config '{ contentAddressedByDefault = true; }'.

What is the canonical way to mark packages as incompatible with CA?

I suggest using __contentAddressed = false;. Example: nodejs: explicitly disable __contentAddressed by trofi · Pull Request #225264 · NixOS/nixpkgs · GitHub

But I’m not sure if __ prefix is some form of internal namespace not expected to be used outside nixpkgs internals.

1 Like