OSTree repository fetcher, or `fetchMultipleFiles`

An OSTree repository is similar to a git repository, but instead of containing source files, ostree’s repos contain a filesystem. In other words, ostree is a content-addressed versioning filesystem.
OSTree is used by flatpak to manage runtimes and SDKs.
Supporting OSTree repos means being able to reuse the files inside the flatpaks published on flathub and also means facilitating the build of flatpaks using nix.

Nix already offers a way to fetch git repositories. My idea is to add support for ostree repositories as well.
OSTree repositories are hosted by a simple http server. Adding support for them means having a fetcher to fetch all the files hosted inside an ostree repo, using http.

Now, nix can already fetch files from http using fetchurl, but an OSTree repo has a lot of files, so fetching all of them one by one is pretty cumbersome. Maybe adding a way to fetch multiple files at once, without specifying the hash of each of them, is enough. We could have a fetcher fetchMultipleFiles taking a list of paths and a single final hash.

Now, could we add the fetcher fetchMultipleFiles? What do you think about it?

1 Like

You can take a look at existing fetchers like fetchhg as a starting point for writing your ostree fetcher. Fetcher’s aren’t magic, they just call git clone or hg clone or whatever. Similarly, your fetcher would invoke ostree pull (or something like that, not familiar with ostree).

2 Likes

The ostree project has a description of how they think ostree is related to nix:

[NixOS] was a very influential project for OSTree. NixOS and OSTree both support the idea of independent “roots” that are bootable.

In NixOS, files in a package are accessed by a path depending on the checksums of package inputs (build dependencies) - see Nix store. However, OSTree uses a commit/deploy model …

Previous discussions: