From 60d398ea366d80e0867b7c817552dc64d09239e3 Mon Sep 17 00:00:00 2001 From: psteinroe Date: Thu, 3 Jul 2025 22:49:35 +0200 Subject: [PATCH 1/2] feat: add Nix development environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Nix flake for reproducible development environment with: - Rust toolchain (from rust-toolchain.toml) - Node.js ecosystem (Bun, Node.js) - Python for additional tooling - Build tools (just, git, rust-analyzer) - System dependencies (pkg-config, openssl, cmake, gcc) Usage: `nix develop` to enter development shell Database continues to use Docker as before 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- README.md | 19 +++++++++++ flake.lock | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 193 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/README.md b/README.md index 162bb9c0e..846df1e2a 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,25 @@ Our current focus is on refining and enhancing these core features while buildin - [psteinroe](https://github.com/psteinroe) - [juleswritescode](https://github.com/juleswritescode) +## Development + +### Using Nix + +```bash +nix develop +docker-compose up -d +bun install +cargo check +``` + +### Using Docker + +```bash +docker-compose up -d +bun install +cargo check +``` + ## Acknowledgements A big thanks to the following projects, without which this project wouldn't have been possible: diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..e8bb45768 --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "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": 1751271578, + "narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1751510438, + "narHash": "sha256-m8PjOoyyCR4nhqtHEBP1tB/jF+gJYYguSZmUmVTEAQE=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "7f415261f298656f8164bd636c0dc05af4e95b6b", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "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 000000000..0dac4b195 --- /dev/null +++ b/flake.nix @@ -0,0 +1,92 @@ +{ + description = "PostgreSQL Language Server Development Environment"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, rust-overlay }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + + # Read rust-toolchain.toml to get the exact Rust version + rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + + # Development dependencies + buildInputs = with pkgs; [ + # Rust toolchain + rustToolchain + + # Node.js ecosystem + bun + nodejs_20 + + # Python for additional tooling + python3 + python3Packages.pip + + # System dependencies + pkg-config + openssl + + # Build tools + just + git + + # LSP and development tools + rust-analyzer + + # Additional tools that might be needed + cmake + gcc + libiconv + ]; + + # Environment variables + env = { + RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; + PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; + }; + + in + { + devShells.default = pkgs.mkShell { + inherit buildInputs; + + shellHook = '' + echo "PostgreSQL Language Server Development Environment" + echo "Available tools:" + echo " • Rust $(rustc --version)" + echo " • Node.js $(node --version)" + echo " • Bun $(bun --version)" + echo " • Just $(just --version)" + echo "" + echo "Development Commands:" + echo " • just --list # Show tasks" + echo " • cargo check # Check Rust" + echo " • bun install # Install deps" + echo "" + echo "Use Docker for database:" + echo " • docker-compose up -d" + echo "" + + # Set environment variables + ${pkgs.lib.concatStringsSep "\n" + (pkgs.lib.mapAttrsToList (name: value: "export ${name}=\"${value}\"") env)} + ''; + }; + + # Formatter for nix files + formatter = pkgs.nixfmt-rfc-style; + } + ); +} \ No newline at end of file From 7997e4e04cdedaabb0e5e290c65ff39e3bdab81d Mon Sep 17 00:00:00 2001 From: psteinroe Date: Thu, 3 Jul 2025 22:50:09 +0200 Subject: [PATCH 2/2] docs: simplify development setup commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove bun install and cargo check from README as they're not required steps 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 846df1e2a..fa18d0fec 100644 --- a/README.md +++ b/README.md @@ -40,16 +40,12 @@ Our current focus is on refining and enhancing these core features while buildin ```bash nix develop docker-compose up -d -bun install -cargo check ``` ### Using Docker ```bash docker-compose up -d -bun install -cargo check ``` ## Acknowledgements