about summary refs log tree commit diff
path: root/users/Profpatsch/netstring/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'users/Profpatsch/netstring/default.nix')
-rw-r--r--users/Profpatsch/netstring/default.nix29
1 files changed, 21 insertions, 8 deletions
diff --git a/users/Profpatsch/netstring/default.nix b/users/Profpatsch/netstring/default.nix
index 2b21cde388..047fe6bae1 100644
--- a/users/Profpatsch/netstring/default.nix
+++ b/users/Profpatsch/netstring/default.nix
@@ -1,8 +1,16 @@
 { lib, pkgs, depot, ... }:
 let
-  python-netstring = depot.users.Profpatsch.writers.python3Lib {
-    name = "netstring";
-  } ''
+  toNetstring = depot.nix.netstring.fromString;
+
+  toNetstringList = xs:
+    lib.concatStrings (map toNetstring xs);
+
+  toNetstringKeyVal = depot.nix.netstring.attrsToKeyValList;
+
+  python-netstring = depot.users.Profpatsch.writers.python3Lib
+    {
+      name = "netstring";
+    } ''
     def read_netstring(bytes):
         (int_length, rest) = bytes.split(sep=b':', maxsplit=1)
         val = rest[:int(int_length)]
@@ -27,9 +35,10 @@ let
         return res
   '';
 
-  rust-netstring = depot.nix.writers.rustSimpleLib {
-    name = "netstring";
-  } ''
+  rust-netstring = depot.nix.writers.rustSimpleLib
+    {
+      name = "netstring";
+    } ''
     pub fn to_netstring(s: &[u8]) -> Vec<u8> {
         let len = s.len();
         // length of the integer as ascii
@@ -43,9 +52,13 @@ let
     }
   '';
 
-in depot.nix.utils.drvTargets {
+in
+depot.nix.readTree.drvTargets {
   inherit
+    toNetstring
+    toNetstringList
+    toNetstringKeyVal
     python-netstring
     rust-netstring
-      ;
+    ;
 }