[Nix-dev] nix push hard linking

Eelco Dolstra eelco.dolstra at logicblox.com
Tue Sep 25 22:53:33 CEST 2012


On 25/09/12 05:35, Mathijs Kwik wrote:

> Would it be possible to have nix-push just hardlink to these files?
> Or maybe even nicer, build the nix-push output as a derivation,
> containing just symlinks to the nars.
> My "all" directory can then also just contain symlinks to these, and I
> can use normal garbage collection to remove old channel-outputs,
> followed by a dead-link purge on "all".

Oh, good idea :-)

There is one catch: you don't get sharing between NARs created by different
versions of Nix, because the derivations to produce the NARs will be different.
 Unless you run "nix-store --optimise".

> Does hardlinking make sense for nix-push?

Hard-linking is slightly tricky because the nix-push target need not be on the
same filesystem.  But it could always try it and fall back to copying.

> Is there a recipe for building nix-push's output as a derivation?

No, nix-push should build a top-level Nix derivation that gets the calls to
nar.nix as inputs and creates symlinks to each of the outputs.

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/


More information about the nix-dev mailing list