Skip to content

Commit

Permalink
flutter: Move to a structure more fitting for multiple versions
Browse files Browse the repository at this point in the history
  • Loading branch information
FlafyDev committed Jan 14, 2024
1 parent b73ceb1 commit 5e99fd3
Show file tree
Hide file tree
Showing 15 changed files with 928 additions and 947 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Schema:
# ${flutterVersion}.${targetPlatform}.${hostPlatform}
#
# aarch64-darwin as a host is not yet supported.
# https://github.com/flutter/flutter/issues/60118
{ lib
, runCommand
, xorg
Expand Down
75 changes: 0 additions & 75 deletions pkgs/development/compilers/flutter/artifacts/hashes.nix

This file was deleted.

35 changes: 16 additions & 19 deletions pkgs/development/compilers/flutter/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let
wrapFlutter = flutter: callPackage ./wrapper.nix { inherit flutter; };
getPatches = dir:
let files = builtins.attrNames (builtins.readDir dir);
in map (f: dir + ("/" + f)) files;
in if (builtins.pathExists dir) then map (f: dir + ("/" + f)) files else [ ];
mkFlutter =
{ version
, engineVersion
Expand All @@ -13,10 +13,11 @@ let
, dartHash
, patches
, pubspecLock
, artifactHashes
}:
let
args = {
inherit version engineVersion patches pubspecLock;
inherit version engineVersion patches pubspecLock artifactHashes;

dart = dart.override {
version = dartVersion;
Expand Down Expand Up @@ -59,22 +60,18 @@ let
};
});

flutter3Patches = getPatches ./patches/flutter3;
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);
in
{
inherit wrapFlutter;
stable = mkFlutter {
version = "3.13.8";
engineVersion = "767d8c75e898091b925519803830fc2721658d07";
dartVersion = "3.1.4";
dartHash = {
x86_64-linux = "sha256-42wrqzjRcFDWw2aEY6+/faX+QE9PA8FmRWP4M/NkgBE=";
aarch64-linux = "sha256-/tWWWwTOgXHbwzotc7ZDDZa8+cbX6NODGYrjLK9gPPg=";
x86_64-darwin = "sha256-BchKowKd6BscVuk/dXibcQzdFkW9//GDfll77mHEI4M=";
aarch64-darwin = "sha256-9yrx09vYrOTmdqkfJI7mfh7DI1/rg67tPlf82m5+iKI=";
};
flutterHash = "sha256-00G030FvZZTsdf9ruFs9jdIHcC5h+xpp4NlmL64qVZA=";
patches = flutter3Patches;
pubspecLock = lib.importJSON ./lockfiles/stable/pubspec.lock.json;
};
flutterVersions // {
stable = flutterVersions.${lib.last (lib.naturalSort (builtins.attrNames flutterVersions))};
inherit wrapFlutter mkFlutter;
}
3 changes: 2 additions & 1 deletion pkgs/development/compilers/flutter/flutter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
, dart
, src
, pubspecLock
, artifactHashes ? null
, lib
, stdenv
, callPackage
Expand Down Expand Up @@ -119,7 +120,7 @@ let
'';

passthru = {
inherit dart engineVersion;
inherit dart engineVersion artifactHashes;
tools = flutterTools;
# The derivation containing the original Flutter SDK files.
# When other derivations wrap this one, any unmodified files
Expand Down
Loading

0 comments on commit 5e99fd3

Please sign in to comment.