summary refs log tree commit diff
path: root/pkgs/development/interpreters/janet
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-11-21 16:12:21 +0100
committerAlyssa Ross <hi@alyssa.is>2023-11-21 16:12:48 +0100
commit048a4cd441a59cbf89defb18bb45c9f0b4429b35 (patch)
treef8f5850ff05521ab82d65745894714a8796cbfb6 /pkgs/development/interpreters/janet
parent030c5028b07afcedce7c5956015c629486cc79d9 (diff)
parent4c2d05dd6435d449a3651a6dd314d9411b5f8146 (diff)
downloadnixpkgs-rootfs.tar
nixpkgs-rootfs.tar.gz
nixpkgs-rootfs.tar.bz2
nixpkgs-rootfs.tar.lz
nixpkgs-rootfs.tar.xz
nixpkgs-rootfs.tar.zst
nixpkgs-rootfs.zip
Rebase onto e4ad989506ec7d71f7302cc3067abd82730a4beb HEAD rootfs
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'pkgs/development/interpreters/janet')
-rw-r--r--pkgs/development/interpreters/janet/default.nix40
1 files changed, 33 insertions, 7 deletions
diff --git a/pkgs/development/interpreters/janet/default.nix b/pkgs/development/interpreters/janet/default.nix
index 3c44239dc2f..f186021eb3d 100644
--- a/pkgs/development/interpreters/janet/default.nix
+++ b/pkgs/development/interpreters/janet/default.nix
@@ -1,19 +1,30 @@
-{ lib, stdenv, fetchFromGitHub, meson, ninja }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, meson
+, ninja
+, nix-update-script
+, runCommand
+}:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "janet";
-  version = "1.31.0";
+  version = "1.32.1";
 
   src = fetchFromGitHub {
     owner = "janet-lang";
-    repo = pname;
-    rev = "v${version}";
-    hash = "sha256-Dj2fj1dsdAMl/H0vNKTf9qjPB4GVRpgWPVR+PuZWZMc=";
+    repo = "janet";
+    rev = "v${finalAttrs.version}";
+    hash = "sha256-24d9N59pTfQATWmAZN4dAFT8RTTlUlBPKokcQ/Fd2No=";
   };
 
   postPatch = ''
     substituteInPlace janet.1 \
       --replace /usr/local/ $out/
+  '' + lib.optionalString stdenv.isDarwin ''
+    # error: Socket is not connected
+    substituteInPlace meson.build \
+      --replace "'test/suite-ev.janet'," ""
   '';
 
   nativeBuildInputs = [ meson ninja ];
@@ -29,6 +40,21 @@ stdenv.mkDerivation rec {
     $out/bin/janet -e '(+ 1 2 3)'
   '';
 
+  passthru = {
+    tests.run = runCommand "janet-test-run" {
+      nativeBuildInputs = [finalAttrs.finalPackage];
+    } ''
+      echo "(+ 1 2 3)" | janet | tail -n 1 > arithmeticTest.txt;
+      diff -U3 --color=auto <(cat arithmeticTest.txt) <(echo "6");
+
+      echo "(print \"Hello, World!\")" | janet | tail -n 2 > ioTest.txt;
+      diff -U3 --color=auto <(cat ioTest.txt) <(echo -e "Hello, World!\nnil");
+
+      touch $out;
+    '';
+    updateScript = nix-update-script {};
+  };
+
   meta = with lib; {
     description = "Janet programming language";
     homepage = "https://janet-lang.org/";
@@ -36,4 +62,4 @@ stdenv.mkDerivation rec {
     maintainers = with maintainers; [ andrewchambers peterhoeg ];
     platforms = platforms.all;
   };
-}
+})