A new job meant a shift to macOS, offering an opportunity to rethink my dev environment. My goal: a seamless, consistent, and reproducible workflow, free from the "dirty hacks" that often plague developer machines. I quickly fell into rabbit holes, struggling with .profile not sourcing in graphical sessions and finding rbenv and pyenv solutions felt incredibly clunky, requiring explicit flag and path definitions. There had to be a better way.
That search intensified after seeing the gemini-cli app announcement, which called for npx – a tool not readily available as a Nix package. After some exchanges with Gemini, the conversation quickly evolved into an introductory session on nix develop. This pivotal discussion echoed a friend's long-standing suggestion to completely replace traditional version managers with Nix.
Cautiously, I replicated and adapted a Nix flake for my bigmeow side project (managed by Poetry), and fortunately, a satisfactory outcome was achieved. Applying the Ruby counterpart also went smoothly, and direnv integration meant automated activation of development environments. While taming my code editor was a frustrating challenge, a coworker's tip about ruby-lsp provided the breakthrough needed.
Solving these challenges yielded a functional setup that I'm truly happy with. Looking back, everything seemed trivial, but in reality, I was stuck for days. Despite the added complexity, getting all these parts working together felt like putting together puzzle pieces, giving the same satisfaction as solving a complex jigsaw puzzle. Replacing version managers and removing explicit declarations for interpreter compilation with nix develop flake files was totally worth the effort!
I welcome your feedback and recommendations in the comments below, and invite you to subscribe to my Medium for more content on my development adventures!
#Nix #DevelopmentEnvironment #macOS #Ruby #DevOps
https://kitfucoda.medium.com/beyond-rbenv-and-pyenv-achieving-reproducible-dev-setups-with-nix-04b610175a59