nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 cmake,
4 fetchFromGitHub,
5 stdenv,
6 testers,
7 texinfo,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "quickjs-ng";
12 version = "0.10.1";
13
14 src = fetchFromGitHub {
15 owner = "quickjs-ng";
16 repo = "quickjs";
17 tag = "v${finalAttrs.version}";
18 hash = "sha256-WtjHyqxibP6bAO9HsXuqAW/Y1qgt/Tpj401CIk4bY7o=";
19 };
20
21 outputs = [
22 "out"
23 "bin"
24 "dev"
25 "doc"
26 "info"
27 ];
28
29 nativeBuildInputs = [
30 cmake
31 texinfo
32 ];
33
34 cmakeFlags = [
35 (lib.cmakeBool "BUILD_SHARED_LIBS" true)
36 (lib.cmakeBool "BUILD_STATIC_QJS_EXE" stdenv.hostPlatform.isStatic)
37 ];
38
39 env.NIX_CFLAGS_COMPILE = toString (
40 lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
41 "-Wno-error=stringop-overflow"
42 ]
43 );
44
45 strictDeps = true;
46
47 postBuild = ''
48 pushd ../docs
49 makeinfo *texi
50 popd
51 '';
52
53 postInstall = ''
54 pushd ../docs
55 install -Dm644 -t ''${!outputInfo}/share/info *info
56 popd
57 '';
58
59 passthru.tests = {
60 version = testers.testVersion {
61 package = finalAttrs.finalPackage;
62 command = "qjs --help || true";
63 };
64 };
65
66 meta = {
67 homepage = "https://github.com/quickjs-ng/quickjs";
68 description = "Mighty JavaScript engine";
69 license = lib.licenses.mit;
70 mainProgram = "qjs";
71 maintainers = with lib.maintainers; [ ];
72 platforms = lib.platforms.all;
73 };
74})