[Nix-dev] nix push hard linking

Mathijs Kwik mathijs at bluescreen303.nl
Wed Sep 26 09:59:47 CEST 2012


Eelco Dolstra <eelco.dolstra at logicblox.com> writes:

> 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 :-)

Glad you like it.

>
> 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.
>

There's another catch though...
I'm not familiar with perl =)
I manage to understand sources mostly, but writing is a different beast.
So I would be grateful if you or some other nix dev could implement it.

No rush though, still have some space left :)



>> 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.


More information about the nix-dev mailing list