flutter: Rename platform to flutterPlatform

This helps avoid the ambiguity between Flutter platforms like Linux, IOS, and Android and platforms like linux-x64
This commit is contained in:
FlafyDev
2024-01-11 01:37:55 +02:00
parent dc1bb8caba
commit 579e01329e
4 changed files with 16 additions and 16 deletions
@@ -4,13 +4,13 @@
, cacert
, unzip
, platform
, flutterPlatform
, flutter
, hash
}:
let
platforms = [
flutterPlatforms = [
"android"
"ios"
"web"
@@ -24,10 +24,10 @@ let
flutter' = flutter.override {
# Use a version of Flutter with just enough capabilities to download
# artifacts.
supportedTargetPlatforms = [ ];
supportedTargetFlutterPlatforms = [ ];
};
in
runCommand "flutter-artifacts-${platform}"
runCommand "flutter-artifacts-${flutterPlatform}"
{
nativeBuildInputs = [ xorg.lndir flutter' unzip ];
@@ -38,7 +38,7 @@ runCommand "flutter-artifacts-${platform}"
outputHashAlgo = "sha256";
passthru = {
inherit platform;
inherit flutterPlatform;
};
} ''
export FLUTTER_ROOT="$NIX_BUILD_TOP"
@@ -46,7 +46,7 @@ runCommand "flutter-artifacts-${platform}"
rm -rf "$FLUTTER_ROOT/bin/cache"
mkdir "$FLUTTER_ROOT/bin/cache"
HOME="$(mktemp -d)" flutter precache -v '--${platform}' ${builtins.concatStringsSep " " (map (p: "'--no-${p}'") (lib.remove platform platforms))}
HOME="$(mktemp -d)" flutter precache -v '--${flutterPlatform}' ${builtins.concatStringsSep " " (map (p: "'--no-${p}'") (lib.remove flutterPlatform flutterPlatforms))}
rm -rf "$FLUTTER_ROOT/bin/cache/lockfile"
find "$FLUTTER_ROOT" -type l -lname '${flutter'}/*' -delete
@@ -20,7 +20,7 @@
runHook postInstall
'';
}).overrideAttrs (
if builtins.pathExists ./overrides/${src.platform}.nix
then callPackage ./overrides/${src.platform}.nix { }
if builtins.pathExists ./overrides/${src.flutterPlatform}.nix
then callPackage ./overrides/${src.flutterPlatform}.nix { }
else ({ ... }: { })
)