Onboarding: follow the instructions and most developers will get set up. But me? Iām not most developers. Iām Katie Hughes and Iām the private eye whose setup always goes awry. That is, until my bad luck met its match: a package manager by the name of Nix.
Friday
Itās the end of my first week and I need to do my third developer environment set up ā this time on a loaner machine. Aware there will be a fourth round once my computer is back from repair, I sit with my fresh user and consider what I know:
- Thereās a group of people at my company who use Nix.
- Nix is a package manager.
- Our main app is mostly set up to use it and could use more developers testing the workflow.
- I have nothing to lose in terms of my dev set up since I will have to do it all over again with my repaired computer.
The last point was the most important. Whatever I do on this machine will not matter. My luck is rotten when it comes to setting things up but with another try around the corner, itās time to tempt fate.
I started by asking around ā my connections only had brief run-ins with Nix. āThe DSL was what kept me from diving in.ā Interesting. I had to ask myself, Have I ever been impeded by a DSL when using a package manager.
What makes Nix so special? What makes its DSL so special? Why havenāt I had issues with DSLs and package managers before? What package managers have I used? What even is a package manager?
Wait. Iām spiraling. I know what a package manager is. I ask the follow up, āWhy has the DSL been a blocker?ā
The answer becomes a theme for my Nix experience: āWhen I tried it out, a lot of packages were missing.ā
This answer checks out ā the DSL is a blocker if one were to add missing packages. I decide to go for it and start the Nix set up. I install the package manager and run make bootstrap to set up our applicationās Nix environment and⦠an error. I try a different order of things. Same result. I then realize I have one very important skill I wasnāt using: I could try reading the error message. Itās failing around some Python script due to not finding Python.
My understanding of Nix falters ā didnāt it install everything you need and just work perfectly? Am I really already having issues? Debug, debug, debug.
No. The setup is wrong. Itās assuming I have Python 3 installed, which people install at some point but I have yet to. A missing package on my system. I work with my partner to make Nix call the Python script within the nix-shell so it would have a more self reliant setup.
In order to run the script within Nix, we preface it with nix-shell and give it a shell config. I make a mental note and my first incorrect assumption: Iāll need to call nix-shell whenever I want to use nix.
Friday comes to an end and Iām feeling pretty good about my first day with Nix. I debugged my heart out and got a pull request into our setup. I contributed. Iām told second hand to install MySQL and Redis through Brew since we want to run those with brew-services. I take the note, stick a pin in it, and leave for the weekend.
Saturday
Like chewed gum on the sole of a shoe, Nix was stuck on my brain. Why doesnāt Nix have something like brew-services? Surely thatās a common use case, isnāt it?
I consult a third party. Itās described to me that Brew only worries about macOS so it knows how to edit the startup scripts to include Redis and MySQL. Nix is agnostic but currently sides with systemd over launchd. This sticky situation can be solved though, but will require further research. Another time, another place. I let this investigation rest for the weekend ā I move on.
Monday
Monday comes and Iām pairing⦠but not finished with set up. I realize there are a few update scripts listed as a footnote on the Nix page that I need to run. While updating, we find that gnutime is an uninstalled dependency. The missing packages increase; I need to install using Brew. I scribble a note to myself to mention that lead in our Nix channel.
My incorrect assumption from before is corrected. Itās clear to me now that the Python scripted needed nix-shell because the Nix environment wasnāt set up yet. But once make bootstrap was complete, I was able to call commands and Nix knew to use whatever was local to the project first. Just like my old pal, npm.
Tuesday
My new machine comes and itās time for my fourth and hopefully final set up. Iām confronted with the question: do I really trust this Nix character? Or am I just drawn in by the enticing green light of that which is functional programming?
I pull out my notebook and draw up an good olā fashioned pros and cons list:
Pros
- Iāll get the same packages as everyone else.
- Within my company, the Nix users are growing.
- I canāt mess up because Nix doesnāt destructively uninstall anything so it is always safe to uninstall and reinstall.
Cons
- Some packages remain missing and will remain missing until me or another Nix Detective steps in.
The choice is right in front of me and I take it; I choose Nix. In fact, I take it even farther: I decide to go Nix-First. If there is a package I need, I look it up in Nix. I take note of what isnāt there, use Brew, and move on.
Today
I am not investing too much into what is or isnāt āthe Nix wayā but I am using Nix. I see its usefulness on a project where many different developers are working on different machines and all want the same set up.
Have I made the switch at home though? No dice. To me, a singular person who sometimes does side projects but mostly doesnāt, I have yet to see the argument that pulls me. So at work I will use Nix and while at home I will stick with my Brew⦠for now.