Down the nix rabbit hole
I've written a few posts regarding #Nix, recently I've reproduced my entire machine configuration utilizing Nix (with a smattering of brew, driven by nix, for packages that are not yet supported by nix-darwin). Here is what I have learned.
1) Because Nix has 'evolved' over time there are multiple ways to do most things. Use flakes and home-manager and don't look back. You can thank me later.
2) Not only does Nix provide package management but it also allows you to manage dot files, secrets, application configuration (vim, emacs, email, etc...). Once you start understanding it you won't want to stop.
3) Start simple, and grow. I made the 'mistake' of starting on a fresh machine and was beating my head against the wall with more complex tasks like configuring Neovim and Emacs... Partially because I didn't have a working editor.
4) Get the application you are working on configured outside of nix (use nix to install it)... Then 'nixify' the configuration for posterity sake. This ensure's you aren't learning nix and how to configure an application at the same time.
5) Use devenv or dev box to install sdk's and project related tools. This keeps your 'global' application space clean and avoids dependency collisions. It also means another developer can recreate your environment by simply cd'ing into the directory (assuming you have direnv setup). This is a productivity game changer. I've worked with multiple organizations where it takes days (literally) to get a local development environment setup.... Use Nix and thank me later!
6) Break your world with a package update? Simply roll back to a previous generation and 'fix' it... Work on upgrading later while you continue to be productive. This is the ultimate 'feature' of Nix. Can't tell you how many times a brew upgrade or topgrade broke my world and lost a day troubleshooting.
I will be sharing some particularly slick parts of my configuration and a few development environments going forward so stay tuned.
Transformational Technology Leader | Results-Focused | Culture Builder
10 个月Thanks for sharing your "Lessons Learned." Can you remind me what lead you to Nix? I keep a setup doc (Markdown file with app list and config instructions), a current Brewfile, and a dotfiles repo on GitHub that has been working for me. Curious if we wanted to go from something similar to a fully-automated build/setup process? I could definitely improve upon my process by getting the config steps moved from my md file into an executable script.