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" bytes = "1.7.1"
state-machines = "0.2.0" state-machines = "0.2.0"
fastembed = "5.2.0" fastembed = "5.2.0"
ort = { version = "=2.0.0-rc.8", default-features = false, features = ["load-dynamic"] }
[profile.dist] [profile.dist]
inherits = "release" inherits = "release"

16
flake.lock generated
View File

@@ -1,5 +1,20 @@
{ {
"nodes": { "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": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@@ -36,6 +51,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"crane": "crane",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }

View File

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