Workflow for developing non-nix repos

I use Nix flakes + nix-direnv to set up development environments for most of my projects. This works great.

But sometimes I’m working on someone else’s project which doesn’t use nix, and I struggle with how to manage a dev environment through Nix without committing flake.nix and friends to the repo.

I don’t really care about version control on the .nix files, but nix really wants to have its files at least staged in the repo in order to work, so I find myself staging and unstaging the nix files (or sometimes forgetting to unstage and accidentally checking them into the repo). I could create my own private branch with the nix files checked in but this is annoying for repos that have multiple active upstream development branches.

Has anyone found a better workflow for this?

i use a more radical approach: i make a separate repo with flake only that does buildFHSEnv with all the packages needed for the repo i’m going to work with.

On top of that it allows me to completely separate homes as seen by dev envs working with different repos - a little security precaution.

so yeah, inside the build FHS,the work repo is binded, and i can work with it as if i was in a “normal” linux distribution with all libs, includes etc being where non-nix build tools expect them to be.

1 Like

The has been a similar discussion a while ago with a lot of great suggestions:

2 Likes