# OSTree repository fetcher, or \`fetchMultipleFiles\`

**URL:** https://discourse.nixos.org/t/ostree-repository-fetcher-or-fetchmultiplefiles/26158
**Category:** Development
**Created:** [March 9, 2023, 1:04pm UTC](https://discourse.nixos.org/t/ostree-repository-fetcher-or-fetchmultiplefiles/26158 "2023-03-09T13:04:55Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ranfdev](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ranfdev/32/8754_2.png) [@ranfdev](https://discourse.nixos.org/u/ranfdev)
#### Post date: [March 9, 2023, 1:04pm UTC](https://discourse.nixos.org/t/ostree-repository-fetcher-or-fetchmultiplefiles/26158/1 "2023-03-09T13:04:55Z")

</div>

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](https://flathub.org/home) 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?

---

<div class="post-metadata">

### Author: ![raphi](https://discourse.nixos.org/user_avatar/discourse.nixos.org/raphi/32/6291_2.png) [@raphi](https://discourse.nixos.org/u/raphi)
#### Post date: [March 9, 2023, 1:57pm UTC](https://discourse.nixos.org/t/ostree-repository-fetcher-or-fetchmultiplefiles/26158/2 "2023-03-09T13:57:34Z")

</div>

You can take a look at existing fetchers like [fetchhg](https://github.com/NixOS/nixpkgs/tree/master/pkgs/build-support/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).

---

<div class="post-metadata">

### Author: ![infogulch](https://discourse.nixos.org/user_avatar/discourse.nixos.org/infogulch/32/6227_2.png) [@infogulch](https://discourse.nixos.org/u/infogulch)
#### Post date: [March 11, 2023, 11:59pm UTC](https://discourse.nixos.org/t/ostree-repository-fetcher-or-fetchmultiplefiles/26158/3 "2023-03-11T23:59:33Z")

</div>

The [ostree project](https://github.com/ostreedev/ostree) has a description of how they think ostree is related to nix:

> **[Related Projects](https://ostreedev.github.io/ostree/related-projects/#nixos--nix)**
>
> ostree documentation

> [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](http://nixos.org/nix/manual/#chap-package-management/). However, OSTree uses a commit/deploy model …

Previous discussions:

> [@How does Silverblue compare to NixOS?](https://discourse.nixos.org/t/how-does-silverblue-compare-to-nixos/6723):
>
> I discovered today the existence of Fedora Silverblue Does anyone have experience or knowledge in it? How does it compare to NixOS?

> [@NixOS vs. Fedora Silverblue](https://discourse.nixos.org/t/nixos-vs-fedora-silverblue/648):
>
> What are the benefits and drawbacks of each? Could NixOS one day adopt OSTree? I’m planning on building a distro based on NixOS and was wondering what exactly the differences are between the two systems. It looks like Fedora Silverblue doesn’t do actual system configuration the way NixOS does, but I might be mistaken. What are the benefits of drawbacks of OSTree vs. Nix’s way? While I’m here, I might as well plug the place I learned of Fedora Silverblue. It’s a discord server with a bunch of te…
