-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathflake.nix
More file actions
115 lines (96 loc) · 2.96 KB
/
Copy pathflake.nix
File metadata and controls
115 lines (96 loc) · 2.96 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
107
108
109
110
111
112
113
114
115
{
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;
# Nightly toolchain for rustfmt (used by codegen)
rustNightly = pkgs.rust-bin.nightly.latest.minimal.override {
extensions = [ "rustfmt" ];
};
# Extract just nightly rustfmt (to avoid nightly rustc taking precedence)
nightlyRustfmtOnly = pkgs.runCommand "nightly-rustfmt" { } ''
mkdir -p $out/bin
ln -s ${rustNightly}/bin/rustfmt $out/bin/rustfmt
'';
# Development dependencies
buildInputs = with pkgs; [
# Nightly rustfmt (for codegen) - must come before stable toolchain
nightlyRustfmtOnly
# Rust toolchain (stable from rust-toolchain.toml)
rustToolchain
# Node.js ecosystem
bun
nodejs_20
# Python for additional tooling
python3
python3Packages.pip
# System dependencies
pkg-config
openssl
# Build tools
just
git
taplo
# Docker
docker-compose
# LSP and development tools
rust-analyzer
# Additional tools that might be needed
cmake
gcc
libiconv
llvmPackages.clang
llvmPackages.libclang
# WebAssembly toolchain
emscripten
tree-sitter
# Database tools
sqlx-cli
];
# 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";
# Emscripten SDK path for WASM builds
EMSDK = "${pkgs.emscripten}";
};
in
{
devShells.default = pkgs.mkShell {
inherit buildInputs;
hardeningDisable = [ "fortify" ];
shellHook = ''
echo "Postgres Language Server Development Environment"
# 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;
}
);
}