Skip to content

Commit adb7a9e

Browse files
authored
feat: add Nix development environment (#441)
1 parent 2e21f2e commit adb7a9e

File tree

3 files changed

+189
-0
lines changed

3 files changed

+189
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ Our current focus is on refining and enhancing these core features while buildin
3333
- [psteinroe](https://github.com/psteinroe)
3434
- [juleswritescode](https://github.com/juleswritescode)
3535

36+
## Development
37+
38+
### Using Nix
39+
40+
```bash
41+
nix develop
42+
docker-compose up -d
43+
```
44+
45+
### Using Docker
46+
47+
```bash
48+
docker-compose up -d
49+
```
50+
3651
## Acknowledgements
3752

3853
A big thanks to the following projects, without which this project wouldn't have been possible:

flake.lock

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
description = "PostgreSQL Language Server Development Environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
rust-overlay = {
8+
url = "github:oxalica/rust-overlay";
9+
inputs.nixpkgs.follows = "nixpkgs";
10+
};
11+
};
12+
13+
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
14+
flake-utils.lib.eachDefaultSystem (system:
15+
let
16+
overlays = [ (import rust-overlay) ];
17+
pkgs = import nixpkgs {
18+
inherit system overlays;
19+
};
20+
21+
# Read rust-toolchain.toml to get the exact Rust version
22+
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
23+
24+
# Development dependencies
25+
buildInputs = with pkgs; [
26+
# Rust toolchain
27+
rustToolchain
28+
29+
# Node.js ecosystem
30+
bun
31+
nodejs_20
32+
33+
# Python for additional tooling
34+
python3
35+
python3Packages.pip
36+
37+
# System dependencies
38+
pkg-config
39+
openssl
40+
41+
# Build tools
42+
just
43+
git
44+
45+
# LSP and development tools
46+
rust-analyzer
47+
48+
# Additional tools that might be needed
49+
cmake
50+
gcc
51+
libiconv
52+
];
53+
54+
# Environment variables
55+
env = {
56+
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
57+
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
58+
};
59+
60+
in
61+
{
62+
devShells.default = pkgs.mkShell {
63+
inherit buildInputs;
64+
65+
shellHook = ''
66+
echo "PostgreSQL Language Server Development Environment"
67+
echo "Available tools:"
68+
echo " • Rust $(rustc --version)"
69+
echo " • Node.js $(node --version)"
70+
echo " • Bun $(bun --version)"
71+
echo " • Just $(just --version)"
72+
echo ""
73+
echo "Development Commands:"
74+
echo " • just --list # Show tasks"
75+
echo " • cargo check # Check Rust"
76+
echo " • bun install # Install deps"
77+
echo ""
78+
echo "Use Docker for database:"
79+
echo " • docker-compose up -d"
80+
echo ""
81+
82+
# Set environment variables
83+
${pkgs.lib.concatStringsSep "\n"
84+
(pkgs.lib.mapAttrsToList (name: value: "export ${name}=\"${value}\"") env)}
85+
'';
86+
};
87+
88+
# Formatter for nix files
89+
formatter = pkgs.nixfmt-rfc-style;
90+
}
91+
);
92+
}

0 commit comments

Comments
 (0)