Merge pull request #308621 from eeedean/lmstudio-update

added aarch64-darwin version of lmstudio + updated lmstudio to 0.2.22
This commit is contained in:
Pol Dellaiera 2024-05-06 14:41:49 +02:00 committed by GitHub
commit bc5c1010d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 73 additions and 27 deletions

View file

@ -5700,6 +5700,11 @@
githubId = 54799;
name = "Edward Tjörnhammar";
};
eeedean = {
github = "eeedean";
githubId = 8173116;
name = "Dean Eckert";
};
eelco = {
email = "edolstra+nixpkgs@gmail.com";
github = "edolstra";

View file

@ -0,0 +1,28 @@
{ stdenv
, fetchurl
, undmg
, lib
, meta
, pname
, version
}:
stdenv.mkDerivation {
inherit meta pname version;
src = fetchurl {
url = "https://releases.lmstudio.ai/mac/arm64/${version}/b/latest/LM-Studio-${version}-arm64.dmg";
hash = "sha256-kb1XoTZjhCL1+CsV+r3/EN0srzIJ43H2VMZ779dVq1k=";
};
nativeBuildInputs = [ undmg ];
sourceRoot = ".";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r *.app $out/Applications
runHook postInstall
'';
}

View file

@ -0,0 +1,29 @@
{ lib
, appimageTools
, fetchurl
, version
, pname
, meta
}:
let
src = fetchurl {
url = "https://releases.lmstudio.ai/linux/${version}/beta/LM_Studio-${version}.AppImage";
hash = "sha256-hcV8wDhulFAxHDBDKicpEGovwcsn9RaIi/idUz+YzD8=";
};
appimageContents = appimageTools.extractType2 { inherit pname version src; };
in
appimageTools.wrapType2 {
inherit meta pname version src;
extraPkgs = pkgs: (appimageTools.defaultFhsEnvArgs.multiPkgs pkgs) ++ [ pkgs.ocl-icd ];
extraInstallCommands = ''
mkdir -p $out/share/applications
cp -r ${appimageContents}/usr/share/icons $out/share
install -m 444 -D ${appimageContents}/lm-studio.desktop -t $out/share/applications
substituteInPlace $out/share/applications/lm-studio.desktop \
--replace-fail 'Exec=AppRun --no-sandbox %U' 'Exec=lmstudio'
'';
}

View file

@ -1,38 +1,22 @@
{ lib
, appimageTools
, fetchurl
, stdenv
, callPackage
, ...
}:
let
pname = "lmstudio";
version = "0.2.20";
src = fetchurl {
url = "https://releases.lmstudio.ai/linux/${version}/beta/LM_Studio-${version}.AppImage";
hash = "sha256-T92ZDqGvxJfBkAWsK8EgHdQZnLefK3gDP2vCTL8X+eM=";
};
appimageContents = appimageTools.extractType2 { inherit pname version src; };
in
appimageTools.wrapType2 {
inherit pname version src;
extraPkgs = pkgs: (appimageTools.defaultFhsEnvArgs.multiPkgs pkgs) ++ [ pkgs.ocl-icd ];
extraInstallCommands = ''
mkdir -p $out/share/applications
cp -r ${appimageContents}/usr/share/icons $out/share
install -m 444 -D ${appimageContents}/lm-studio.desktop -t $out/share/applications
substituteInPlace $out/share/applications/lm-studio.desktop \
--replace-fail 'Exec=AppRun --no-sandbox %U' 'Exec=lmstudio'
'';
version = "0.2.22";
meta = {
description = "LM Studio is an easy to use desktop app for experimenting with local and open-source Large Language Models (LLMs)";
homepage = "https://lmstudio.ai/";
license = lib.licenses.unfree;
mainProgram = "lmstudio";
maintainers = with lib.maintainers; [ drupol ];
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ drupol eeedean ];
platforms = lib.platforms.linux ++ [ "aarch64-darwin" ];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
}
in
if stdenv.isDarwin
then callPackage ./darwin.nix { inherit pname version meta; }
else callPackage ./linux.nix { inherit pname version meta; }