fix: updated nix build to work with reranking deps

This commit is contained in:
Per Stark
2025-10-28 22:28:45 +01:00
parent 72578296db
commit 863b921fb4
3 changed files with 44 additions and 26 deletions

View File

@@ -57,6 +57,7 @@ object_store = { version = "0.11.2" }
bytes = "1.7.1"
state-machines = "0.2.0"
fastembed = "5.2.0"
ort = { version = "=2.0.0-rc.8", default-features = false, features = ["load-dynamic"] }
[profile.dist]
inherits = "release"

16
flake.lock generated
View File

@@ -1,5 +1,20 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1760924934,
"narHash": "sha256-tuuqY5aU7cUkR71sO2TraVKK2boYrdW3gCSXUkF4i44=",
"owner": "ipetkov",
"repo": "crane",
"rev": "c6b4d5308293d0d04fcfeee92705017537cad02f",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@@ -36,6 +51,7 @@
},
"root": {
"inputs": {
"crane": "crane",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}

View File

@@ -4,60 +4,61 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-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 = nixpkgs.legacyPackages.${system};
craneLib = crane.mkLib pkgs;
# --- Minne Package Definition ---
minne-pkg = pkgs.rustPlatform.buildRustPackage {
minne-pkg = craneLib.buildPackage {
src = craneLib.cleanCargoSource ./.;
pname = "minne";
version = "0.1.0";
src = self;
cargoLock = {
lockFile = ./Cargo.lock;
};
# Skip tests due to testing fs operations
doCheck = false;
nativeBuildInputs = [
pkgs.pkg-config
pkgs.rustfmt
pkgs.makeWrapper # For the postInstall hook
pkgs.makeWrapper
];
buildInputs = [
pkgs.openssl
pkgs.chromium # Runtime dependency for the browser
pkgs.chromium
pkgs.onnxruntime
];
# Wrap the actual executables to provide CHROME at runtime
postInstall = let
chromium_executable = "${pkgs.chromium}/bin/chromium";
in ''
wrapProgram $out/bin/main \
--set CHROME "${chromium_executable}"
wrapProgram $out/bin/worker \
--set CHROME "${chromium_executable}"
'';
ORT_STRATEGY = "system";
ORT_LIB_LOCATION = "${pkgs.onnxruntime}/lib";
ORT_SKIP_DOWNLOAD = "1";
meta = with pkgs.lib; {
description = "Minne Application";
license = licenses.mit;
};
postInstall = ''
wrapProgram $out/bin/main \
--set CHROME ${pkgs.chromium}/bin/chromium \
--set ORT_DYLIB_PATH ${pkgs.onnxruntime}/lib/libonnxruntime.so
if [ -f $out/bin/worker ]; then
wrapProgram $out/bin/worker \
--set CHROME ${pkgs.chromium}/bin/chromium \
--set ORT_DYLIB_PATH ${pkgs.onnxruntime}/lib/libonnxruntime.so
fi
if [ -f $out/bin/server]; then
wrapProgram $out/bin/server\
--set ORT_DYLIB_PATH ${pkgs.onnxruntime}/lib/libonnxruntime.so
fi
'';
};
in {
packages = {
minne = minne-pkg;
default = self.packages.${system}.minne;
default = self.packages.${system}.minne-pkg;
};
apps = {