Skip to content

Commit 33df609

Browse files
committed
add monorepo support
1 parent eecaa73 commit 33df609

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

flake.nix

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
description = "Eliza - An extensible AI agent framework";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = {
10+
self,
11+
nixpkgs,
12+
flake-utils,
13+
}:
14+
flake-utils.lib.eachDefaultSystem (
15+
system: let
16+
pkgs = nixpkgs.legacyPackages.${system};
17+
in {
18+
packages.default = pkgs.buildNpmPackage {
19+
pname = "eliza";
20+
version = "0.0.1";
21+
22+
src = ./.;
23+
24+
npmDepsHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
25+
26+
nativeBuildInputs = with pkgs; [
27+
nodejs_23
28+
python3
29+
pkg-config
30+
nodePackages.pnpm
31+
];
32+
33+
buildInputs = with pkgs; [
34+
vips
35+
ffmpeg
36+
];
37+
38+
# Use pnpm instead of npm
39+
npmPackageManager = "pnpm";
40+
41+
# Generate package-lock.json for Nix build
42+
preBuildPhase = ''
43+
export HOME=$(mktemp -d)
44+
pnpm install --frozen-lockfile
45+
'';
46+
47+
buildPhase = ''
48+
pnpm run build
49+
'';
50+
51+
installPhase = ''
52+
mkdir -p $out/bin $out/lib
53+
cp -r packages/core/dist/* $out/lib/
54+
cat > $out/bin/eliza <<EOF
55+
#!/bin/sh
56+
exec ${pkgs.nodejs_23}/bin/node $out/lib/index.js "\$@"
57+
EOF
58+
chmod +x $out/bin/eliza
59+
'';
60+
};
61+
62+
devShell = pkgs.mkShell {
63+
buildInputs = with pkgs; [
64+
nodejs_23
65+
python3
66+
pkg-config
67+
nodePackages.pnpm
68+
vips
69+
ffmpeg
70+
nodePackages.typescript
71+
nodePackages.typescript-language-server
72+
];
73+
74+
shellHook = ''
75+
export PATH="$PWD/node_modules/.bin:$PATH"
76+
'';
77+
};
78+
}
79+
);
80+
}

0 commit comments

Comments
 (0)