Guest User

Untitled

a guest
Aug 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. { lib, ... }:
  2.  
  3. with lib;
  4.  
  5. let
  6. # Recursively constructs an attrset of a given folder, recursing on directories,
  7. # value of attrs is the filetype
  8. foo = bar;
  9.  
  10. getDir =
  11. (dir: mapAttrs (file: type:
  12. if type == "directory"
  13. then getDir "${dir}/${file}"
  14. else type)
  15. (builtins.readDir dir));
  16.  
  17. # Collects all files of a directory as a list of strings of paths
  18. files =
  19. dir: collect isString
  20. (mapAttrsRecursive
  21. (path: type: concatStringsSep "/" path)
  22. (getDir dir));
  23.  
  24. in dir: map (file: dir + "/${file}")
  25. (filter (file:
  26. (!(hasSuffix ".lib.nix" file)) &&
  27. hasSuffix ".nix" file &&
  28. file != "default.nix") (files dir))
Add Comment
Please, Sign In to add comment