If I want to contribute to a project which doesn’t have a flake.nix, I often write one and then let it live in only my fork. Once I have the changes how I like them, I cherry-pick them to a different branch and create the PR from there.
I dislike this because:
- It complicates my workflow
- Others don’t get to benefit from the flake I wrote
Are there better approaches to this problem? Not all project maintainers want to add a flake.nix in their repo root just because one contributor finds it useful.
Depends on the details of the project of course, but I tend to maintain the Flake out-of-tree. Usually starting with a devshell that I use from within the project by means of
nix-direnv and putting an
.envrc file in there. And once things are working, the Flake then gets a build recipe which could also be the basis for a potential inclusion into Nixpkgs.
I didn’t realize that the contents of
.envrc could be
use flake ../some/other/dir
But I tried it and it appears to work, so that opens doors for me. Thanks @polygon.