Nix flake of Nim-lang packages

I’ve created a flake repository containing expresssion for all Nimble (the Nim package manger) packages. I’m not familiar with the various *2nix utilities within Nixpkgs so I did a naive implementation of what I thought best fit the Nix flake model.

Any comments or reviews are appreciated. The plan is to make this repository part a of larger flake-based project, but I want to handle Nim packaging in the general case.

To give an overview, the flake packages are every package in the Nimble registry for a given snapshot as well as the Nim compiler (also in Nixpkgs). Package metadata is commited to the repository as per-package JSON files, these files contain fixed-output hashes for each tagged version of the Nimble package sources. The repository is updated by entering the local dev-shell and invoking make.

Packages are built by evaulating an intermediate derivation generated from metadata inside each upstream Nimble repository. This step collects cross-Nimble dependencies but can also collect dependencies from Nixpkgs (example). The former works well, but the later requires that nixpkgs-specific names are commited to upstream metadata.

If this model works, I would like to create similar flakes, perhaps for all of the MirageOS opam packages.


Very cool (although I didn’t look at this in depth, especially as I don’t use Nim myself)! Regarding your plan for opam packages, what is the reason for limiting this to MirageOS packages only?

I figure that some of the Mirage libraries are only useful within Mirage images, but if these libraries are in the opam registry, maybe it makes more sense to package all of opam together. Really I just need to look closely at opam2nix before I say anymore.

Also, this repository is now maintained by the Nix-community group, the canonical URL is (github:nix-community/flake-nimble).

1 Like