about summary refs log tree commit diff
path: root/pkgs/development/compilers/flutter/artifacts/fetch-artifacts.nix
blob: 8c42c8a074a8540adb7a6946330d09853462f7a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ lib
, runCommand
, cacert
, unzip

, platform
, flutter
, hash
}:

let
  platforms = [
    "android"
    "ios"
    "web"
    "linux"
    "windows"
    "macos"
    "fuchsia"
    "universal"
  ];
in
runCommand "flutter-artifacts-${platform}"
{
  nativeBuildInputs = [
    (flutter.override {
      # Use a version of Flutter with just enough capabilities to download
      # artifacts.
      supportedTargetPlatforms = [ ];
    })
    unzip
  ];

  NIX_FLUTTER_TOOLS_VM_OPTIONS = "--root-certs-file=${cacert}/etc/ssl/certs/ca-bundle.crt";

  outputHash = hash;
  outputHashMode = "recursive";
  outputHashAlgo = "sha256";

  passthru = {
    inherit platform;
  };
} ''
  mkdir -p "$out"
  HOME="$NIX_BUILD_TOP" FLUTTER_CACHE_DIR="$out" flutter precache -v '--${platform}' ${builtins.concatStringsSep " " (map (p: "'--no-${p}'") (lib.remove platform platforms))}
''