From 4187808cf223612395bc7409d846d61da82a4e77 Mon Sep 17 00:00:00 2001 From: Daniel Montilla Date: Mon, 31 Aug 2026 17:45:54 -0400 Subject: [PATCH 1/2] feat: add Nix dev shell for Node, Python, and Go toolchains Signed-off-by: Daniel Montilla --- flake.lock | 61 +++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4028206 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1788179007, + "narHash": "sha256-hn1oU2rue2SYK8dAr8+WNZWtbsz1S2W5mnHlSEuh3bo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "34ab99075ac4f7e40cf037eef32cb1c360bb85e9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fcf6ce5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,69 @@ +{ + description = "Leji dev environment — Node 24, Python 3.12, Go 1.26.6"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + nodejs_24 + python312 + python312Packages.pip + go + goreleaser + git + jq + ]; + + shellHook = '' + if [ -z "$NO_COLOR" ] && [ -t 1 ]; then + _R=$(printf '\033[0m') + _B=$(printf '\033[38;2;0;159;113m') + _D=$(printf '\033[38;2;24;61;59m') + _M=$(printf '\033[38;2;112;216;194m') + _DIM=$(printf '\033[2m') + _BD=$(printf '\033[1m') + else + _R=""; _B=""; _D=""; _M=""; _DIM=""; _BD="" + fi + _node=$(node --version 2>/dev/null || echo "—") + _py=$(python3 --version 2>&1 | awk '{print $2}'); [ -z "$_py" ] && _py="—" + _pip=$(pip --version 2>/dev/null | awk '{print $2}'); [ -z "$_pip" ] && _pip="—" + _go=$(go version 2>/dev/null | awk '{print $3}' | sed 's/go//'); [ -z "$_go" ] && _go="—" + _gr=$(goreleaser --version 2>/dev/null | head -n1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n1); [ -z "$_gr" ] && _gr="—" + _git=$(git --version 2>/dev/null | awk '{print $3}'); [ -z "$_git" ] && _git="—" + _jq=$(jq --version 2>/dev/null | sed 's/jq-//'); [ -z "$_jq" ] && _jq="—" + printf "\n" + printf " %s%sleji%s %s•%s %sdevelopment shell%s\n" "$_B" "$_BD" "$_R" "$_M" "$_R" "$_DIM" "$_R" + printf "\n" + printf " %s─ packages ─────────────────────────────────────%s\n" "$_DIM" "$_R" + printf " %s◆%s %-12s %s%s%s %s(%s)%s\n" "$_M" "$_R" "node" "$_BD" "$_node" "$_R" "$_DIM" "nodejs_24" "$_R" + printf " %s◆%s %-12s %s%s%s %s(%s, pip %s)%s\n" "$_M" "$_R" "python" "$_BD" "$_py" "$_R" "$_DIM" "python312" "$_pip" "$_R" + printf " %s◆%s %-12s %s%s%s %s(%s)%s\n" "$_M" "$_R" "go" "$_BD" "$_go" "$_R" "$_DIM" "go 1.26.6" "$_R" + printf " %s◆%s %-12s %s%s%s %s(%s)%s\n" "$_M" "$_R" "goreleaser" "$_BD" "$_gr" "$_R" "$_DIM" "goreleaser" "$_R" + printf " %s◆%s %-12s %s%s%s %s(%s)%s\n" "$_M" "$_R" "git" "$_BD" "$_git" "$_R" "$_DIM" "git" "$_R" + printf " %s◆%s %-12s %s%s%s %s(%s)%s\n" "$_M" "$_R" "jq" "$_BD" "$_jq" "$_R" "$_DIM" "jq" "$_R" + printf " %s────────────────────────────────────────────────%s\n" "$_DIM" "$_R" + printf "\n" + unset _R _B _D _M _DIM _BD _node _py _pip _go _gr _git _jq + ''; + + env.PYTHON = "${pkgs.python312}/bin/python3"; + }; + } + ); +} From 9d478fde4388972c51a58b6ff03bffd855817076 Mon Sep 17 00:00:00 2001 From: Daniel Montilla Date: Mon, 31 Aug 2026 17:45:55 -0400 Subject: [PATCH 2/2] docs: document Nix dev shell shortcut Signed-off-by: Daniel Montilla --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f2d8bc9..7ace349 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,6 +13,8 @@ npm test # runs the Node, Python, and Go suites Prerequisites: Node 24+, a Python >=3.10 (the Python SDK pins 3.12 via `packages/sdk-py/.python-version`), and Go 1.26.6+. The `setup:*` scripts detect each toolchain and print install hints if it is missing. Both are idempotent and machine-local (the Python `.venv` is git-ignored), so re-run them after cloning or switching machines. +> **Nix shortcut:** with [Nix](https://nixos.org/download/) installed, `nix develop` (from the repo root, see [`flake.nix`](flake.nix)) drops you into a shell with Node 24, Python 3.12, Go 1.26.6, `goreleaser`, `git`, and `jq` pre-installed — no manual toolchain setup needed. Note that `nix develop` always starts `bash`; to keep your own shell, run `nix develop -c fish` (or `zsh`, etc. — any shell already installed on your system). Direnv users can `echo "use flake" > .envrc && direnv allow` instead; direnv keeps your current shell. + **Running your work-in-progress CLI**, two channels, one machine-wide at a time: - `npm run cli:live` links the source tree; rebuilds flow through instantly. For iterating.