-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
146 lines (120 loc) · 4.81 KB
/
flake.nix
File metadata and controls
146 lines (120 loc) · 4.81 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# SPDX-License-Identifier: PMPL-1.0-or-later
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
#
# Nix flake for Bundle of Joy Server
#
# NOTE: guix.scm is the PRIMARY development environment. This flake is provided
# as a FALLBACK for contributors who use Nix instead of Guix. The .envrc checks
# for Guix first, then falls back to Nix.
#
# Usage:
# nix develop # Enter development shell
# nix build # Build the project
# nix flake check # Run checks
{
description = "Bundle of Joy Server — formally verified capability catalogue";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let
pkgs = import nixpkgs { inherit system; };
commonTools = with pkgs; [
git
just
nickel
curl
bash
coreutils
];
languageTools = with pkgs; [
idris2
zig
zls
];
in
{
devShells.default = pkgs.mkShell {
name = "boj-server-dev";
buildInputs = commonTools ++ languageTools;
env = {
PROJECT_NAME = "Bundle of Joy Server";
RSR_TIER = "infrastructure";
};
shellHook = ''
echo ""
echo " Bundle of Joy Server — development shell (Nix)"
echo " Idris2: $(idris2 --version 2>/dev/null | head -1 || echo 'not found')"
echo " Zig: $(zig version 2>/dev/null || echo 'not found')"
echo " Just: $(just --version 2>/dev/null || echo 'not found')"
echo ""
echo " Run 'just' to see available recipes."
echo ""
'';
};
# MCP bridge package (Node.js, zero dependencies)
packages.default = pkgs.stdenv.mkDerivation {
pname = "boj-server";
version = "0.3.1";
src = self;
nativeBuildInputs = with pkgs; [ nodejs makeWrapper ];
dontBuild = true;
installPhase = ''
mkdir -p $out/lib/boj-server $out/bin $out/share/doc/boj-server
# Install MCP bridge
cp -r mcp-bridge $out/lib/boj-server/
cp gemini-extension.json $out/lib/boj-server/ 2>/dev/null || true
cp GEMINI.md $out/lib/boj-server/ 2>/dev/null || true
# Wrapper script
makeWrapper ${pkgs.nodejs}/bin/node $out/bin/boj-server \
--add-flags "$out/lib/boj-server/mcp-bridge/main.js"
# Documentation
cp README.adoc $out/share/doc/boj-server/ 2>/dev/null || true
cp CHANGELOG.md $out/share/doc/boj-server/ 2>/dev/null || true
cp docs/GETTING-STARTED.md $out/share/doc/boj-server/ 2>/dev/null || true
'';
meta = with pkgs.lib; {
description = "Bundle of Joy — cartridge-based MCP server with 53 formally verified domain cartridges";
homepage = "https://github.com/hyperpolymath/boj-server";
license = licenses.mpl20; # PMPL-1.0-or-later extends MPL-2.0
mainProgram = "boj-server";
maintainers = [];
platforms = [ "x86_64-linux" "aarch64-linux" ];
};
};
# Full build with Zig FFI (for contributors/developers)
packages.full = pkgs.stdenv.mkDerivation {
pname = "boj-server-full";
version = "0.3.1";
src = self;
nativeBuildInputs = with pkgs; [ zig nodejs makeWrapper ];
buildPhase = ''
cd ffi/zig && zig build -Doptimize=ReleaseSafe
'';
installPhase = ''
mkdir -p $out/lib/boj-server $out/bin $out/share/doc/boj-server
# Install MCP bridge
cp -r mcp-bridge $out/lib/boj-server/
# Install FFI shared libraries
mkdir -p $out/lib/boj-server/ffi
cp ffi/zig/zig-out/lib/*.so $out/lib/boj-server/ffi/ 2>/dev/null || true
# Wrapper script
makeWrapper ${pkgs.nodejs}/bin/node $out/bin/boj-server \
--add-flags "$out/lib/boj-server/mcp-bridge/main.js" \
--set LD_LIBRARY_PATH "$out/lib/boj-server/ffi"
cp README.adoc $out/share/doc/boj-server/ 2>/dev/null || true
'';
meta = with pkgs.lib; {
description = "Bundle of Joy — full build with Zig FFI shared libraries";
homepage = "https://github.com/hyperpolymath/boj-server";
license = licenses.mpl20; # PMPL-1.0-or-later extends MPL-2.0
mainProgram = "boj-server";
maintainers = [];
platforms = [ "x86_64-linux" "aarch64-linux" ];
};
};
}
);
}