Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 meson, 6 ninja, 7 nix-update-script, 8 runCommand, 9}: 10 11stdenv.mkDerivation (finalAttrs: { 12 pname = "janet"; 13 version = "1.38.0"; 14 15 src = fetchFromGitHub { 16 owner = "janet-lang"; 17 repo = "janet"; 18 rev = "v${finalAttrs.version}"; 19 hash = "sha256-PLfBFsZqwSpE+3cduDXyRZZDpiL8+zHyIjVopK0oqPo="; 20 }; 21 22 postPatch = '' 23 substituteInPlace janet.1 \ 24 --replace /usr/local/ $out/ 25 '' 26 + lib.optionalString stdenv.hostPlatform.isDarwin '' 27 # error: Socket is not connected 28 substituteInPlace meson.build \ 29 --replace "'test/suite-ev.janet'," "" 30 ''; 31 32 nativeBuildInputs = [ 33 meson 34 ninja 35 ]; 36 37 mesonBuildType = "release"; 38 mesonFlags = [ "-Dgit_hash=release" ]; 39 40 doCheck = true; 41 42 doInstallCheck = true; 43 44 installCheckPhase = '' 45 $out/bin/janet -e '(+ 1 2 3)' 46 ''; 47 48 passthru = { 49 tests.run = 50 runCommand "janet-test-run" 51 { 52 nativeBuildInputs = [ finalAttrs.finalPackage ]; 53 } 54 '' 55 echo "(+ 1 2 3)" | janet | tail -n 1 > arithmeticTest.txt; 56 diff -U3 --color=auto <(cat arithmeticTest.txt) <(echo "6"); 57 58 echo "(print \"Hello, World!\")" | janet | tail -n 2 > ioTest.txt; 59 diff -U3 --color=auto <(cat ioTest.txt) <(echo -e "Hello, World!\nnil"); 60 61 touch $out; 62 ''; 63 updateScript = nix-update-script { }; 64 }; 65 66 meta = with lib; { 67 description = "Janet programming language"; 68 mainProgram = "janet"; 69 homepage = "https://janet-lang.org/"; 70 license = licenses.mit; 71 maintainers = with maintainers; [ 72 andrewchambers 73 peterhoeg 74 ]; 75 platforms = platforms.all; 76 }; 77})