Commit 596aa930 authored by gilice's avatar gilice
Browse files

flutter: rename & expose builders to pkgs

The renames are:
  mkFlutter -> mkCustomFlutter
  flutterDrv -> mkFlutter

I hope this will bring more clarity
parent ee82caae
Loading
Loading
Loading
Loading
+41 −22
Original line number Diff line number Diff line
{ callPackage, fetchzip, dart }:
{ callPackage, fetchzip, dart, lib, stdenv }:
let
  mkFlutter = { version, engineVersion, patches, dart, src }: callPackage ./flutter.nix { inherit version engineVersion patches dart src; };
  mkCustomFlutter = args: callPackage ./flutter.nix args;
  wrapFlutter = flutter: callPackage ./wrapper.nix { inherit flutter; };
  getPatches = dir:
    let files = builtins.attrNames (builtins.readDir dir);
    in map (f: dir + ("/" + f)) files;
  flutterDrv = { version, engineVersion, dartVersion, hash, dartHash, patches }: mkFlutter {
  mkFlutter = { version, engineVersion, dartVersion, hash, dartHash, patches }:
    let args = {
      inherit version engineVersion patches;

      dart = dart.override {
        version = dartVersion;
        sources = {
@@ -24,13 +26,30 @@ let
        url = "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${version}-stable.tar.xz";
        sha256 = hash;
      };
   }; in (mkCustomFlutter args).overrideAttrs (prev: next: {
    passthru = next.passthru // rec {
      inherit wrapFlutter mkCustomFlutter mkFlutter;
      buildFlutterApplication = callPackage ../../../build-support/flutter {
        # Package a minimal version of Flutter that only uses Linux desktop release artifacts.
        flutter = wrapFlutter
          (mkCustomFlutter (args // {
            includedEngineArtifacts = {
              common = [ "flutter_patched_sdk_product" ];
              platform.linux = lib.optionals stdenv.hostPlatform.isLinux
                (lib.genAttrs ((lib.optional stdenv.hostPlatform.isx86_64 "x64") ++ (lib.optional stdenv.hostPlatform.isAarch64 "arm64"))
                  (architecture: [ "release" ]));
            };
          }));
      };
    };
  });

  flutter2Patches = getPatches ./patches/flutter2;
  flutter3Patches = getPatches ./patches/flutter3;
in
{
  inherit mkFlutter wrapFlutter flutterDrv flutter3Patches flutter2Patches;
  stable = flutterDrv {
  inherit wrapFlutter;
  stable = mkFlutter {
    version = "3.7.12";
    engineVersion = "1a65d409c7a1438a34d21b60bf30a6fd5db59314";
    dartVersion = "2.19.6";
@@ -42,7 +61,7 @@ in
    patches = flutter3Patches;
  };

  v2 = flutterDrv {
  v2 = mkFlutter {
    version = "2.10.5";
    engineVersion = "57d3bac3dd5cb5b0e464ab70e7bc8a0d8cf083ab";
    dartVersion = "2.16.2";
+1 −15
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
, lndir
, git
, which
}@args:
}:

let
  engineArtifactDirectory =
@@ -160,24 +160,10 @@ let

      passthru = {
        inherit dart;

        # The derivation containing the original Flutter SDK files.
        # When other derivations wrap this one, any unmodified files
        # found here should be included as-is, for tooling compatibility.
        sdk = unwrapped;
        buildFlutterApplication = callPackage ../../../build-support/flutter {
          # Package a minimal version of Flutter that only uses Linux desktop release artifacts.
          flutter = callPackage ./wrapper.nix {
            flutter = callPackage ./flutter.nix (args // {
              includedEngineArtifacts = {
                common = [ "flutter_patched_sdk_product" ];
                platform.linux = lib.optionals stdenv.hostPlatform.isLinux
                  (lib.genAttrs ((lib.optional stdenv.hostPlatform.isx86_64 "x64") ++ (lib.optional stdenv.hostPlatform.isAarch64 "arm64"))
                    (architecture: [ "release" ]));
              };
            });
          };
        };
      };

      meta = with lib; {