I am looking for guidance when I run into the following two scenarios:
I have certain personal projects that are useful to me, but not production ready and I don’t want to put them on nixpkgs, but I do want them to be packaged as a nix derivation on my computer.
Sometimes I need to compile software in a specific way (PETSc with specific compilation flags for example) so I can’t use the nixpkgs version, but I also don’t think its right to push my specific compilation to nixpkgs since its really only useful to me. But I do want this to be packaged as a nix derivation so I can use it in a nix-shell development environment.
What is the “proper” way of handling these issues? My approach was going to be the following:
fork nixpkgs
add my nix derivations to my personal fork
use that fork as my nix channel in my configuration
use my personal projects from my personal nix fork in my configuration file
I wanted to check before I go down this path to see if I am missing any preferred or easier way of doing this.
I am trying to avoid just compiling PETSc (for example) locally on my machine, because I use many different computers and I want the build to be reproducible on all of them. My goal is to have everything done the nix way.
Thank you for the reply. I see how NUR could solve this issue. I’ll dive deeper into that. I am not sure how using a flake could solve this. This is probably due to a lack of understanding of flakes. Could you explain a bit more? I am currently using home-manager in a flake.
Thanks for the idea. Could you point me towards some resources to better understand how to do this? My understanding is that I would create a repo on gihub where I would put the Nix expressions for my custom packages. Then in my flake (I’m using home manager in a flake) I’d put something like this in the inputs:
I have no idea what that specific software is but for the case where a piece of software is packaged in upstream Nixpkgs but has certain compile-time options that you wouldn’t generally set, you can still work with the upstream derivation. What you’d do is to make the upstream derivation configurable such that you can configure the package according to your needs using simple high-level overrides. See i.e. the ffmpeg package for an example how that can be done.
If that is not possible and this is only required for one specific project, another option would be to include the derivation for the dependency in the project’s source and simply callPackage it there.