From 044ddfda70233cf30c7f18858691e9f0b66dc248 Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Wed, 1 Oct 2025 09:38:35 +0200 Subject: [PATCH] chore: add nix-based dev environment Introduce direnv script that ensures nix-direnv 3.1.0 availability Provide flake shell with Bun in devShells.default to standardize tooling Ignore Direnv artifacts so Bun projects avoid committing local state --- .envrc | 9 ++++++ .gitignore | 4 +++ flake.lock | 61 +++++++++++++++++++++++++++++++++++ flake.nix | 27 ++++++++++++++++ scripts/familiarize.sh | 2 +- scripts/update_vercel_docs.sh | 2 +- 6 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000000..71feb50b41 --- /dev/null +++ b/.envrc @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if ! has nix_direnv_version || ! nix_direnv_version 3.1.0; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.1.0/direnvrc" "sha256-yMJ2OVMzrFaDPn7q8nCBZFRYpL/f0RcHzhmw/i6btJM=" +fi + +nix_direnv_manual_reload + +use flake . diff --git a/.gitignore b/.gitignore index d25030092b..6f9faad524 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,7 @@ docs/vercel/ # Secrets .env + +# Nix +.envrc +.direnv diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..5850e1a0c8 --- /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": 1759036355, + "narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127", + "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 0000000000..d6729f138e --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + description = "Development environment with Bun"; + + 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 { + buildInputs = with pkgs; [ + bun + git + bash + ]; + }; + } + ); +} + diff --git a/scripts/familiarize.sh b/scripts/familiarize.sh index 429dff4489..b2b6813eb2 100755 --- a/scripts/familiarize.sh +++ b/scripts/familiarize.sh @@ -1,2 +1,2 @@ -#!/bin/bash +#!/usr/bin/env bash git log -n 5 --pretty=full diff --git a/scripts/update_vercel_docs.sh b/scripts/update_vercel_docs.sh index a02e9cfd94..6a558982af 100755 --- a/scripts/update_vercel_docs.sh +++ b/scripts/update_vercel_docs.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e