[Nix-dev] when to use $out/nix-support

Peter Simons simons at cryp.to
Sat Dec 6 17:46:10 CET 2014


Hi,

 > What kinds of attributes are appropriate as passthrough attributes on
 > a derivation set, and which attributes are appropriate to be written
 > out to the store in a nix-support file?

passthru attributes are visible in the derivation's attribute set --
i.e. other expressions can see them during the evaluation of Nixpkgs --,
but they are not visible to the derivation's builder. In other words,
passthru attributes cannot affect the build and thus cannot affect the
$out hash of the generated package. This is useful whenever you want to
provide additional information about the package to its users within
Nixpkgs, but you don't want to rebuild everything whenever that
information changes.

Normal attributes are available within Nixpkgs the same way as passthru
attributes, but they can affect the build, obviously, and thus cannot be
changed without triggering a re-compilation of the package and all its
dependents.

Data that is written to the $out store path isn't readily available
during Nixpkgs evaluation, but it's available outside of Nix, i.e. a
shell script can source the file and use the information contained
inside of it. Files that live inside of $out/nix-support are omitted
when a user profile is built, i.e. user profiles never contain that
hierarchy. For files that ought to be installed, $out/lib/$name or
$out/etc/profile.d/$name might be a better choice.

Personally, I've never needed passthru attributes for anything, and I've
yet to create some file in $out/nix-support. So far, everything I've
wanted to do was possible with either a normal attribute or a normal
file somewhere in $out. Your mileage may vary, though.

I hope this helps,
Peter



More information about the nix-dev mailing list