about summary refs log tree commit diff
path: root/users/sterni/nix/fun/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'users/sterni/nix/fun/default.nix')
-rw-r--r--users/sterni/nix/fun/default.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/users/sterni/nix/fun/default.nix b/users/sterni/nix/fun/default.nix
index a32b70a62b..6b3541ed4c 100644
--- a/users/sterni/nix/fun/default.nix
+++ b/users/sterni/nix/fun/default.nix
@@ -26,6 +26,19 @@ let
   lrs = x: fs:
     builtins.foldl' (v: f: f v) x fs;
 
+  # Warning: cursed function
+  #
+  # Check if a function has an attribute
+  # set pattern with an ellipsis as its argument.
+  #
+  # s/o to puck for discovering that you could use
+  # builtins.toXML to introspect functions more than
+  # you should be able to in Nix.
+  hasEllipsis = f:
+    builtins.isFunction f &&
+    builtins.match ".*<attrspat ellipsis=\"1\">.*"
+      (builtins.toXML f) != null;
+
 in
 
 {
@@ -41,5 +54,6 @@ in
     rls
     lr
     lrs
+    hasEllipsis
     ;
 }