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
|
{ stdenv
, lib
, fetchurl
, unzip
, runCommand
, darwin
, sources ? import ./sources.nix {inherit fetchurl;}
, version ? sources.versionUsed
}:
assert sources != null && (builtins.isAttrs sources);
stdenv.mkDerivation (finalAttrs: {
pname = "dart";
inherit version;
nativeBuildInputs = [ unzip ];
src = sources."${version}-${stdenv.hostPlatform.system}" or (throw "unsupported version/system: ${version}/${stdenv.hostPlatform.system}");
installPhase = ''
mkdir -p $out
cp -R * $out/
echo $libPath
'' + lib.optionalString (stdenv.isLinux) ''
find $out/bin -executable -type f -exec patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) {} \;
'';
libPath = lib.makeLibraryPath [ stdenv.cc.cc ];
dontStrip = true;
passthru = {
updateScript = ./update.sh;
tests = {
testCreate = runCommand "dart-test-create" { nativeBuildInputs = [ finalAttrs.finalPackage ]; } ''
PROJECTNAME="dart_test_project"
dart create --no-pub $PROJECTNAME
[[ -d $PROJECTNAME ]]
[[ -f $PROJECTNAME/bin/$PROJECTNAME.dart ]]
touch $out
'';
testCompile = runCommand "dart-test-compile" {
nativeBuildInputs = [ finalAttrs.finalPackage ]
++ lib.optionals stdenv.isDarwin [ darwin.cctools darwin.sigtool ];
} ''
HELLO_MESSAGE="Hello, world!"
echo "void main() => print('$HELLO_MESSAGE');" > hello.dart
dart compile exe hello.dart
PROGRAM_OUT=$(./hello.exe)
[[ "$PROGRAM_OUT" == "$HELLO_MESSAGE" ]]
touch $out
'';
};
};
meta = with lib; {
homepage = "https://dart.dev";
maintainers = with maintainers; [ grburst ];
description = "Scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps";
longDescription = ''
Dart is a class-based, single inheritance, object-oriented language
with C-style syntax. It offers compilation to JavaScript, interfaces,
mixins, abstract classes, reified generics, and optional typing.
'';
platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.bsd3;
};
})
|