On Mon, 2022-04-18 at 12:17 +0200, Wout Mertens wrote:
> Hi,
>
> I'm wondering if bup could be used to handle /nix/store of the
>
https://nixos.org distro
I guess? But what would you want to achieve with it?
It'd be slow to access, for one, since everything larger than a few KiB
(depending on how you tune it, though current upstream bup cannot be
tuned at all in this, I have patches) will be split out into multiple
objects ...
[snip nix description]
> So my questions are:
>
> I suspect bup would be a great fit for storing this, and I wonder if
> git fetch could be used to grab closures efficiently.
FSVO efficiently, I guess? Are you looking at network transfer speed? I
think nix currently (mostly?) uses xz, while git is (currently?) limited
to gzip for compression. So any gains you'd probably have would be from
deduplicating files in similar/related closures, say files that didn't
change from one version to the next?
> I think that for each package I would create a backup of its closure,
> and name it the same as its store path.
> Do I understand correctly that this will create a git branch with the
> packed data?
Yes.
> So suppose I want to get a certain python hash and I already have an
> older version, I can run git fetch for just that branch, and git will
> then only download the differing data between the old and new python
> closures?
Yes, but not sure how much that would really save.
> Then I can mount my backing store with fuse on /nix/store, and the
> newly downloaded python path will be available there?
Yes. Though there's always the 'latest' symlink inside, so to be able to
use it you'd need to either change bup or do some symlink farm for
/nix/store.
As far as deduplicating goes ... I just tried with bup and default
settings on
66M /nix/store/drr8qcgiccfc5by09r5zc30flgwh1mbx-python3-3.7.5
56M /nix/store/66fbv9mmx1j4hrn9y06kcp73c3yb196r-python3-3.8.9
56M /nix/store/qjmp7jvig1xq8sm424nahvi4km9xwwll-python3-3.8.9
93M /nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6
93M /nix/store/rjx617di0rrq9lpa9pmz0sz6dqhhhzkv-python3-3.9.6
68M /nix/store/s9xmbxlqxfrlxmr5nwhibj64fnzhix5i-python3-3.9.6
(all python versions I currently had), and I got
21M /tmp/test/objects/pack/pack-704448f1094f0263459a654b3bd036a86a1ff35b.pack
18M /tmp/test/objects/pack/pack-2aaf50ab98895748a1f0d276301ac5ce80a098f2.pack
3.9M /tmp/test/objects/pack/pack-3fb7b2f228fdf94a0bacfb43ac937945bd75c05a.pack
38M /tmp/test/objects/pack/pack-4f2ddc835df6e0156e6e00bf85ee8acd93f2e07b.pack
8.4M /tmp/test/objects/pack/pack-bcaf2c8fc0e4f426a13c8ae4b303aa398bfbe31c.pack
9.9M /tmp/test/objects/pack/pack-abddf072011d33ef9ddf0a75ce2f79f063758648.pack
created for saving them in the listed order, so
drr8qcgiccfc5by09r5zc30flgwh1mbx-python3-3.7.5
took 21M dedup'ed & compressed (default settings),
66fbv9mmx1j4hrn9y06kcp73c3yb196r-python3-3.8.9
added 18M
qjmp7jvig1xq8sm424nahvi4km9xwwll-python3-3.8.9
added only 3.9M
etc.
So yeah, I guess you'd save some space, but probably with a massive
trade-off in access speed...
johannes