This repository was archived by the owner on Dec 27, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
90 lines (82 loc) · 2.59 KB
/
flake.nix
File metadata and controls
90 lines (82 loc) · 2.59 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
{
description = "Probitas CLI - Command-line interface for Probitas";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
let
# Overlay that adds probitas to pkgs
overlay = final: prev: {
probitas = prev.writeShellApplication {
name = "probitas";
runtimeInputs = [
prev.deno
prev.coreutils
# Native library dependencies for database clients
prev.stdenv.cc.cc.lib
prev.sqlite
prev.duckdb
];
text = ''
export DENO_NO_UPDATE_CHECK=1
# Add native library paths for database clients (FFI support)
export LD_LIBRARY_PATH="${prev.lib.makeLibraryPath [
prev.stdenv.cc.cc.lib
prev.sqlite
prev.duckdb
]}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
# Copy lock file to writable location to avoid /nix/store read-only errors
TEMP_LOCK=$(mktemp)
cp ${self}/deno.lock "$TEMP_LOCK"
trap 'rm -f "$TEMP_LOCK"' EXIT
exec deno run -A \
--unstable-kv \
--config=${self}/deno.json \
--lock="$TEMP_LOCK" \
${self}/mod.ts "$@"
'';
};
};
in
{
# Overlay for easy integration
overlays.default = overlay;
}
//
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ overlay ];
};
in
{
packages = {
inherit (pkgs) probitas;
default = pkgs.probitas;
};
apps.default = flake-utils.lib.mkApp {
drv = pkgs.probitas;
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
deno
# Native library dependencies for database clients
stdenv.cc.cc.lib # C++ standard library (required by most native bindings)
sqlite # SQLite library (for @db/sqlite via FFI)
duckdb # DuckDB library (for @duckdb/node-api)
];
shellHook = ''
# Add native library paths for database clients
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [
pkgs.stdenv.cc.cc.lib
pkgs.sqlite
pkgs.duckdb
]}:$LD_LIBRARY_PATH"
echo "Entering Probitas CLI development environment"
'';
};
}
);
}