2024-01-02 11:29:13 +00:00
|
|
|
{ callPackage, fetchzip, fetchFromGitHub, dart, lib, stdenv }:
|
2020-04-24 23:36:52 +00:00
|
|
|
let
|
2023-05-24 13:37:59 +00:00
|
|
|
mkCustomFlutter = args: callPackage ./flutter.nix args;
|
2023-04-29 16:46:19 +00:00
|
|
|
wrapFlutter = flutter: callPackage ./wrapper.nix { inherit flutter; };
|
2020-04-24 23:36:52 +00:00
|
|
|
getPatches = dir:
|
|
|
|
let files = builtins.attrNames (builtins.readDir dir);
|
2024-01-25 14:12:00 +00:00
|
|
|
in if (builtins.pathExists dir) then map (f: dir + ("/" + f)) files else [ ];
|
2024-01-02 11:29:13 +00:00
|
|
|
mkFlutter =
|
|
|
|
{ version
|
|
|
|
, engineVersion
|
|
|
|
, dartVersion
|
|
|
|
, flutterHash
|
|
|
|
, dartHash
|
|
|
|
, patches
|
2024-01-13 08:15:51 +00:00
|
|
|
, pubspecLock
|
2024-01-25 14:12:00 +00:00
|
|
|
, artifactHashes
|
2024-01-02 11:29:13 +00:00
|
|
|
}:
|
2023-05-24 13:37:59 +00:00
|
|
|
let
|
|
|
|
args = {
|
2024-01-25 14:12:00 +00:00
|
|
|
inherit version engineVersion patches pubspecLock artifactHashes;
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
dart = dart.override {
|
|
|
|
version = dartVersion;
|
|
|
|
sources = {
|
|
|
|
"${dartVersion}-x86_64-linux" = fetchzip {
|
|
|
|
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${dartVersion}/sdk/dartsdk-linux-x64-release.zip";
|
|
|
|
sha256 = dartHash.x86_64-linux;
|
|
|
|
};
|
|
|
|
"${dartVersion}-aarch64-linux" = fetchzip {
|
|
|
|
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${dartVersion}/sdk/dartsdk-linux-arm64-release.zip";
|
|
|
|
sha256 = dartHash.aarch64-linux;
|
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
"${dartVersion}-x86_64-darwin" = fetchzip {
|
|
|
|
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${dartVersion}/sdk/dartsdk-macos-x64-release.zip";
|
|
|
|
sha256 = dartHash.x86_64-darwin;
|
|
|
|
};
|
|
|
|
"${dartVersion}-aarch64-darwin" = fetchzip {
|
|
|
|
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${dartVersion}/sdk/dartsdk-macos-arm64-release.zip";
|
|
|
|
sha256 = dartHash.aarch64-darwin;
|
|
|
|
};
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
2022-10-21 18:38:19 +00:00
|
|
|
};
|
2024-01-02 11:29:13 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "flutter";
|
|
|
|
repo = "flutter";
|
|
|
|
rev = version;
|
|
|
|
hash = flutterHash;
|
|
|
|
};
|
2021-09-28 08:13:01 +00:00
|
|
|
};
|
2023-05-24 13:37:59 +00:00
|
|
|
in
|
|
|
|
(mkCustomFlutter args).overrideAttrs (prev: next: {
|
|
|
|
passthru = next.passthru // rec {
|
|
|
|
inherit wrapFlutter mkCustomFlutter mkFlutter;
|
2024-01-25 14:12:00 +00:00
|
|
|
buildFlutterApplication = callPackage ../../../build-support/flutter { flutter = wrapFlutter (mkCustomFlutter args); };
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
flutterVersions = lib.mapAttrs'
|
|
|
|
(version: _:
|
|
|
|
let
|
|
|
|
versionDir = ./versions + "/${version}";
|
|
|
|
data = lib.importJSON (versionDir + "/data.json");
|
|
|
|
in
|
|
|
|
lib.nameValuePair "v${version}" (wrapFlutter (mkFlutter ({
|
|
|
|
patches = (getPatches ./patches) ++ (getPatches (versionDir + "/patches"));
|
|
|
|
} // data))))
|
|
|
|
(builtins.readDir ./versions);
|
2022-08-21 13:32:41 +00:00
|
|
|
in
|
2024-01-25 14:12:00 +00:00
|
|
|
flutterVersions // {
|
|
|
|
stable = flutterVersions.${lib.last (lib.naturalSort (builtins.attrNames flutterVersions))};
|
|
|
|
inherit wrapFlutter mkFlutter;
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|