NixIPFS / notes

ideas and planning on how to use IPFS together with Nix/OS
17 stars 1 forks source link

Build Input Caching #1

Open mguentner opened 7 years ago

mguentner commented 7 years ago

Beside distributing binary files, the build inputs of a derivation could be cached in IPFS. That would speed up CI quite a bit since the cache could move "closer" to the build instance (using an IPFS Gateway that is within the local network).

Current Status: @knupfer created fetchIPFS: https://github.com/NixOS/nix/issues/859#issuecomment-241787645 @CMCDragonkai is doing something similiar @ https://github.com/MatrixAI/Forge-Package-Archiving NAR replacement discussion: https://github.com/NixOS/nix/issues/1006

There are different methods on how to approach this:

Should we produce an intermediate cache format (tar? -> can be chunked efficiently in IPFS) that is used to cache each src? This can then be used within each fetch derivation. As a big plus, the build inputs are deduplicated and share blocks with the official package. However it would be better just to reuse an already archived src (like tar.*, .zip etc.) and not to archive it again -> We need some form of manifest -> We need IPLD

CMCDragonkai commented 7 years ago

We are currently in the midst of going through ipfs internals (specifically libp2p) in order to create a haskell implementation and have a deeper integration of build input source hashes and ipfs architecture.

CMCDragonkai commented 7 years ago

https://github.com/MatrixAI/Forge-Package-Archiving/issues/1

CMCDragonkai commented 7 years ago

The biggest benefit is the ability to version srcs that are currently not versionable. Loads of packages distributors don't keep historical versions.

CMCDragonkai commented 7 years ago

We're halfway through implementing the haskell multiaddress library: https://github.com/MatrixAI/haskell-multiaddr (see improved branch). Still to do - binary encoding/decoding.

Perhaps we should meetup and compare notes?

mguentner commented 7 years ago

This script prints all tarballs for an expression:

nix-instantiate --eval --json --strict maintainers/scripts/find-tarballs.nix --arg expr '(import <nixpkgs> {}).hello'

there is also maintainers/scripts/copy-tarballs.pl that uses it to upload to S3

mguentner commented 7 years ago

First implementation: https://github.com/NixIPFS/nixipfs-scripts/blob/master/nixipfs/src/mirror_tarballs.py