Rewiring

Finding my dev env zen

A dev container with all the development requirements, NeoVim and a bot harness - perfection

Over the years I've done a few 'migrations' of my developer environment. Initially I started with Visual Studio, which was the natural choice for .NET work at the time. With .NET Core I switched to Rider, which I still recommend if you want to work on .NET with a graphical IDE. This move wasn't really life changing, but pretty much everything felt nicer and fit my mental model better than before.

For the past six months I've been feeling snug on NeoVim and loving the minimalist terminal based setup. I run it on a Ubuntu VM - using the 'free' Azure credits from the otherwise useless Visual Studio license - limiting the blast radius of possible supply chain attacks and such.

The newest incarnation uses dev containers for bundling every dev requirement in one neat package. These abstract away things like like node/dotnet/java/whatever runtime and CLI tools so for most projects the setup is:

  1. git clone
  2. open the dev container in your editor

Terminal based editors like NeoVim can be run inside the dev container, so the container truly has the whole dev env covered. I use dev container features (my implementation) and a simple helper script for bringing nvim and pi into any devcontainer-enabled project I run.

This way the setup is easily repeatable (pull the config, add devc to PATH), so if I ever need to reset the VM or, I dunno, want to run this on a Steam Deck for some reason, it doesn't take many minutes to get up and running.

The road goes ever on and on

Although I'm very comfortable with the current setup, there's still lots to do. A dotfiles repo is one thing to explore to ease the setup even further. Another is to add something like nono to shield any credentials and other secrets from the bots.

The waste of resources bothers me a bit. The containers are isolated for security, meaning that e.g. nvim or pi setup is not shared between projects. That means wasted cycles, bandwidth and storage as the same dependencies are downloaded and stored separately for each project. That's a shame, but security is always a tradeoff, and here I think it is warranted.

I stopped sharing those resources after I had a bot try a 'capture the flag' type deal to break out of the container. It created a 'backdoor' plugin for the shared nvim, which would've gotten the flag the next time I ran it on the plain host. Lesson learnt, isolation improved, bits and watts wasted.

How to get started

If terminal based editing is something you enjoy - or think you might - I recommend giving this approach a try! Get a general understanding of dev containers from the docs and then set a bot to work for the boilerplate. When that works - with either the devcontainer CLI or e.g. VS Code - look into the library of features or create your own to bundle in the tools that you like but are not part of every team member's workflow. Playing around for an hour or two is probably enough to have a working setup to start working in and improving upon.

Thoughts, comments? Send me an email!

#ide #nvim #tech