[Nix-dev] garbage collection and nix-push

Mathijs Kwik mathijs at bluescreen303.nl
Wed Oct 3 08:25:47 CEST 2012


On Wed, Oct 3, 2012 at 8:19 AM, Michael Raskin <7c6f434c at mail.ru> wrote:
>>> I am not too familiar with precise nix-push inside. Does the idea of
>>> building a directory with symlinks of NARs (wo it depends on them all),
>>> calling it something that includes current date, and removing
>>> 100-hour-old link sets in cron look hard ot easy to implement?
>>
>>That's the direction I was thinking in indeed.
>>However, apart from using "find" on the store to find the nar outputs, I
>>could not find an easy way.
>>
>>nix-push outputs all nar files into 1 directory.
>>However, in the store, each file is in its own subdirectory and the name
>>of that dir is not easily guessable.
>>
>>nix-push also outputs .narinfo files, but they don't contain info on
>>that dirname either.
>
> inotifywait /tmp/ -e create -r -m | grep --line-buffered create-nars.nix | sed -u -e 's/ CREATE //' | while read file; do cat $file; done > create-nars.nix

Wow, that's a cool trick. I knew about inotify itself but never used
inotifywait before.

>
> works even when nix-push finishes quickly. Now you can simply build
> the create-nars.nix file.
>
> Of course, you want to run nix-push with non-standard tmpdir to reduce
> impact (it is small, though) on other tmp-using processes.
>
> Of course, if you look at it you will see that you can easily generate
> such a file yourself and nix-build it.

I was looking at that just now :)

But I would like to go a step further and just patch nix-push a bit.
It doesn't need to copy anything I guess.
Just having it output the result of building that expression to
$destDir/result instead of to the tempdir and produce symlinks from
$destDir into that result would save space and (copy)time and have the
benefit of plugging into a gcroot all at once.

Thanks for your help,
I can probably hack together a solution now

>
>
>


More information about the nix-dev mailing list