forked from supabase-community/postgres-language-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
106 lines (91 loc) · 2.75 KB
/
flake.nix
File metadata and controls
106 lines (91 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
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
# Docker
docker-compose
# LSP and development tools
rust-analyzer
# Additional tools that might be needed
cmake
gcc
libiconv
llvmPackages.clang
llvmPackages.libclang
];
# Environment variables
env = {
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
};
in
{
devShells.default = pkgs.mkShell {
inherit buildInputs;
hardeningDisable = [ "fortify" ];
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;
}
);
}