-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
addToStore to S3 and local binary cache #37
base: master
Are you sure you want to change the base?
Conversation
Just verified that this is now producing the exact same store = localBinaryStoreEffects "/tmp/xxx/hnix"
addToStore "/nix/store" "shell.nix" "shell.nix" True store $ nix copy --to file:///tmp/xxx/nix $(nix add-to-store shell.nix)
$ diff -r /tmp/xxx/hnix /tmp/xxx/nix
Only in /tmp/xxx/nix: nix-cache-info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concern as #36 , haven't reviewed the rest yet.
Same as using file://$DIRECTORY
, -- | The size of the nar the path, in bytes. | ||
fileBytes :: !(Maybe Word64) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've completely missed this and recently wrote/extracted from Cachix a lib - https://github.com/sorki/nix-narinfo which is hopefully polymorphic enough to accommodate our types.
:: StorePath storeDir | ||
-> Text | ||
narInfoFileFor p = | ||
encodeBase32 (storePathHash p) <> ".narinfo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now part of -core
s System.Nix.StorePath
called storePathToNarInfo
.
-- | Encode a 'Digest' in algorithm:hash format. | ||
encodeSomeDigest :: SomeNamedDigest -> Text | ||
encodeSomeDigest (SomeDigest d) = | ||
encodeDigest d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pending via #64.
case narHashMode of | ||
Recursive -> ("source", h) | ||
RegularFile -> ("output:out", hash ("fixed:out:" <> encodeUtf8 (encodeBase16 h) <> ":")) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This landed as part of #36.
encodeBase32 (storePathHash p) <> ".narinfo" | ||
|
||
addToStore | ||
:: forall storeDir m. (MonadIO m, KnownStoreDir storeDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> FilePath | ||
-> NarHashMode | ||
-> BinaryStoreEffects m | ||
-> m (StorePath storeDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> m (StorePath storeDir) | |
-> m StorePath |
Looking good! Few things need to land and we can merge this. Your thoughts on effect systems and having GADT for ops like |
I would not bother with effect systems. Big waste of time. |
Care to elaborate on that? I like how the effects compose compared to stack of transformers we use currently (mostly in |
I would like to salvage this, it bothers me it's sitting here for so long. Lots of pieces added here landed in core in some form. Some random remarks, I won't add anymore inline comments as it makes the code hard to read:
import qualified System.Linux.Mount
import qualified System.Linux.Namespaces
makeStoreWriteable :: IO ()
makeStoreWriteable = do
System.Linux.Namespaces.unshare [System.Linux.Namespaces.Mount]
System.Linux.Mount.rebind "/nix/store" [] It actually doesn't seem that hard, I might try cleaning up the PR after I'm done with #233 #235 #238 |
No description provided.