{ lib }: let collectNixFiles = dir: lib.flatten ( lib.mapAttrsToList ( name: type: let path = dir + "/${name}"; in if type == "directory" then collectNixFiles path else if type == "regular" && lib.hasSuffix ".nix" name then [ path ] else [ ] ) (builtins.readDir dir) ); in { inherit collectNixFiles; removeNixSuffix = path: lib.removeSuffix ".nix" (builtins.baseNameOf path); registry.predicates.uniqueValue = value: entries: builtins.length (lib.unique (map value entries)) == builtins.length entries; bridgeName = id: "br-vlan${toString id}"; deriveMac = name: let hash = builtins.hashString "sha256" name; in lib.concatStringsSep ":" ( [ "02" ] ++ map (i: builtins.substring (i * 2) 2 hash) [ 0 1 2 3 4 ] ); }