{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nix/issues/859","repository_url":"https://api.github.com/repos/NixOS/nix","labels_url":"https://api.github.com/repos/NixOS/nix/issues/859/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nix/issues/859/comments","events_url":"https://api.github.com/repos/NixOS/nix/issues/859/events","html_url":"https://github.com/NixOS/nix/issues/859","id":143206256,"node_id":"MDU6SXNzdWUxNDMyMDYyNTY=","number":859,"title":"Nix and IPFS","user":{"login":"vcunat","id":1785925,"node_id":"MDQ6VXNlcjE3ODU5MjU=","avatar_url":"https://avatars2.githubusercontent.com/u/1785925?v=4","gravatar_id":"","url":"https://api.github.com/users/vcunat","html_url":"https://github.com/vcunat","followers_url":"https://api.github.com/users/vcunat/followers","following_url":"https://api.github.com/users/vcunat/following{/other_user}","gists_url":"https://api.github.com/users/vcunat/gists{/gist_id}","starred_url":"https://api.github.com/users/vcunat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vcunat/subscriptions","organizations_url":"https://api.github.com/users/vcunat/orgs","repos_url":"https://api.github.com/users/vcunat/repos","events_url":"https://api.github.com/users/vcunat/events{/privacy}","received_events_url":"https://api.github.com/users/vcunat/received_events","type":"User","site_admin":false},"labels":[{"id":886485313,"node_id":"MDU6TGFiZWw4ODY0ODUzMTM=","url":"https://api.github.com/repos/NixOS/nix/labels/backlog","name":"backlog","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":{"login":"peti","id":28323,"node_id":"MDQ6VXNlcjI4MzIz","avatar_url":"https://avatars3.githubusercontent.com/u/28323?v=4","gravatar_id":"","url":"https://api.github.com/users/peti","html_url":"https://github.com/peti","followers_url":"https://api.github.com/users/peti/followers","following_url":"https://api.github.com/users/peti/following{/other_user}","gists_url":"https://api.github.com/users/peti/gists{/gist_id}","starred_url":"https://api.github.com/users/peti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peti/subscriptions","organizations_url":"https://api.github.com/users/peti/orgs","repos_url":"https://api.github.com/users/peti/repos","events_url":"https://api.github.com/users/peti/events{/privacy}","received_events_url":"https://api.github.com/users/peti/received_events","type":"User","site_admin":false},"assignees":[{"login":"peti","id":28323,"node_id":"MDQ6VXNlcjI4MzIz","avatar_url":"https://avatars3.githubusercontent.com/u/28323?v=4","gravatar_id":"","url":"https://api.github.com/users/peti","html_url":"https://github.com/peti","followers_url":"https://api.github.com/users/peti/followers","following_url":"https://api.github.com/users/peti/following{/other_user}","gists_url":"https://api.github.com/users/peti/gists{/gist_id}","starred_url":"https://api.github.com/users/peti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peti/subscriptions","organizations_url":"https://api.github.com/users/peti/orgs","repos_url":"https://api.github.com/users/peti/repos","events_url":"https://api.github.com/users/peti/events{/privacy}","received_events_url":"https://api.github.com/users/peti/received_events","type":"User","site_admin":false}],"milestone":null,"comments":87,"created_at":"2016-03-24T10:10:49Z","updated_at":"2018-09-06T02:02:02Z","closed_at":null,"author_association":"MEMBER","body":"(I wanted to split this thread from https://github.com/NixOS/nix/issues/296#issuecomment-200603550 .)\n\nLet's discuss relations with [IPFS](https://ipfs.io) here. As I see it, mainly a decentralized way to distribute nix-stored data would be appreciated.\n##### What we might start with\n\nThe easiest usable step might be to allow distribution of fixed-output derivations over IPFS. That are paths that already _are_ content-addressed, typically by (truncated) sha256 over either a flat file or a tar-like dump of a directory tree; more details are [in the docs](http://nixos.org/nix/manual/#fixed-output-drvs). These paths are mainly used for compressed tarballs of sources. This step itself should avoid lots of problems with unstable upstream downloads, assuming we could convince enough nixers to serve their files over IPFS.\n##### Converting hashes\n\nOne of the difficulties is that we use different kinds of hashing than in IPFS, and I don't think it would be good to require converting those many thousands of hashes in our expressions. (Note that it's infeasible to convert among those hashes unless you have the whole content.) IPFS people might best suggest how to work around this. I imagine we want to \"serve\" a mapping from the hashes we use to the IPFS's hashes, perhaps realized through IPNS. (I don't know details of IPFS's design, I'm afraid.) There's an advantage that one can easily verify the nix-style hash in the end after obtaining the paths in any way.\n##### Non-fixed content\n\nIf we get that far, it shouldn't be too hard to manage distributing everything via IPFS, as for all other derivations we use something we could call _indirect_ content addressing. To explain that, let's look at how we distribute binaries now &ndash; our binary caches. We hash the build recipe, including all its recipe dependencies, and we inspect the corresponding narinfo URL on cache.nixos.org. If our build farm has built that recipe, various information is in that file, mainly the hashes of the _content_ of the resulting outputs of that build and crypto-signatures of them.\n\nNote that this narinfo step just converts our problem to the previous fixed-output case, and the conversion itself seems _very_ reminiscent of IPNS.\n##### Deduplication\n\nNote that nix-built stuff has significantly greater than usual potential for chunk-level deduplication. Very often we do a rebuild of a package only because something in a dependency has changed, so there are only very minor changes expected in the results, mainly just exchanging the references to runtime dependencies as their paths have changed. (In seldom occasions even lengths of the paths would change.) There's a great potential to save on that during distribution of binaries, which would be utilized by implementing the section above, and even potential in saving disk space in comparison to our way of hardlinking equal files (the next paragraph).\n##### Saving disk space\n\nAnother use might be to actually store the files in a FS similar to what IPFS uses. That seems a little more complex and tricky thing to deploy, e.g. I'm not sure someone already trusts the implementation of the FS enough to have the whole OS running of it.\n\nIt's probably premature to speculate too much on this use ATM; I'll just write I can imagine having symlinks from `/nix/store/foo` to `/ipfs/*`, representing the locally trusted version of that path. (That's working around the problems related to making `/nix/store/foo` content-addressed.) Perhaps it could start as a per-path opt-in, so one could move only the less vital paths out of `/nix/store` itself.\n\n---\n\nI can help personally with bridging the two communities in my spare time. Not too long ago, I spent many months on researching various ways to handle \"highly redundant\" data, mainly from the point of view of theoretical computer science.\n"},"comment":{"url":"https://api.github.com/repos/NixOS/nix/issues/comments/418939144","html_url":"https://github.com/NixOS/nix/issues/859#issuecomment-418939144","issue_url":"https://api.github.com/repos/NixOS/nix/issues/859","id":418939144,"node_id":"MDEyOklzc3VlQ29tbWVudDQxODkzOTE0NA==","user":{"login":"davidak","id":91113,"node_id":"MDQ6VXNlcjkxMTEz","avatar_url":"https://avatars2.githubusercontent.com/u/91113?v=4","gravatar_id":"","url":"https://api.github.com/users/davidak","html_url":"https://github.com/davidak","followers_url":"https://api.github.com/users/davidak/followers","following_url":"https://api.github.com/users/davidak/following{/other_user}","gists_url":"https://api.github.com/users/davidak/gists{/gist_id}","starred_url":"https://api.github.com/users/davidak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidak/subscriptions","organizations_url":"https://api.github.com/users/davidak/orgs","repos_url":"https://api.github.com/users/davidak/repos","events_url":"https://api.github.com/users/davidak/events{/privacy}","received_events_url":"https://api.github.com/users/davidak/received_events","type":"User","site_admin":false},"created_at":"2018-09-06T02:02:02Z","updated_at":"2018-09-06T02:02:02Z","author_association":"CONTRIBUTOR","body":"@parkan i don't think so. The linked ipfs issues in my last comment are still open, so we have to wait for fixes (or get involved there and help resolve them)."}}
{"actor":{"display_login":"davidak"}}