From e65b9cc50d13857dcb703dc25f62db1310d764e3 Mon Sep 17 00:00:00 2001 From: eljamm Date: Tue, 14 Jul 2026 12:46:50 +0200 Subject: [PATCH] zenroom: init at 5.37.2 Assisted-by: nix-init --- pkgs/by-name/ze/zenroom/package.nix | 109 ++++++++++++++++++ .../ze/zenroom/tests/arrayGenerator.zen | 3 + .../ze/zenroom/tests/arrayGenerator2.zen | 8 ++ pkgs/by-name/ze/zenroom/tests/default.nix | 18 +++ 4 files changed, 138 insertions(+) create mode 100644 pkgs/by-name/ze/zenroom/package.nix create mode 100644 pkgs/by-name/ze/zenroom/tests/arrayGenerator.zen create mode 100644 pkgs/by-name/ze/zenroom/tests/arrayGenerator2.zen create mode 100644 pkgs/by-name/ze/zenroom/tests/default.nix diff --git a/pkgs/by-name/ze/zenroom/package.nix b/pkgs/by-name/ze/zenroom/package.nix new file mode 100644 index 000000000000..d9e43ef9d6c8 --- /dev/null +++ b/pkgs/by-name/ze/zenroom/package.nix @@ -0,0 +1,109 @@ +{ + lib, + stdenv, + fetchFromGitHub, + nix-update-script, + + # build-time + cmake, + xxd, + which, + + # run-time + readline, + + # tests + callPackage, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "zenroom"; + version = "5.37.2"; + + __structuredAttrs = true; + dontUseCmakeConfigure = true; # cmake is a dependency, but we use make to build + strictDeps = true; + + src = fetchFromGitHub { + owner = "dyne"; + repo = "Zenroom"; + tag = "v${finalAttrs.version}"; + hash = "sha256-gNUclaXF7C2yBywo1TAwHOfB9Pe17g6fCLhEcFq8JL0="; + postFetch = '' + # conflict on case-insensitive filesystems + pushd $out/docs/examples/zencode_cookbook/cookbook_when + rm *_move_as.out.json *_move_to.out.json + popd + ''; + }; + + postPatch = '' + patchShebangs build/embed-lualibs + ''; + + nativeBuildInputs = [ + cmake + which # ar + xxd + ]; + + buildInputs = [ + readline + ]; + + buildFlags = + with stdenv.hostPlatform; + lib.optionals (isLinux && !isMusl) [ + "linux-lib" + "linux-exe" + ] + ++ lib.optionals (isLinux && isMusl) [ + "musl" + ] + ++ lib.optionals isDarwin [ + "osx-lib" + "osx-exe" + ] + ++ lib.optionals (isUnix && !isLinux && !isDarwin) [ + "posix-lib" + "posix-exe" + ]; + + hardeningDisable = [ "format" ]; # -Werror=format-security + + env.PREFIX = ""; + env.DESTDIR = placeholder "out"; + + preInstall = '' + mkdir -p $out/{bin,share} + ''; + + postInstall = '' + install -D libzenroom${stdenv.hostPlatform.extensions.sharedLibrary} -t $out/lib + ''; + + passthru.updateScript = nix-update-script { }; + passthru.tests = callPackage ./tests { zenroom = finalAttrs.finalPackage; }; + + meta = { + description = "no-code cryptographic virtual machine"; + longDescription = '' + Zenroom is a tiny, portable, and fully isolated crypto VM for building + privacy-preserving applications, smart contracts, and secure data + workflows. + ''; + homepage = "https://github.com/dyne/Zenroom"; + changelog = "https://github.com/dyne/Zenroom/blob/${finalAttrs.src.rev}/ChangeLog.md"; + mainProgram = "zenroom"; + platforms = lib.platforms.unix; + license = with lib.licenses; [ + agpl3Plus + asl20 # lib/milagro-crypto-c, lib/mlkem, lib/longfellow-zk, lib/mayo + bsd3 # lib/zstd + cc0 # lib/pqclean, lib/ed25519-donna + mit # lib/lua54, src/varint.*, lib/mayo + ]; + maintainers = with lib.maintainers; [ eljamm ]; + teams = with lib.teams; [ ngi ]; + }; +}) diff --git a/pkgs/by-name/ze/zenroom/tests/arrayGenerator.zen b/pkgs/by-name/ze/zenroom/tests/arrayGenerator.zen new file mode 100644 index 000000000000..75cfdf35b402 --- /dev/null +++ b/pkgs/by-name/ze/zenroom/tests/arrayGenerator.zen @@ -0,0 +1,3 @@ +Given nothing +When I create the random array with '16' elements each of '32' bits +Then print all data diff --git a/pkgs/by-name/ze/zenroom/tests/arrayGenerator2.zen b/pkgs/by-name/ze/zenroom/tests/arrayGenerator2.zen new file mode 100644 index 000000000000..848ff86271a4 --- /dev/null +++ b/pkgs/by-name/ze/zenroom/tests/arrayGenerator2.zen @@ -0,0 +1,8 @@ +Given nothing +When I create the random array with '2' elements each of '8' bits +And I rename the 'random array' to 'myTinyArray' +And I create the random array with '4' elements each of '32' bits +And I rename the 'random array' to 'myAverageArray' +And I create the random array with '8' elements each of '128' bits +And I rename the 'random array' to 'myBigFatArray' +Then print all data diff --git a/pkgs/by-name/ze/zenroom/tests/default.nix b/pkgs/by-name/ze/zenroom/tests/default.nix new file mode 100644 index 000000000000..fc1f65afbd8f --- /dev/null +++ b/pkgs/by-name/ze/zenroom/tests/default.nix @@ -0,0 +1,18 @@ +{ + runCommand, + zenroom, +}: +runCommand "basic-tests" + { + nativeBuildInputs = [ zenroom ]; + } + '' + mkdir -p $out + + TEST_DIR="${./.}" + + for test in "$TEST_DIR"/*.zen; do + TEST_NAME="$(basename $test .zen)" + zenroom -z $test > "$out/$TEST_NAME".json + done + ''