[Nix-dev] Accessing files in derivations.

Layus layus.on at gmail.com
Tue Apr 19 16:01:55 CEST 2016


Dear NixOS users,

For as long as NixOS exists, we have been using statements like 
"${package}/some/path";
However, nothing ensures that the path /some/path exists in the given 
package.
As this works good enough in practice, there was no incentive to improve 
the situation.

With the multiple output feature, it becomes even more cumbersome to use 
that notation,
as we now have to write "${package.output}/some/path" to target the 
right file.
Furthermore, if the packager decides to add an output and move some 
files to it, it may break the expression.

This is why I think we should introduce a notation for accessing paths 
in derivations.
Sadly, the "obvious" operators like //, <...> or @ are already taken.
What about overloading them, as in ${package @ /some/path}, 
"${package//some/path } or <package/some/path> ?

That operator would ensure that the path exists in the derivation, but 
also look up through the outputs to find one containing that file.
That way, adding and removing outputs to derivations would not break 
NixOS on each update,
and we would have proper checking for static paths.

Regards,
Layus.


More information about the nix-dev mailing list