forked from spacedriveapp/spacebot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
142 lines (127 loc) · 3.83 KB
/
flake.nix
File metadata and controls
142 lines (127 loc) · 3.83 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
{
description = "Spacebot - An AI agent for teams, communities, and multi-user environments";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane = {
url = "github:ipetkov/crane";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
crane,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
};
inherit (pkgs) bun;
craneLib = crane.mkLib pkgs;
cargoSrc = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
./Cargo.toml
./Cargo.lock
./build.rs
./src
./migrations
./prompts
./presets
./docs/content
./docs/README.md
./docs/docker.md
./docs/metrics.md
./AGENTS.md
./README.md
./CHANGELOG.md
./.cargo/config.toml
(pkgs.lib.fileset.maybeMissing ./interface/dist)
./vendor
];
};
runtimeAssetsSrc = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
./migrations
./prompts
];
};
frontendSrc = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
./interface/package.json
./interface/bun.lock
./interface/index.html
./interface/tsconfig.json
./interface/tsconfig.node.json
./interface/vite.config.ts
./interface/postcss.config.js
./interface/tailwind.config.ts
./interface/public
./interface/src
];
};
spacebotPackages = import ./nix {
inherit pkgs craneLib cargoSrc runtimeAssetsSrc frontendSrc;
};
inherit (spacebotPackages) frontend frontendNodeModules spacebot spacebot-full spacebot-tests;
in {
packages = {
default = spacebot;
inherit frontend spacebot spacebot-full;
# Updater for frontend deps - run this to get the correct hash after updating interface deps
# Usage: nix build .#frontend-updater 2>&1 | grep "got:" | awk '{print $2}'
frontend-updater = frontendNodeModules { hash = pkgs.lib.fakeHash; };
};
devShells = {
default = pkgs.mkShell {
packages = with pkgs; [
rustc
cargo
rustfmt
rust-analyzer
clippy
bun
nodejs
protobuf
cmake
openssl
pkg-config
onnxruntime
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.chromium ];
ORT_LIB_LOCATION = "${pkgs.onnxruntime}/lib";
CHROME_PATH = if pkgs.stdenv.isLinux then "${pkgs.chromium}/bin/chromium" else "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
CHROME_FLAGS = "--no-sandbox --disable-dev-shm-usage --disable-gpu";
};
backend = pkgs.mkShell {
packages = with pkgs; [
rustc
cargo
rustfmt
rust-analyzer
clippy
protobuf
cmake
openssl
pkg-config
onnxruntime
];
ORT_LIB_LOCATION = "${pkgs.onnxruntime}/lib";
};
};
checks = {
inherit spacebot spacebot-full spacebot-tests;
};
}
)
// {
overlays.default = final: {
inherit (self.packages.${final.system}) spacebot spacebot-full;
};
nixosModules.default = import ./nix/module.nix self;
};
}