{ lib, ... }: with lib; let regular-files = path: let is-regular-file = filename: type: type == "regular" || type == "link"; in attrNames (filterAttrs is-regular-file (builtins.readDir path)); nix-files = path: let is-nix-file = filename: (builtins.match "^(.+)\.nix$" filename) != null; in map (file: path + "/${file}") (filter is-nix-file (regular-files path)); strip-ext = filename: head (builtins.match "^(.+)[.]nix$" filename); basename-to-map = path: listToAttrs (map (file: nameValuePair (strip-ext file) (import (path + "${file}"))) (nix-files path)); in { inherit regular-files nix-files strip-ext basename-to-map; }