about summary refs log tree commit diff
path: root/users/Profpatsch/netstring
diff options
context:
space:
mode:
Diffstat (limited to 'users/Profpatsch/netstring')
-rw-r--r--users/Profpatsch/netstring/default.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/users/Profpatsch/netstring/default.nix b/users/Profpatsch/netstring/default.nix
index 2b21cde388e5..eee5358fddd9 100644
--- a/users/Profpatsch/netstring/default.nix
+++ b/users/Profpatsch/netstring/default.nix
@@ -1,5 +1,17 @@
 { lib, pkgs, depot, ... }:
 let
+  toNetstring = s:
+    "${toString (builtins.stringLength s)}:${s},";
+
+  toNetstringList = xs:
+    lib.concatStrings (map toNetstring xs);
+
+  toNetstringKeyVal = attrs:
+    lib.concatStrings
+      (lib.mapAttrsToList
+        (k: v: toNetstring (toNetstring k + toNetstring v))
+        attrs);
+
   python-netstring = depot.users.Profpatsch.writers.python3Lib {
     name = "netstring";
   } ''