Moving to NixOS
Some days ago I wanted to try to build Yarn Desktop Client on NixOS. I installed the latest version, got some basic things set up, I then cloned my repo and instantly regretted installing NixOS, because I did not get it to work as easy as I thought. I then put my laptop away for the rest of the evening. I picked it up again the next day, determined to give it another try. I was googling and browsing around, and found out about ‘flakes’. I remember reading about that last time I looked into this, but I could not get it to work then.
But I then found out how to enable it in the config file, so I did that, then I created a ‘flake.nix’ file - and I could just type nix-build to build the source! That was the break I needed.
This then pulls the source from git and builds it. Now you might see what the problem is - what if you want to build the local source? I then tried to install all the packages and all that on my system, but I always ended up with cmake error - some dependency missing -all though I installed it all. So looking into it a bit more I realized what I wanted was a nix-shell, that had everything it needed.
So I created a default.nix file, added all the things I need in there, then I could just type nix-shell and it initialized that and could build. I wanted to use vscode as my editor - so I found the ‘Nix Environment Selector’ addon for vscode ( https://marketplace.visualstudio.com/items?itemName=arrterian.nix-env-selector ), that one detects the default.nix file, and initializes vscode with all the things it needs. I’m very pleased with this setup! And it was fun to get everything up and running this way.