push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
{
stdenv,
fetchurl,
undmg,
meta,
pname,
version,
url,
hash,
passthru,
}:
stdenv.mkDerivation {
inherit meta pname version;
src = fetchurl {
inherit url hash;
};
nativeBuildInputs = [ undmg ];
sourceRoot = ".";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r *.app $out/Applications
runHook postInstall
'';
# LM Studio ships Scripts inside the App Bundle, which may be messed up by standard fixups
dontFixup = true;
# undmg doesn't support APFS and 7zz does break the xattr. Took that approach from https://github.com/NixOS/nixpkgs/blob/a3c6ed7ad2649c1a55ffd94f7747e3176053b833/pkgs/by-name/in/insomnia/package.nix#L52
unpackCmd = ''
echo "Creating temp directory"
mnt=$(TMPDIR=/tmp mktemp -d -t nix-XXXXXXXXXX)
function finish {
echo "Ejecting temp directory"
/usr/bin/hdiutil detach $mnt -force
rm -rf $mnt
}
# Detach volume when receiving SIG "0"
trap finish EXIT
# Mount DMG file
echo "Mounting DMG file into \"$mnt\""
/usr/bin/hdiutil attach -nobrowse -mountpoint $mnt $curSrc
# Copy content to local dir for later use
echo 'Copying extracted content into "sourceRoot"'
cp -a $mnt/LM\ Studio.app $PWD/
'';
inherit passthru;
}

View File

@@ -0,0 +1,48 @@
{
appimageTools,
fetchurl,
version,
url,
hash,
pname,
meta,
stdenv,
lib,
passthru,
}:
let
src = fetchurl { inherit url hash; };
appimageContents = appimageTools.extractType2 { inherit pname version src; };
in
appimageTools.wrapType2 {
inherit
meta
pname
version
src
passthru
;
extraPkgs = 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
# Rename the main executable from lmstudio to lm-studio
mv $out/bin/lmstudio $out/bin/lm-studio
substituteInPlace $out/share/applications/lm-studio.desktop \
--replace-fail 'Exec=AppRun --no-sandbox %U' 'Exec=lm-studio'
# lms cli tool
install -m 755 ${appimageContents}/resources/app/.webpack/lms $out/bin/
patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \
--set-rpath "${lib.getLib stdenv.cc.cc}/lib:${lib.getLib stdenv.cc.cc}/lib64:$out/lib:${
lib.makeLibraryPath [ (lib.getLib stdenv.cc.cc) ]
}" $out/bin/lms
'';
}

View File

@@ -0,0 +1,48 @@
{
lib,
stdenv,
callPackage,
...
}@args:
let
pname = "lmstudio";
version_aarch64-darwin = "0.3.28-2";
hash_aarch64-darwin = "sha256-7sxhKZwZKzA2VUPHsChgysxXMB7SKEd9zK4kIPbWYjo=";
version_x86_64-linux = "0.3.28-2";
hash_x86_64-linux = "sha256-ewVjJ0Sy5Zwf9tvlfngQKnAfAv3BvPIAO+p1tJ3mO8M=";
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 = "lm-studio";
maintainers = with lib.maintainers; [ crertel ];
platforms = [
"x86_64-linux"
"aarch64-darwin"
];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
broken = stdenv.hostPlatform.isDarwin; # Upstream issue: https://github.com/lmstudio-ai/lmstudio-bug-tracker/issues/347
};
in
if stdenv.hostPlatform.isDarwin then
callPackage ./darwin.nix {
inherit pname meta;
passthru.updateScript = ./update.sh;
version = version_aarch64-darwin;
url =
args.url
or "https://installers.lmstudio.ai/darwin/arm64/${version_aarch64-darwin}/LM-Studio-${version_aarch64-darwin}-arm64.dmg";
hash = args.hash or hash_aarch64-darwin;
}
else
callPackage ./linux.nix {
inherit pname meta;
passthru.updateScript = ./update.sh;
version = version_x86_64-linux;
url =
args.url
or "https://installers.lmstudio.ai/linux/x64/${version_x86_64-linux}/LM-Studio-${version_x86_64-linux}-x64.AppImage";
hash = args.hash or hash_x86_64-linux;
}

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts
set -euo pipefail
packages="$(curl -s -L "https://lmstudio.ai/" | grep -oE 'https://installers.lmstudio.ai[^"\]*' | sort -u | grep -v \\.exe)"
for system in "aarch64-darwin darwin/arm64" "x86_64-linux linux/x64"; do
# shellcheck disable=SC2086
set -- ${system} # split string into variables $1 and $2
arch="${1}"
url=$(echo "${packages}" | grep "${2}")
version="$(echo "${url}" | cut -d/ -f6)"
hash=$(nix --extra-experimental-features nix-command hash convert --hash-algo sha256 "$(nix-prefetch-url "${url}")")
update-source-version lmstudio "${version}" "${hash}" --system="${arch}" --version-key="version_${arch}" \
2> >(tee /dev/stderr) | grep -q "nothing to do" && exit
done