Skip to content

Instantly share code, notes, and snippets.

@bcardiff
Created April 24, 2026 03:22
Show Gist options
  • Select an option

  • Save bcardiff/9caf598bc26785c472979a7f8fcfdb5a to your computer and use it in GitHub Desktop.

Select an option

Save bcardiff/9caf598bc26785c472979a7f8fcfdb5a to your computer and use it in GitHub Desktop.
devenv setup
#!/usr/bin/env bash
export DIRENV_WARN_TIMEOUT=20s
# Use shell.nix for devenv to ensure we all use the same version
use nix
eval "$(devenv direnvrc)"
use devenv
dotenv_if_exists

The following is a setup to use devenv that requires just nix to be installed. The shell.nix is pinned to a stable release eg: 25.11 to install devenv, and then devenv is pinned to the same table release.

After running devenv init be sure that devenv.yaml is pinned to the same nixpkgs of shell.nix to reuse the same stable artifacts.

The .envrc enable the usage of direnv which is handle for the terminal and can also be used by VSCode via https://marketplace.visualstudio.com/items?itemName=mkhl.direnv

inputs:
nixpkgs:
url: github:NixOS/nixpkgs/871b9fd269ff6246794583ce4ee1031e1da71895
# Pin nixpkgs to ensure all developers use the same version of devenv.
#
# To update: change the rev below and run:
# nix-prefetch-url --unpack https://github.com/NixOS/nixpkgs/archive/<NEW_REV>.tar.gz
# Then replace the sha256 with the output.
{
pkgs ? import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/871b9fd269ff6246794583ce4ee1031e1da71895.tar.gz";
sha256 = "1zn1lsafn62sz6azx6j735fh4vwwghj8cc9x91g5sx2nrg23ap9k";
}) {}
}:
pkgs.mkShell {
buildInputs = with pkgs; [
devenv
];
shellHook = ''
echo "devenv environment loaded"
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment