dart: refactor

This commit is contained in:
emaryn 2025-07-07 05:20:29 +08:00
parent 83e749e019
commit e0edea7b33
2 changed files with 25 additions and 14 deletions

View File

@ -1,8 +1,10 @@
{ {
stdenv,
lib, lib,
stdenv,
fetchurl, fetchurl,
unzip, unzip,
bintools,
versionCheckHook,
runCommand, runCommand,
cctools, cctools,
darwin, darwin,
@ -23,16 +25,25 @@ stdenv.mkDerivation (finalAttrs: {
installPhase = installPhase =
'' ''
mkdir -p $out runHook preInstall
cp -R * $out/
echo $libPath cp -R . $out
'' ''
+ lib.optionalString (stdenv.hostPlatform.isLinux) '' + lib.optionalString (stdenv.hostPlatform.isLinux) ''
find $out/bin -executable -type f -exec patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) {} \; find $out/bin -executable -type f -exec patchelf --set-interpreter ${bintools.dynamicLinker} {} \;
''
+ ''
runHook postInstall
''; '';
libPath = lib.makeLibraryPath [ stdenv.cc.cc ];
dontStrip = true; dontStrip = true;
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
passthru = { passthru = {
updateScript = ./update.sh; updateScript = ./update.sh;
tests = { tests = {
@ -67,9 +78,9 @@ stdenv.mkDerivation (finalAttrs: {
}; };
}; };
meta = with lib; { meta = {
homepage = "https://dart.dev"; homepage = "https://dart.dev";
maintainers = with maintainers; [ grburst ]; maintainers = with lib.maintainers; [ grburst ];
description = "Scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps"; description = "Scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps";
longDescription = '' longDescription = ''
Dart is a class-based, single inheritance, object-oriented language Dart is a class-based, single inheritance, object-oriented language
@ -83,7 +94,7 @@ stdenv.mkDerivation (finalAttrs: {
"x86_64-darwin" "x86_64-darwin"
"aarch64-darwin" "aarch64-darwin"
]; ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ]; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = licenses.bsd3; license = lib.licenses.bsd3;
}; };
}) })

View File

@ -6,18 +6,18 @@ in
versionUsed = version; versionUsed = version;
"${version}-x86_64-darwin" = fetchurl { "${version}-x86_64-darwin" = fetchurl {
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-macos-x64-release.zip"; url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-macos-x64-release.zip";
sha256 = "sha256-OTcd89ZPlPWz2cERnD9UkWTFYoxqE7lFG3tEhZ8fkRQ="; hash = "sha256-OTcd89ZPlPWz2cERnD9UkWTFYoxqE7lFG3tEhZ8fkRQ=";
}; };
"${version}-aarch64-darwin" = fetchurl { "${version}-aarch64-darwin" = fetchurl {
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-macos-arm64-release.zip"; url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-macos-arm64-release.zip";
sha256 = "sha256-UIC8b0p4zM4OOOceRkdsCNYeCBRTZGlI8/DHcXepKPg="; hash = "sha256-UIC8b0p4zM4OOOceRkdsCNYeCBRTZGlI8/DHcXepKPg=";
}; };
"${version}-aarch64-linux" = fetchurl { "${version}-aarch64-linux" = fetchurl {
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-linux-arm64-release.zip"; url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-linux-arm64-release.zip";
sha256 = "sha256-eKMkAJe+47ebAJxp6tIuGq7e3ty+CT6qmACExWYQlsg="; hash = "sha256-eKMkAJe+47ebAJxp6tIuGq7e3ty+CT6qmACExWYQlsg=";
}; };
"${version}-x86_64-linux" = fetchurl { "${version}-x86_64-linux" = fetchurl {
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-linux-x64-release.zip"; url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-linux-x64-release.zip";
sha256 = "sha256-DVjAEKNh8/FYixwvV5QvfMr3t6u+A0BP73oQLrY48J0="; hash = "sha256-DVjAEKNh8/FYixwvV5QvfMr3t6u+A0BP73oQLrY48J0=";
}; };
} }