diff --git a/pkgs/development/compilers/dart/default.nix b/pkgs/development/compilers/dart/default.nix index 9851edf925498..87831cc8fa4ae 100644 --- a/pkgs/development/compilers/dart/default.nix +++ b/pkgs/development/compilers/dart/default.nix @@ -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) '' diff --git a/pkgs/development/compilers/dart/sources.nix b/pkgs/development/compilers/dart/sources.nix deleted file mode 100644 index 7ca6da8b86b1b..0000000000000 --- a/pkgs/development/compilers/dart/sources.nix +++ /dev/null @@ -1,23 +0,0 @@ -let - version = "3.10.7"; -in -{ fetchurl }: -{ - versionUsed = version; - "${version}-x86_64-darwin" = fetchurl { - url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-macos-x64-release.zip"; - hash = "sha256-EES4leNoHZWFs/nQUJTzN+cCKGzxiANpLJrkXb1UKdA="; - }; - "${version}-aarch64-darwin" = fetchurl { - url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-macos-arm64-release.zip"; - hash = "sha256-ovQkvU5BpqXHUlUebUKKranJUERhZPsAsfO3N+4jzKs="; - }; - "${version}-aarch64-linux" = fetchurl { - url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-linux-arm64-release.zip"; - hash = "sha256-gb3NiChgaYFxPFE+PUN37u3sQxxGvzXzJ3xquvLXvVE="; - }; - "${version}-x86_64-linux" = fetchurl { - url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-linux-x64-release.zip"; - hash = "sha256-ik7qz012kOAzidYygkG8aaG2HLmA8j1Q9i66y1kg7HQ="; - }; -} diff --git a/pkgs/development/compilers/dart/update.sh b/pkgs/development/compilers/dart/update.sh index e8cfc3b432a6d..afc3e2cc6c891 100755 --- a/pkgs/development/compilers/dart/update.sh +++ b/pkgs/development/compilers/dart/update.sh @@ -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 diff --git a/pkgs/development/compilers/flutter/default.nix b/pkgs/development/compilers/flutter/default.nix index 846173c1fe2a8..c8b2026c5f88a 100644 --- a/pkgs/development/compilers/flutter/default.nix +++ b/pkgs/development/compilers/flutter/default.nix @@ -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 {