-
Notifications
You must be signed in to change notification settings - Fork 309
Expand file tree
/
Copy pathflake.nix
More file actions
139 lines (116 loc) · 4.01 KB
/
flake.nix
File metadata and controls
139 lines (116 loc) · 4.01 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
{
description = "Embabel Agent Framework - JVM-based AI agent framework";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
jdk = pkgs.jdk21; # Spring Boot 3.x requires JDK 17+, JDK 21 is LTS
# Build the project
embabel-agent = pkgs.stdenv.mkDerivation {
pname = "embabel-agent";
version = "0.1.0-SNAPSHOT";
src = ./.;
nativeBuildInputs = [ pkgs.makeWrapper ];
buildInputs = [ jdk pkgs.maven ];
buildPhase = ''
export JAVA_HOME=${jdk}
mvn clean package -DskipTests
'';
installPhase = ''
mkdir -p $out/lib $out/bin
cp embabel-agent-shell/target/*.jar $out/lib/
makeWrapper ${jdk}/bin/java $out/bin/embabel-agent \
--add-flags "-jar $out/lib/embabel-agent-shell-*.jar" \
--set JAVA_HOME ${jdk}
'';
};
in
{
packages = {
default = embabel-agent;
inherit embabel-agent;
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Java/Kotlin development
jdk
maven
kotlin
gradle # Alternative build tool
# Development tools
jdt-language-server # Java LSP
kotlin-language-server
# Database tools (for testing)
postgresql
redis
# Container tools
docker
docker-compose
# Additional tools
git
jq
httpie
curl
# IDE support
jetbrains.idea-community
];
shellHook = ''
export JAVA_HOME=${jdk}
export PATH=$JAVA_HOME/bin:$PATH
echo "Embabel Agent Development Environment"
echo "====================================="
echo "Java version: $(java -version 2>&1 | head -n 1)"
echo "Maven version: $(mvn -version | head -n 1)"
echo "Kotlin version: $(kotlin -version 2>&1)"
echo ""
echo "Common commands:"
echo " mvn clean install - Build entire project"
echo " mvn test - Run tests"
echo " mvn spring-boot:run - Run application"
echo ""
echo "Run with shell profile:"
echo " mvn spring-boot:run -Dspring.profiles.active=shell"
echo ""
echo "Environment variables needed:"
echo " export OPENAI_API_KEY=your-key"
echo " export ANTHROPIC_API_KEY=your-key (optional)"
'';
};
# Additional specialized shells
devShells = {
# Minimal shell for CI/CD
ci = pkgs.mkShell {
buildInputs = with pkgs; [
jdk
maven
];
shellHook = ''
export JAVA_HOME=${jdk}
'';
};
# Shell with documentation tools
docs = pkgs.mkShell {
buildInputs = with pkgs; [
jdk
maven
asciidoctor
graphviz # For dot files
pandoc
];
shellHook = ''
export JAVA_HOME=${jdk}
echo "Documentation shell - includes AsciiDoc tools"
echo "Build docs with: mvn clean install -Pembabel-agent-docs"
'';
};
};
# Provide a simple app runner
apps.default = flake-utils.lib.mkApp {
drv = embabel-agent;
};
});
}