about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/flutter/sdk-symlink.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/flutter/sdk-symlink.nix')
-rw-r--r--nixpkgs/pkgs/development/compilers/flutter/sdk-symlink.nix17
1 files changed, 15 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/development/compilers/flutter/sdk-symlink.nix b/nixpkgs/pkgs/development/compilers/flutter/sdk-symlink.nix
index 6fb4f5edc0ee..044a508805f5 100644
--- a/nixpkgs/pkgs/development/compilers/flutter/sdk-symlink.nix
+++ b/nixpkgs/pkgs/development/compilers/flutter/sdk-symlink.nix
@@ -1,10 +1,23 @@
-{ symlinkJoin }: flutter:
+{ symlinkJoin
+, makeWrapper
+}: flutter:
 
 let
   self =
     symlinkJoin {
       name = "${flutter.name}-sdk-links";
-      paths = [ flutter flutter.sdk ];
+      paths = [ flutter flutter.cacheDir flutter.sdk ];
+
+      nativeBuildInputs = [ makeWrapper ];
+      postBuild = ''
+        wrapProgram "$out/bin/flutter" \
+          --set-default FLUTTER_ROOT "$out"
+
+        # symlinkJoin seems to be missing the .git directory for some reason.
+        if [ -d '${flutter.sdk}/.git' ]; then
+          ln -s '${flutter.sdk}/.git' "$out"
+        fi
+      '';
 
       passthru = flutter.passthru // {
         # Update the SDK attribute.