Skip to content

feat: add Nix development environment #441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ 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
```

### Using Docker

```bash
docker-compose up -d
```

## Acknowledgements

A big thanks to the following projects, without which this project wouldn't have been possible:
Expand Down
82 changes: 82 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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;
}
);
}