Closed layus closed 4 years ago
@shlevy Updated. The code is a mess, but i implemented most of the missing features, except testing the algo in the source code. It still relies on algoName for that.
@shlevy Why not merge hnix-store in the hnix repo. Further development requires changes in both hnix and hnix store, often closely related.
My work is stalled now for everything turns out to be incredibly tangled, especially while trying to make the monads in hnix-store and hnix to work together.
My wip is in my dev branch https://github.com/layus/hnix/commit/e4713cc1266571886714ad6ca7df2ed2bcdf2747, especially the snippet https://github.com/layus/hnix/blob/dev/src/Nix/Effects.hs#L244-L297 where we see the complexity of integrating both. Ideally, we would not have to call Store.runStore inside the hnix monad store, and we should be able to keep the daemon socket alive while continuing the nix evaluation.
The remaining of the wip in this branch, but it is now completely broken permalink
If I could get but only one daemon call working correctly, the rest would be much easier, being just an extension that mimics the first call. Would you try to give a shot at a complete implementation of addTextToStore for example ?
I agree with @layus that we should put things in the same repo, especially while stuff is in flux. (Of course, no packages should be combined; people should load multiple packages in one GHCi. stack
can do that, and as it so happens we are finishing up https://github.com/obsidiansystems/obelisk/pull/489 to be able to do it too.)
Nice!
While I was trying to rebase my PR #35 I've got stopped by tests (once again), while I figured out something like runStore :: FilePath -> FilePath -> MonadStore ("lal" :: StoreDir) a -> IO (Either String a, [Logger])
I don't think that type level StoreDir
is a correct solution as it enforces to knowing store paths ahead. Tests for example use ad-hoc temp directory not to interfere with system store.
Maybe I'm just missing something and there's a way to do it with TypeLits
as well.
The other problems I found is with store path en/decoding IIRC but I need to look more closely again.
I think all the features here have been added in other PRs in the meantime. Closing
This convinced me that the project is mature enough to get started with actual implementations of the store API.
Some limitations that I discovered:
algoName
as inalgoName @hashAlgo == "sha256"
.addToStore
more generic. This leads to more questions i. Does a daemon only handle one prefix ? ii. Is there a way to know the prefix used by a daemon before reaching to it ?\cc @shlevy to get your first impressions, and possibly merge after some edits.