Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions pkgs/development/compilers/dart/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,43 @@
runCommand,
cctools,
darwin,
sources ? import ./sources.nix { inherit fetchurl; },
version ? sources.versionUsed,
}:

assert sources != null && (builtins.isAttrs sources);
stdenv.mkDerivation (finalAttrs: {
pname = "dart";
inherit version;

nativeBuildInputs = [ unzip ];
version = "3.10.9";

src =
sources."${version}-${stdenv.hostPlatform.system}"
or (throw "unsupported version/system: ${version}/${stdenv.hostPlatform.system}");
let
selectSystem =
attrs:
attrs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
system = selectSystem {
x86_64-linux = "linux-x64";
aarch64-linux = "linux-arm64";
x86_64-darwin = "macos-x64";
aarch64-darwin = "macos-arm64";
};
hash = selectSystem {
x86_64-linux = "sha256-1DudOiG4LvKjfTGUW5nmuI9fjcROwZG0c/1inXjQuZQ=";
aarch64-linux = "sha256-Z8mPnmppTtPLNiY0Ny1pRzBAs3EoNtQsr82zxWwKBOs=";
x86_64-darwin = "sha256-pd37vWDOIKGdek/CuUSH7sVyiKqlLOW6GLT4IkzkwYA=";
aarch64-darwin = "sha256-99gMhvkzSJmYEsGuD3kBN1e3l685Xyy6cNICegC+Vk4=";
};
in
fetchurl {
url = "https://storage.googleapis.com/dart-archive/channels/${
if lib.strings.hasSuffix ".beta" finalAttrs.version then "beta" else "stable"
}/release/${finalAttrs.version}/sdk/dartsdk-${system}-release.zip";
inherit hash;
};

nativeBuildInputs = [ unzip ];

installPhase = ''
runHook preInstall

rm LICENSE
rm LICENSE README revision
cp -R . $out
''
+ lib.optionalString (stdenv.hostPlatform.isLinux) ''
Expand Down
23 changes: 0 additions & 23 deletions pkgs/development/compilers/dart/sources.nix

This file was deleted.

4 changes: 2 additions & 2 deletions pkgs/development/compilers/dart/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ fi

MY_PATH=$(dirname $(realpath "$0"))

update-source-version dart $latestVersion --file=$MY_PATH/sources.nix
update-source-version dart $latestVersion --file=$MY_PATH/default.nix

systems=$(nix eval --json -f . dart.meta.platforms | jq --raw-output '.[]')
for system in $systems; do
hash=$(nix hash convert --to sri --hash-algo sha256 $(nix-prefetch-url $(nix eval --raw -f . dart.src.url --system "$system")))
update-source-version dart $latestVersion $hash --file=$MY_PATH/sources.nix --system=$system --ignore-same-version --ignore-same-hash
update-source-version dart $latestVersion $hash --file=$MY_PATH/default.nix --system=$system --ignore-same-version --ignore-same-hash
done
33 changes: 11 additions & 22 deletions pkgs/development/compilers/flutter/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,19 @@ let
;

dart =
let
dartChannel = if lib.strings.hasSuffix ".beta" dartVersion then "beta" else "stable";
in
dart.override {
(dart.overrideAttrs (_: {
# This overrideAttrs is used to replace the version in src.url
version = dartVersion;
sources = {
"${dartVersion}-x86_64-linux" = fetchzip {
url = "https://storage.googleapis.com/dart-archive/channels/${dartChannel}/release/${dartVersion}/sdk/dartsdk-linux-x64-release.zip";
hash = dartHash.x86_64-linux;
};
"${dartVersion}-aarch64-linux" = fetchzip {
url = "https://storage.googleapis.com/dart-archive/channels/${dartChannel}/release/${dartVersion}/sdk/dartsdk-linux-arm64-release.zip";
hash = dartHash.aarch64-linux;
};
"${dartVersion}-x86_64-darwin" = fetchzip {
url = "https://storage.googleapis.com/dart-archive/channels/${dartChannel}/release/${dartVersion}/sdk/dartsdk-macos-x64-release.zip";
hash = dartHash.x86_64-darwin;
__intentionallyOverridingVersion = true;
})).overrideAttrs
(oldAttrs: {
src = fetchzip {
inherit (oldAttrs.src) url;
hash =
dartHash.${stdenv.hostPlatform.system}
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
};
"${dartVersion}-aarch64-darwin" = fetchzip {
url = "https://storage.googleapis.com/dart-archive/channels/${dartChannel}/release/${dartVersion}/sdk/dartsdk-macos-arm64-release.zip";
hash = dartHash.aarch64-darwin;
};
};
};
});
src =
let
source = fetchFromGitHub {
Expand Down
Loading