Hi, beginner here.
I’ve been trying to understand how it is possible to keep/host a personal collection of derivations that could live outside nixpkgs but I think I’m either missing the right search terms or there are no easy examples available.
Sorry in advance if my terminology is lacking.
Use case example:
I am creating a dev environment for a project using a flake.nix.
I use dependencies from nixpkgs as found in a lot of examples but I also want some niche softwares not in any repositories. I want to package it, without going through submitting it to nixpkgs for whatever reason (want to test it first, or I really need it asap and can’t wait for a PR to go through, or it’s just too niche, or I need a very specific version) and it would be best for me to have a git repo of flakes that I can easily add to my dev definitions.
Do you have simple examples of personal repositories of the sort?
Are there specific search terms for this concept that would help me?
Overlays might be it but I had a hard time to grasp if it was it.
Flakes are indeed a great usecase for this, as you can have everything in a single repository, and once the packages are there, you can add them to your project just like packages from nixpkgs.
I’ll gladly give you an example and explanation of the different mechanics, but I need to know what kind of project are we talking about here. Is everyone of the contributors on the same architecture and platform? Or does the collection have to be compatible with x64 and ARM, Linux and macOS?
To detail a bit more the use case, I’d like to provide a reproducible environment for a bioinformatics pipeline, which includes tools not packaged in nixpkgs.
The primary use would be to use this on linux and to produce a linux based container usable on clusters.
I was thinking of a personal repository mainly because I might want to reuse individual parts of the environments in other pipelines, but that’s not a hard requirement.
I have the feeling that nix can fill a big gap in reproducibility but honestly the docs and resources is a bit lacking on that front unfortunately.
The official nix manual’s page on flakes provides good information (albeit isn’t a tutorial) https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html
For a tutorial, the unofficial Zero-to-Nix does discuss using flakes Quick start – “collection of derivations that can live outside of nixpkgs” is pretty much what flakes do, so I think you’d be able to achieve what you want.
I believe this may be related/useful; some example package related to HPC
You can use Nix overlays to add or modify packages. Create a default.nix file in a directory with your custom package definitions. Then, add this directory to your Nix configuration. Alternatively, you can create a standalone Nix flake for your custom packages. You’d initialize a new Git repository, create a flake.nix with your custom package definitions, and then include that flake as an input in your project’s flake.nix.