I use Debian on my development machine and develop using C/C++/Makefiles using Eclipse as my IDE. My applications are predominantly GUI applications using IUP as the underlying tool kit. IUP is a cross platform GUI tool kit for C/C++ which is layered on top of GTK. I have managed to write the derivations to fetch the IUP components from GIT and then build and install to the Nix store. I have placed these derivations in environment.systemPackages and they rebuild fine when I check for updates.
My understanding of Nix is that given that I have my own software libraries (one of which depends on IUP) and then these libraries are used extensively in my GUI applications that whenever a change to IUP or my own libraries occur then ALL of my code would need to be rebuilt. Given that there is over 800k lines of code and it takes about 45 minutes to rebuild all of it via make files, this seems to me to be an impediment to quick turn around when developing.
I understand the value of reproducible builds but 45 minutes of recompile time every time a minor change to an IUP library or one of my software libraries occurs seems to be a problem - but maybe I am missing the point.
So, my questions are:
How do other C/C++ developers work efficiently on NixOS ?
Do I have to recompile 800k lines of code for every change to IUP or one of my libraries ?
I do apologies if these are simple questions, but I’m finding the concepts a bit hard to come to grips with and the documentation, while reasonable, could be better.
Thanking you for your time and patience.
Post your derivation and i’ll take a look at it for optimisation.
This could be a caching problem, maybe @domenkozar https://cachix.org/ can help you.
Also, if you need remote builders, https://nixbuild.net/
We’ve just built a mammoth machine to help with our hydra testing and our own builds…, and it’s worked out really well. Were going to a blog post about it soon.
The documentation can be either very sparse, or overwhelming and everything in between. However i found there’s lot of help available from real humans here (the best kind).
Incremental compilation is not something Nix supports out of the box.
You could play around with recursive Nix, but there’s no documentation (as always) how to use it.
You could watch Incremental GHC builds with Recursive Nix - YouTube for how it can be used for GHC development.
I’ve opened Recursive Nix tutorial · Issue #134 · nix-dot-dev/nix.dev · GitHub to remind me to write a tutorial for it.
Thank you @nixinator and @domenkozar for your replies. Cachix is something that I was not aware of and can look into. I did do some more reading on this forum and found ‘ccache’ which, when I find some time, will test, to determine how much it will reduce compilation times. I will watch the YouTube video link that @domenkozar provided as I’m sure that I can use the GHC ideas and take them across to my C/C++ setup. Thank you again for replying. It is so nice to post to a forum and get well written help. I remember a forum (that shall remain nameless) that I posted to years ago that actually denigrated beginners such as myself. So it is so nice to know that this forum is so friendly.