generated from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flutter-engine.nix
90 lines (81 loc) · 2.22 KB
/
flutter-engine.nix
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
https://github.com/NixOS/nixpkgs/issues/201574
flutter is a giant project and takes forever to build
*/
{ stdenv
, lib
, fetchgit
, fetchFromGitHub
, writeShellScriptBin
, python3
, git
, cacert
, ninja
}:
let
# TODO buildPythonPackage
# https://github.com/input-output-hk/gclient2nix
# https://discourse.nixos.org/t/installing-depot-tools/5134
depot_tools = fetchgit {
url = "https://chromium.googlesource.com/chromium/tools/depot_tools";
rev = "30e3ce8b1c670be00c4957fe773ffb8ff986ed8f";
sha256 = "sha256-R9CX/xzvLiOVQmAsviTFUFv6DiStxa0b6O0zHNaH6SY=";
};
gclient = writeShellScriptBin "gclient" ''
${python3.withPackages (py: with py; [ google-auth-httplib2 ])}/bin/python ${depot_tools}/gclient.py "$@"
'';
in
stdenv.mkDerivation rec {
pname = "flutter-engine";
version = "981fe92ab998d655abded58f1f0ef2a8daeadd02";
# https://github.com/flutter/engine
src = fetchFromGitHub {
owner = "flutter";
repo = "engine";
rev = version;
sha256 = "sha256-9uY7Q8ZR51vB7vsjEPGAWyvhOKRfdj5B8o0KwypwdTY=";
};
deps = stdenv.mkDerivation {
inherit src;
name = "${pname}-${version}-deps";
nativeBuildInputs = [
gclient
git
cacert # fix: error:16000069:STORE routines::unregistered scheme
];
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = ""; # TODO
# "gclient sync" will about 1 hour to fetch sources
buildPhase = ''
echo FIXME we need all scripts from depot_tools
echo FIXME "FileNotFoundError: [Errno 2] No such file or directory: 'cipd'"
exit 1
(
set -x
gclient config https://github.com/flutter/engine
gclient sync --revision engine@${version} --shallow --verbose
cp -r . $out
)
'';
};
postUnpack = ''
(
cd $sourceRoot
echo TODO merge with source. copy or symlink ${deps}
exit 1
)
'';
nativeBuildInputs = [
ninja
];
/*
TODO
https://github.com/flutter/flutter/wiki/Compiling-the-engine#compiling-for-macos-or-linux
this will take forever ...
*/
buildPhase = ''
./flutter/tools/gn --unoptimized # to prepare your build files.
ninja -C out/host_debug_unopt # to build a desktop unoptimized binary.
'';
}