I have been using Nix for a couple of years now, I am in no way a beginner, but I can not say I am an intermediate user either.
Recently I had the experience of getting Haskell static executable building to work (not for the first time, but things changed since I last did it), which sits on the shoulder of giants, @nh2 ‘s work, and nixpkgs’ Haskell infrastructure.
I am infinitely grateful to their work, at the same time I am pretty frustrated that I had to spend a couple of days guessing and guessing and guessing magic incantations until I got everything to finally work. This is in no way a complaint, nor is it a problem with nix/nixpkgs, it is simply due to my incompetence and I would like to fix it, hence this post.
I would have gladly spent this time problem-solving my way into a successful build IF I could at least understand or know what I should read (code as well) in order to understand what is going on.
Every time I try to learn what is going on in nixpkgs I go completely lost in the sheer complexity of it and give up, just guessing the appropriate fix. When nix builds fail it could be at any level of abstraction how do I got about familiarising myself with all those layers so that I can troubleshoot intelligently?
I am lurking on this forum and there are enough users (at the double digits) that show that they have an understanding of how things work together or when there is a problem, what is a possible culprit, how to advance etc.
I would also want to be in this position, I understand that the road is going to be long. I want to use Nix
but troubleshooting by way of guessing is depressing. For those of you who know their way or that at least manage to browse nixpkgs and grok this complexity, or that at least manage to understand it partially as it is needed by reading only the relevant parts to the problem at hand, how did you get to this position? What should I learn? How should I practice? Perhaps just giving me an order in which to read
.nix files out of nixpkgs is all that is needed, perhaps that is just the beginning. I admit I am not an expert when it comes to building stuff in general in Linux, and perhaps that is a necessity to use nixpkgs proficiently. If that is the case, I would be grateful if you could just point me to the tomes I should read.
I already devour each and every blog post (or otherwise manuals) on the internet about nix and nixpkgs like a thirsty wanderer in the desert.
When builds break and I have no idea why, how to begin trying to troubleshoot intelligently?
e.g. when I am getting
crtbeginT.o: requires dynamic R_X86_64_32 reloc against '__TMC_END__' which may overflow at runtime; recompile with -fPIC
how do some of you approach this in order to understand where the problem is coming from?
I am not fixated on this example so feel free to share others instead, whatever you can.
Sorry for making such a scattered and ambivalent post, I just don’t want to narrow down the responses I receive. I will appreciate whatever you have to say that relates to anything I said.
All responses to this thread and to other threads on this discourse are (were always) appreciated! Thank you!