I’m trying to switch my work laptop from Fedora to NixOS, but I’m still having problems how to map my software development workflow to NixOS.
Consider the following scenario. I have three (C/C++) projects: A, B, C. Each of these projects takes a considerable time to build and the dependency chain is C depends on B depends on A plus each of these has non-trivial additional dependencies. Once all of these are built, they need to deployed to a different machine for testing.
On Fedora, my development workflow looks like this: I install all dependencies of A,B,C globally using -devel packages. Then I checkout the repos of these projects next to each other and configure the build systems to consume these development checkouts. After one sequential build, I’m deploying everything to the target system with a shell script.
This is painful to setup, but once it is setup, it’s very fast to change code in any of the components and quickly build/deploy and test.
Moving to NixOS:
The easiest option to replicate this setup is to build all components with Nix after overriding all the dependencies to point to the right repository. Then I can deploy using nixops to my test machine. This is very easy to setup, but somewhat useless in practice, because any change in A requires a full rebuild of everything. Even with
ccache this is prohibitively slow compared to the manual setup.
The alternative is using nix-shell. This only works for the package at the end of the dependency chain ( C ) and gets rid of most of the build times for C, because I can build incrementally. Also now I have a problem deploying the resulting binaries, because the nix store paths they reference may not be on the target machine.
I’m not sure what the best solution here is. Maybe I should create a unified shell.nix with dependencies for all projects. This would mean I get the incremental build experience as on my Fedora setup, but it still leaves the problem of how to deploy the dependencies to the target machine.
I’m eager to hear how other people do this!