about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/flutter/flutter.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/flutter/flutter.nix')
-rw-r--r--nixpkgs/pkgs/development/compilers/flutter/flutter.nix34
1 files changed, 25 insertions, 9 deletions
diff --git a/nixpkgs/pkgs/development/compilers/flutter/flutter.nix b/nixpkgs/pkgs/development/compilers/flutter/flutter.nix
index 1e68a3b02a9e..42129501ca12 100644
--- a/nixpkgs/pkgs/development/compilers/flutter/flutter.nix
+++ b/nixpkgs/pkgs/development/compilers/flutter/flutter.nix
@@ -4,6 +4,7 @@
 , dart
 , src
 , pubspecLock
+, artifactHashes ? null
 , lib
 , stdenv
 , callPackage
@@ -11,23 +12,24 @@
 , darwin
 , git
 , which
-}:
-
-let
-  tools = callPackage ./flutter-tools.nix {
+, jq
+, flutterTools ? callPackage ./flutter-tools.nix {
     inherit dart version;
     flutterSrc = src;
     inherit patches;
     inherit pubspecLock;
-  };
+    systemPlatform = stdenv.hostPlatform.system;
+  }
+}:
 
+let
   unwrapped =
     stdenv.mkDerivation {
       name = "flutter-${version}-unwrapped";
       inherit src patches version;
 
       buildInputs = [ git ];
-      nativeBuildInputs = [ makeWrapper ]
+      nativeBuildInputs = [ makeWrapper jq ]
         ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.DarwinTools ];
 
       preConfigure = ''
@@ -58,15 +60,28 @@ let
         # Add a flutter_tools artifact stamp, and build a snapshot.
         # This is the Flutter CLI application.
         echo "$(git rev-parse HEAD)" > bin/cache/flutter_tools.stamp
-        ln -s '${tools}/share/flutter_tools.snapshot' bin/cache/flutter_tools.snapshot
+        ln -s '${flutterTools}/share/flutter_tools.snapshot' bin/cache/flutter_tools.snapshot
 
         # Some of flutter_tools's dependencies contain static assets. The
         # application attempts to read its own package_config.json to find these
         # assets at runtime.
         mkdir -p packages/flutter_tools/.dart_tool
-        ln -s '${tools.pubcache}/package_config.json' packages/flutter_tools/.dart_tool/package_config.json
+        ln -s '${flutterTools.pubcache}/package_config.json' packages/flutter_tools/.dart_tool/package_config.json
 
         echo -n "${version}" > version
+        cat <<EOF > bin/cache/flutter.version.json
+        {
+          "devToolsVersion": "$(cat "${dart}/bin/resources/devtools/version.json" | jq -r .version)",
+          "flutterVersion": "${version}",
+          "frameworkVersion": "${version}",
+          "channel": "stable",
+          "repositoryUrl": "https://github.com/flutter/flutter.git",
+          "frameworkRevision": "nixpkgs000000000000000000000000000000000",
+          "frameworkCommitDate": "1970-01-01 00:00:00",
+          "engineRevision": "${engineVersion}",
+          "dartSdkVersion": "${dart.version}"
+        }
+        EOF
       '';
 
       installPhase = ''
@@ -105,7 +120,8 @@ let
       '';
 
       passthru = {
-        inherit dart engineVersion tools;
+        inherit dart engineVersion artifactHashes;
+        tools = flutterTools;
         # 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.