Skip to content

Commit

Permalink
flutter: Make it possible to override operatingSystem internally
Browse files Browse the repository at this point in the history
Makes it possible to get artifact hashes for other system platforms.

Useful for an update script.
  • Loading branch information
FlafyDev committed Jan 14, 2024
1 parent da6757f commit b73ceb1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ runCommand "flutter-artifacts-${flutterPlatform}-${systemPlatform}"
nativeBuildInputs = [ xorg.lndir flutter' unzip ];

NIX_FLUTTER_TOOLS_VM_OPTIONS = "--root-certs-file=${cacert}/etc/ssl/certs/ca-bundle.crt";
NIX_FLUTTER_OPERATING_SYSTEM = {
"x86_64-linux" = "linux";
"aarch64-linux" = "linux";
"x86_64-darwin" = "macos";
"aarch64-darwin" = "macos";
}.${systemPlatform};

outputHash = hash;
outputHashMode = "recursive";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/packages/flutter_tools/lib/src/base/platform.dart b/packages/flutter_tools/lib/src/base/platform.dart
index 45da89ad4c..2d79dbaece 100644
--- a/packages/flutter_tools/lib/src/base/platform.dart
+++ b/packages/flutter_tools/lib/src/base/platform.dart
@@ -132,7 +132,7 @@ class LocalPlatform extends Platform {
String get pathSeparator => io.Platform.pathSeparator;

@override
- String get operatingSystem => io.Platform.operatingSystem;
+ String get operatingSystem => io.Platform.environment['NIX_FLUTTER_OPERATING_SYSTEM'] ?? io.Platform.operatingSystem;

@override
String get operatingSystemVersion => io.Platform.operatingSystemVersion;

0 comments on commit b73ceb1

Please sign in to comment.