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,
stdenv,
fetchurl,
unzip,
bintools,
versionCheckHook,
runCommand,
cctools,
darwin,
@ -23,16 +25,25 @@ stdenv.mkDerivation (finalAttrs: {
installPhase =
''
mkdir -p $out
cp -R * $out/
echo $libPath
runHook preInstall
cp -R . $out
''
+ 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;
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
passthru = {
updateScript = ./update.sh;
tests = {
@ -67,9 +78,9 @@ stdenv.mkDerivation (finalAttrs: {
};
};
meta = with lib; {
meta = {
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";
longDescription = ''
Dart is a class-based, single inheritance, object-oriented language
@ -83,7 +94,7 @@ stdenv.mkDerivation (finalAttrs: {
"x86_64-darwin"
"aarch64-darwin"
];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.bsd3;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.bsd3;
};
})

View File

@ -6,18 +6,18 @@ in
versionUsed = version;
"${version}-x86_64-darwin" = fetchurl {
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 {
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 {
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 {
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=";
};
}