-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnif.nix
More file actions
47 lines (41 loc) · 1.63 KB
/
nif.nix
File metadata and controls
47 lines (41 loc) · 1.63 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
# Canonical NIF build configuration for fragmentation.
# Single source of truth for Rust/C deps needed to compile the
# fragmentation Rustler NIF (libgit2 + libssh2 + openssl).
#
# Consumed by:
# - ~/.flakes/flake.nix (shared devShells)
# - project flakes via `inputs.flakes` (glue, witness, fragmentation-repo)
#
# Separate from rust.nix because rust.nix is for pure Rust projects.
# NIF projects need the Rust toolchain PLUS C library deps for libgit2.
{ pkgs, system, rustTools }:
let
# ── C library deps for libgit2-sys / libssh2-sys ───────────────────────────
nativeLibs = [
pkgs.cmake
pkgs.git
pkgs.openssl
pkgs.libssh2
pkgs.zlib
] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
pkgs.libiconv
];
# ── Full NIF build deps: Rust toolchain + C libs ───────────────────────────
# Does NOT include clippy/rustfmt/rust-analyzer — those are dev tools from
# rust.nix, not build requirements.
nifTools = [
pkgs.rustc
pkgs.cargo
pkgs.pkg-config
] ++ nativeLibs;
# ── Environment variables needed by the NIF build ──────────────────────────
nifEnv = {
LIBSSH2_SYS_USE_PKG_CONFIG = "1";
};
# ── Shell hook ─────────────────────────────────────────────────────────────
nifHook = ''
export LIBSSH2_SYS_USE_PKG_CONFIG=1
'';
in {
inherit nifTools nifEnv nifHook nativeLibs;
}