A while back I started to use nixos as a system to configure my dev environment across both MacOS and linux. This allows me to have one script to rule them all.
As a byproduct, a combination of nix and direnv can be used to manage project dependencies and replace asdf allowing me to remove it.
# .envrc
use nix
# shell.nix
{pkgs ? import <nixpkgs> {}}:
with pkgs; # Defines a shell.
mkShell {
# project dependencies
buildInputs = [
git
direnv
go
hugo
];
}
The combination of these files will guarantee that go
and hugo
are available in the project
directory, emulating asdf’s functionality.