about summary refs log tree commit diff
path: root/users/Profpatsch/netencode/default.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-01-02T13·59+0100
committerProfpatsch <mail@profpatsch.de>2021-01-03T16·29+0000
commitf1c38e25600d4b61b84a5cdba1c7c9a28cc742a7 (patch)
tree2412db12959811d8f274154334238217ccb28148 /users/Profpatsch/netencode/default.nix
parent1261616bff04b6a5cb966778da8a336245c08979 (diff)
feat(Profpatsch): dump netencode spec & parser r/2057
The netencode standard, a no-nonsense extension of netstrings for
structured data.

Includes a nix generator module and a rust parsing library.

Imported from
https://github.com/openlab-aux/vuizvui/tree/e409df3861f48de44d0e37277ce007e348a7a0dc/pkgs/profpatsch/netencode

Original license GPLv3, but I’m the sole author, so I transfer it to
whatever license depot uses.

Change-Id: I4f6fa97120a0fd861eeef35085a3dd642ab7c407
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2319
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch/netencode/default.nix')
-rw-r--r--users/Profpatsch/netencode/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/users/Profpatsch/netencode/default.nix b/users/Profpatsch/netencode/default.nix
new file mode 100644
index 000000000000..4a06cd700e94
--- /dev/null
+++ b/users/Profpatsch/netencode/default.nix
@@ -0,0 +1,48 @@
+{ pkgs, depot, ... }:
+
+let
+  imports = {
+    inherit (depot.users.Profpatsch)
+      writers;
+  };
+
+  version-check = pkgs.buildRustCrate {
+    pname = "version-check";
+    version = "0.9.2";
+    crateName = "version-check";
+    sha256 = "1vwvc1mzwv8ana9jv8z933p2xzgj1533qwwl5zr8mi89azyhq21v";
+  };
+  memchr = pkgs.buildRustCrate {
+    pname = "memchr";
+    version = "2.3.3";
+    crateName = "memchr";
+    sha256 = "1ivxvlswglk6wd46gadkbbsknr94gwryk6y21v64ja7x4icrpihw";
+  };
+  nom = pkgs.buildRustCrate {
+    pname = "nom";
+    version = "5.1.1";
+    crateName = "nom";
+    sha256 = "1gb4r6mjwd645jqh02nhn60i7qkw8cgy3xq1r4clnmvz3cmkv1l0";
+    dependencies = [ memchr ];
+    buildDependencies = [ version-check ];
+    features = [ "std" "alloc" ];
+  };
+
+  netencode-rs-common = tests: imports.writers.rustSimpleLib {
+    name = "netencode";
+    dependencies = [ nom ];
+    buildTests = tests;
+    release = false;
+    verbose = true;
+  } (builtins.readFile ./netencode.rs);
+
+  netencode-rs-tests = netencode-rs-common true;
+
+  netencode-rs = netencode-rs-common false;
+
+in {
+  inherit
+   netencode-rs
+   netencode-rs-tests
+   ;
+}