forked from BloopAI/bloop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
137 lines (114 loc) · 4.03 KB
/
flake.nix
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
{
description = "bloop";
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 = import nixpkgs { inherit system; };
pkgsStatic = pkgs.pkgsStatic;
lib = pkgs.lib;
llvm = pkgs.llvmPackages_14;
clang = llvm.clang;
libclang = llvm.libclang;
stdenv = llvm.stdenv;
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.cargo;
rustc = pkgs.rustc;
};
runtimeDeps =
with pkgs; ([ openssl_1_1.out rocksdb git zlib ]);
buildDeps = with pkgs;
([
stdenv.cc.cc.lib
glib.dev
pkg-config
openssl_1_1.out
openssl_1_1.dev
protobuf
onnxruntime-static
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Foundation
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.Security
]);
guiDeps = with pkgs;
[ nodePackages.npm nodejs ] ++ (lib.optionals stdenv.isLinux [
zlib.dev
dbus.dev
libsoup.dev
gtk3.dev
webkitgtk
dmidecode
appimage-run
appimagekit
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Carbon
darwin.apple_sdk.frameworks.WebKit
darwin.apple_sdk.frameworks.AppKit
]);
envVars = {
LIBCLANG_PATH = "${libclang.lib}/lib";
ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib";
ROCKSDB_INCLUDE_DIR = "${pkgs.rocksdb}/include";
OPENSSL_LIB_DIR = "${pkgs.openssl_1_1.out}/lib";
OPENSSL_INCLUDE_DIR = "${pkgs.openssl_1_1.dev}/include";
OPENSSL_NO_VENDOR = "1";
ORT_LIB_LOCATION = "${onnxruntime-static}/build";
};
bleep = (rustPlatform.buildRustPackage {
meta = with pkgs.lib; {
description = "Search code. Fast.";
homepage = "https://bloop.ai";
license = licenses.asl20;
platforms = platforms.all;
};
name = "bleep";
pname = "bleep";
src = pkgs.lib.sources.cleanSource ./.;
buildFeatures = [ "dynamic-ort" ];
cargoBuildFlags = "-p bleep";
doCheck = false;
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"hyperpolyglot-0.1.7" =
"sha256-NftH6P+DmT2hggFxpBmvyekA/lv/JhbCJY8iMABhHp8=";
"octocrab-0.17.0" =
"sha256-UoHqwsOhfx5VBrK6z94Jk5aKpCxswcSBhiCNZAyq5a8=";
"tree-sitter-cpp-0.20.0" =
"sha256-h6mJdmQzJlxYIcY+d5IiaFghraUgBGZwqFPKwB3E4pQ=";
"tree-sitter-go-0.19.1" =
"sha256-f885YTswEDH/QfRPUxcLp/1E2zXLKl25R9IyTGKb1eM=";
"tree-sitter-java-0.20.0" =
"sha256-gQzoWGV9wYiLibMFkLoY2sdEJg+ae9NnHt/GFfFzP8U=";
"ort-1.14.0-beta.0" =
"sha256-GLwCOtYOvJWg/tBAuqVqwREaxlxAhL1FJltwF+fWROk=";
};
};
nativeBuildInputs = buildDeps;
buildInputs = runtimeDeps;
}).overrideAttrs (old: envVars);
onnxruntime-static =
import ./nix/onnxruntime.nix { inherit pkgs stdenv; };
in {
packages = {
bleep = bleep;
default = bleep;
docker = pkgs.dockerTools.buildImage {
name = "bleep";
config = { Cmd = [ "${bleep}/bin/bleep" ]; };
extraCommands = ''
ln -s ${bleep}/bin/bleep /bleep
'';
};
onnxruntime-static = onnxruntime-static;
};
devShell = (pkgs.mkShell {
buildInputs = buildDeps ++ runtimeDeps ++ guiDeps
++ (with pkgs; [ git-lfs cargo rustc rustfmt clippy ]);
}).overrideAttrs (old: envVars);
});
}