metanix/lib/metanix.nix
2025-07-20 12:45:51 -05:00

12 lines
272 B
Nix

{ data, lib }:
let
indexOf = name: names:
let
indexed = builtins.imap0 (i: v: { inherit i v; }) names;
matches = builtins.filter (x: x.v == name) indexed;
in
if matches == [ ] then null else (builtins.head matches).i;
in
{ indexOf = indexOf; }