BLP Workspace Shell
This file defines the development shell that I use for my work at BLP Digital.
It ensures that all necessary tools and dependencies are available when entering the workspace, and runs a one-time setup script to initialize everything.
As always, this file is tangled from Org Mode, and lives in:
.workspaces/blp/shell.nix
We begin by importing nixpkgs
as usual:
{ pkgs ? import <nixpkgs> {} }:
We define a mkShell
environment with all the tools needed for development:
pkgs.mkShell { buildInputs = with pkgs; [ golangci-lint golangci-lint-langserver pre-commit nixfmt-classic google-cloud-sdk buf protobuf go git dotnet-sdk_9 nodePackages.prettier ];
The following shellHook
runs automatically when the shell is entered. It performs a one-time setup, guarded by a sentinel file in .git/setup_executed
.
This includes:
- Initializing Git submodules
- Installing pre-commit hooks
- Running the
Makefile
targetlocal_setup
shellHook = '' cd document-api if [ ! -f .git/setup_executed ]; then echo "Getting submodules" git submodule update --init --recursive
echo "Installing pre-commit hooks" pre-commit install
echo "Running Makefile" make local_setup
echo "Setup complete" echo 'true' > .git/setup_executed fi '';}
This approach ensures that setup tasks run exactly once, speeding up subsequent shell entries while still initializing a fully working environment on first use.
The result is a reproducible, ergonomic workspace, bootstrapped with zero friction.