# Nix flakes integration?

**URL:** <https://discourse.pijul.org/t/nix-flakes-integration/733>\
**Category:** Question\
**Created:** [February 19, 2021, 10:56am UTC](https://discourse.pijul.org/t/nix-flakes-integration/733 "2021-02-19T10:56:19Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![las](https://avatars.discourse-cdn.com/v4/letter/l/5f9b8f/32.png) [@las](https://discourse.pijul.org/u/las)\
**Post date:** [February 19, 2021, 10:56am UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/1 "2021-02-19T10:56:19Z")

</div>

I was considering using pijul to manage my nix flakes, but since nix flakes seem heavily tied to git and hg, I’m not sure how to do this. On the [Flakes - NixOS Wiki](https://nixos.wiki/wiki/Flakes) this is written after all: “ **Warning:** flake makes a strong assumption that the folder is a git or mercurial repository. It doesn’t work outside of them.”

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [February 19, 2021, 11:29am UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/2 "2021-02-19T11:29:28Z")

</div>

I don’t know, I’m not super familiar with flakes, because I couldn’t get them to work for everything I wanted (like deploying [nest.pijul.com](http://nest.pijul.com)). The NixOS maintainers are aware of the existence of Pijul, I believe the main missing thing to have a proper `fetchPijul` in nixpkgs would be the tag command, which at the moment depends on the new backend (the new Sanakirja). So, there’s nothing much I can do at the moment, except finish that (very long and tedious) integration job.

---

<div class="post-metadata">

**Author:** ![las](https://avatars.discourse-cdn.com/v4/letter/l/5f9b8f/32.png) [@las](https://discourse.pijul.org/u/las)\
**Post date:** [February 19, 2021, 11:41am UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/3 "2021-02-19T11:41:08Z")

</div>

Huh, thanks!

金, 2月 19, 2021 at 11:39, Pierre-Étienne Meunier via Pijul \<[pijul@discoursemail.com](mailto:pijul@discoursemail.com)\> が送信：

---

<div class="post-metadata">

**Author:** ![jorsn](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@jorsn](https://discourse.pijul.org/u/jorsn)\
**Post date:** [February 26, 2021, 11:19am UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/4 "2021-02-26T11:19:53Z")

</div>

Aren’t states and channels enough? Or if not, what are states then/where are they explained?

> [@las](#):
>
> It doesn’t work outside of them.

That’s a bit too strong a statement, I think: There are `path` and `tarball` fetchers, so flakes needn’t be VCS repos at all. Certainly it helps with reproducability if you have an archive of uniquely identified versions.

---

<div class="post-metadata">

**Author:** ![zygomeb](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/zygomeb/32/485_2.png) [@zygomeb](https://discourse.pijul.org/u/zygomeb)\
**Post date:** [September 3, 2022, 1:18pm UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/5 "2022-09-03T13:18:26Z")

</div>

Has there been any movement in this topic recently?

---

<div class="post-metadata">

**Author:** ![IslandUsurper](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/islandusurper/32/185_2.png) [@IslandUsurper](https://discourse.pijul.org/u/IslandUsurper)\
**Post date:** [September 5, 2022, 2:35pm UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/6 "2022-09-05T14:35:33Z")

</div>

I’ll hazard a guess that Pijul has all the features that Nix expects a VCS to have. Now it’s up to the Nix program to integrate Pijul the way it does Git and Hg. Not only does there need to be a `fetchPijul` function for flake inputs, but for the flake itself it needs to be able to detect that the folder is controlled by Pijul, checkout the flake into the Nix store using the version checked out locally and…oh that might be all. I didn’t realize before today that flakes supported Mercurial, so it probably isn’t that hard to add a _third_ integration.

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [September 5, 2022, 3:04pm UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/7 "2022-09-05T15:04:04Z")

</div>

One thing that is hard is that tags aren’t fully implemented in Pijul. The current version has tags, they work as expected but aren’t as fast and small as they could be, by orders of magnitude.

---

<div class="post-metadata">

**Author:** ![stellarpower](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/stellarpower/32/489_2.png) [@stellarpower](https://discourse.pijul.org/u/stellarpower)\
**Post date:** [September 20, 2022, 1:10am UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/8 "2022-09-20T01:10:27Z")

</div>

nix is functional, right? The OS is rebuilt each time with patches, that’s their selling point if I’m not wrong, so you’d think it’d be right up their street.

---

<div class="post-metadata">

**Author:** ![saolof](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/saolof/32/560_2.png) [@saolof](https://discourse.pijul.org/u/saolof)\
**Post date:** [October 17, 2023, 5:09pm UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/9 "2023-10-17T17:09:52Z")

</div>

Basically, Pijul is to Git what nixos is to containers/ostree, more or less replacing trees with a composable DAG. There’s a lot of overlap between their philosophies.

So as mentioned above, the only thing it needs is bit-for-bit reproducibility that can be checked with cryptographic hashing, checking out from a remote repository based on a hash, and solid tagging. And then just doing these things fast enough to not be a bottleneck and being mature/stable enough that you can continue to rely on the hashes even after future updates.

---

<div class="post-metadata">

**Author:** ![dblsaiko](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/dblsaiko/32/578_2.png) [@dblsaiko](https://discourse.pijul.org/u/dblsaiko)\
**Post date:** [November 26, 2023, 8:45pm UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/10 "2023-11-26T20:45:17Z")

</div>

I made a plugin to add Pijul support to Nix flakes, see the readme: [dblsaiko/nix-plugin-pijul](https://nest.pijul.com/dblsaiko/nix-plugin-pijul)

However, it can’t automatically detect that the current directory is a Pijul repo, since that seems to be hardcoded in Nix to only detect Git repos. (However I do have a [patch](https://git.sr.ht/~dblsaiko/nix-extras/tree/29d00bbdfec212fadfcc5bce489536747b78d077/item/packages/nix-pijul/0011-Detect-Pijul-repositories-for-flake-paths.patch) to Nix for that)

---

<div class="post-metadata">

**Author:** ![toastal](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@toastal](https://discourse.pijul.org/u/toastal)\
**Post date:** [October 13, 2026, 5:55am UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/11 "2026-10-13T05:55:34Z")

</div>

Not experimental flake integrated (it’s just stable Nix, so compatible with other stable Nix or flake code), but I created [Nixtamal](https://nixtamal.toast.al) early this year in order to pin Pijul (& Darcs, Fossil), dependencies. It uses a bootstrapping Nixpkgs to get access to `pkgs.fetchpijul`. I made the `pkgs.nix-prefetch-pijul` script too (which is also used under the hood).

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [October 13, 2026, 7:20am UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/12 "2026-10-13T07:20:32Z")

</div>

Note that I’m also moving on from Nix: [elpe / elpe · nest](https://nest.pijul.com/elpe/elpe)

---

<div class="post-metadata">

**Author:** ![toastal](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@toastal](https://discourse.pijul.org/u/toastal)\
**Post date:** [October 13, 2026, 8:35am UTC](https://discourse.pijul.org/t/nix-flakes-integration/733/13 "2026-10-13T08:35:33Z")

</div>

That’s cool. Nixtamal is written in OCaml like these Elpe expressions—but I’m very invested into Nix the ecosystem.
