haskell-nix / hnix-store

Haskell implementation of the Nix store
Apache License 2.0
85 stars 23 forks source link

Do not store the store dir in the store path #216

Closed Ericson2314 closed 10 months ago

Ericson2314 commented 1 year ago

I disagree with myself in https://github.com/haskell-nix/hnix-store/issues/62 (maybe I was confused on real vs virtual store dir, or maybe I was just being stupid!)

I agree with https://github.com/haskell-nix/hnix-store/issues/148 too, which is an issue to undo it.

As a first step, I present this, which merely make StorePath not store the store dir, with any type-level stuff TBD. Yes, this is not ideal, but I think it's a good start. It is how C++ Nix and TVix do it these day. It is essentially never safe to mix up store paths with different store dirs, and so this is an improvement under the "make illegal states unrepresentative front".

Some of the daemon code got uglier, but I have a WIP big overhaul of that I'd hope to finish up at some point. That undoes the slight nuisance of these "get store dirs" that crop up everywhere with this PR.

sorki commented 10 months ago

Thank you! I've fixed one warning where expectedStore vs parsed results was ignored.

Feel free to dump the ideas into issues or even the WIP stuff to some branch so I can take a look. I have some ideas I would like to implement this year so we don't step over our work (I mostly want to refactor -remote to use typeclasses / tagless style, move/improve test harness so it can be used by hnix as well and possibly rework ad-hoc binary parsers a bit).

I've spent some time recently staring at a class hierarchy of libnixstore but I'm not much wiser yet as how to actually structure various store implementations here.. I guess typeclasses would get us quite far for now.

Ericson2314 commented 10 months ago

Thanks @sorki. Do you still have a working matrix account btw?

sorki commented 10 months ago

Thanks @sorki. Do you still have a working matrix account btw?

Not yet, but I was looking at dendrite last week and it looks pretty good, so I'll deploy it when I hit infra mood. We used to run our own synapse for a local NGO but it was scraped for "cost saving reasons" in favor of Slack. The real reason was that it was too transparent as anyone could join while their Slack is private and invite only :upside_down_face: