Unverified Commit efb2bfaf authored by Mirza Arnaut's avatar Mirza Arnaut
Browse files

apfel-llm: init at 1.0.5

This package enables to run apples foundation models locally on your
MacOS device!
Since it requires swift 6.3.0 to build and nixpkgs provides only 5.10.1,
I opted to package the release output.
Autoupdates and version check are enabled!
parent 7b25dc29
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchurl,
  versionCheckHook,
  nix-update-script,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "apfel-llm";
  version = "1.0.5";

  __structuredAttrs = true;
  strictDeps = true;

  # Building from source requires swift 6.3.0 while nixpkgs only has 5.10.1
  src = fetchurl {
    url = "https://github.com/Arthur-Ficial/apfel/releases/download/v${finalAttrs.version}/apfel-${finalAttrs.version}-arm64-macos.tar.gz";
    hash = "sha256-etEOYkYVPm08SRE3nuKcDigS7lCkUUgMacOl/sLv/1A=";
  };

  sourceRoot = ".";

  dontBuild = true;
  dontConfigure = true;

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    cp apfel $out/bin/
    chmod +x $out/bin/apfel

    runHook postInstall
  '';

  nativeInstallCheckInputs = [ versionCheckHook ];
  doInstallCheck = true;

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Local Apple Intelligence LLM CLI and server";
    homepage = "https://github.com/Arthur-Ficial/apfel";
    changelog = "https://github.com/Arthur-Ficial/apfel/releases/tag/v${finalAttrs.version}";
    license = lib.licenses.mit;
    platforms = [ "aarch64-darwin" ];
    mainProgram = "apfel";
    sourceProvenance = [
      lib.sourceTypes.binaryNativeCode
    ];
  };
})