mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-27 02:34:53 +00:00
124 lines
2.6 KiB
Nix
124 lines
2.6 KiB
Nix
{
|
|
lib,
|
|
stdenvNoCC,
|
|
bun,
|
|
fetchFromGitHub,
|
|
nix-update-script,
|
|
writableTmpDirAsHomeHook,
|
|
}:
|
|
let
|
|
node_modules =
|
|
finalAttrs:
|
|
stdenvNoCC.mkDerivation {
|
|
pname = "${finalAttrs.pname}-node_modules";
|
|
inherit (finalAttrs) version src;
|
|
|
|
__structuredAttrs = true;
|
|
strictDeps = true;
|
|
|
|
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
|
|
"GIT_PROXY_COMMAND"
|
|
"SOCKS_SERVER"
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
bun
|
|
writableTmpDirAsHomeHook
|
|
];
|
|
|
|
dontConfigure = true;
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
bun install \
|
|
--cpu="*" \
|
|
--frozen-lockfile \
|
|
--ignore-scripts \
|
|
--no-progress \
|
|
--os="*"
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out
|
|
find . -type d -name node_modules -exec cp -R --parents {} $out \;
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
# NOTE: Required else we get errors that our fixed-output derivation references store paths
|
|
dontFixup = true;
|
|
|
|
outputHash = "sha256-aL2kNCYF6Y4QnEvlpQ9U5Qe+K8a1J2X7BvJqE+BnRcY=";
|
|
outputHashAlgo = "sha256";
|
|
outputHashMode = "recursive";
|
|
};
|
|
in
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
pname = "models-dev";
|
|
version = "sdk-v0.0.5-unstable-2026-08-13";
|
|
|
|
__structuredAttrs = true;
|
|
strictDeps = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "anomalyco";
|
|
repo = "models.dev";
|
|
rev = "7ac862dc68caf19a58214dc9b0e6463ed641aeb0";
|
|
hash = "sha256-bPsBe/qIBRsKijdxqpYMSMG4sjXCkCOCe0IzIvSDo+g=";
|
|
};
|
|
|
|
nativeBuildInputs = [ bun ];
|
|
|
|
configurePhase = ''
|
|
runHook preConfigure
|
|
|
|
cp -R ${finalAttrs.passthru.node_modules}/. .
|
|
|
|
runHook postConfigure
|
|
'';
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
cd packages/web
|
|
bun run ./script/build.ts
|
|
bun ${./generate-schema.ts} ./dist/_api.json ./dist/model-schema.json
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/dist
|
|
cp -R ./dist $out
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru = {
|
|
jsonschema = "${finalAttrs.finalPackage}/dist/model-schema.json";
|
|
node_modules = node_modules finalAttrs;
|
|
updateScript = nix-update-script {
|
|
extraArgs = [
|
|
"--version=branch"
|
|
"--subpackage"
|
|
"node_modules"
|
|
];
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
description = "Comprehensive open-source database of AI model specifications, pricing, and capabilities";
|
|
homepage = "https://github.com/anomalyco/models.dev";
|
|
license = lib.licenses.mit;
|
|
platforms = lib.platforms.unix;
|
|
maintainers = with lib.maintainers; [ delafthi ];
|
|
};
|
|
})
|