Skip to content

Nix flake support - #4

Draft
cmcmA20 wants to merge 1 commit into
samtoth:mainfrom
cmcmA20:flake
Draft

Nix flake support#4
cmcmA20 wants to merge 1 commit into
samtoth:mainfrom
cmcmA20:flake

Conversation

@cmcmA20

@cmcmA20 cmcmA20 commented Apr 7, 2026

Copy link
Copy Markdown

Some basic infrastructure. Ping if you want me to change something.

@samtoth

samtoth commented Apr 7, 2026

Copy link
Copy Markdown
Owner

Thanks for this. You'll have to forgive my ignorance because I don't understand nix Flakes all too well. In the non-flakes workflow, nix-thunk allows me to pin a specific version of Agda e.g. see

https://github.com/samtoth/agda-forester/blob/main/nix/Agda/github.json
https://github.com/samtoth/agda-forester/blob/main/nix/haskell-packages.nix

Does this Flake somehow do the same - my impression is that it doesn't?

@cmcmA20

cmcmA20 commented Apr 7, 2026

Copy link
Copy Markdown
Author

I have to admit that I am a total noob in flakes, but I'll share everything I got.

Version pinning for all inputs is happening in the flake.lock file. I wanted to use latest Agda (w/ optimization patch by Kovacs) and changed the commit hash deliberately. Should've probably pinned the version you have in thunk files, my bad.

The tooling for Agda & forester is overwhelming for a newcomer:

  • Agda has a flake, also it provides an overlay where haskellPackages.agda from nixpkgs is replaced with the latest Agda
  • forester has a flake
  • treelist has a flake, but it uses forester 5.0 from opam packages, not the flake one
  • agda-forester depends on agda (buildtime) but calls treelist in runtime

IIUC it's impossible to build all four packages from the same world snapshot at the moment. Forester overlaying opam packages with the latest version and treelist having forester in inputs would reduce dependency fragmentation.

Btw it's easy to list libraries for Agda, but agda-forester is unsuccessfully trying to find libraries in the home directory. Still thinking about solutions for this.

@cmcmA20
cmcmA20 marked this pull request as draft April 7, 2026 20:48
@samtoth

samtoth commented Apr 8, 2026

Copy link
Copy Markdown
Owner

Okay - thanks for the info!

If this nix-flake is working for you, I am happy to merge it. I will stick with the current nix-thunk infrastructure in my project for now anyway. Btw should you like to/need to, you are welcome to open a PR on treelist so that it uses Forester from the flake (if that is possible).

Finally - I have been meaning to bump to get these amazing new Agda speedups(!), would you mind updating the thunk ref to match the version you have in the flake.lock?

@cmcmA20

cmcmA20 commented Apr 9, 2026

Copy link
Copy Markdown
Author

I'm afraid that it would be easier to run nix-thunk yourself:

agda: github:agda/agda/e5c302a50108f4dfa658dd984d9a7406bb40b3b4?narHash=sha256-bUKKg/WijBjoxkn0R3rysTa4DFX5fxF93ANxyajnuG8%3D (2026-04-08 14:19:05)

nixpkgs-for-agda: github:NixOS/nixpkgs/2196a21a257bd9f7c4d630d0d11e034e5eab4a04?narHash=sha256-4ScyrtACXIwNxlNxirRBJEdoJRmVXki7sTjtCaq0ZkI%3D (2026-04-08 23:39:02)

treelist: github:samtoth/treelist/5b5a7e36a1cbbb89c83f15cc770c5a5609a1a2c1?narHash=sha256-fqcgm%2B1K4dg8AOMgJ9CaeUpoVaU5tU%2B0bYhdjbKTPtk%3D (2026-02-11 14:24:49)

nixpkgs-for-treelist: github:NixOS/nixpkgs/b3d51a0365f6695e7dd5cdf3e180604530ed33b4?narHash=sha256-4vhDuZ7OZaZmKKrnDpxLZZpGIJvAeMtK6FKLJYUtAdw%3D (2025-11-02 19:18:41)

These commits&hashes definitely work.

treelist cannot be built with recent nixpkgs, unfortunately, I'm not knowledgeable enough in ocaml/dune ecosystem to debug the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants