]> Git — Sourcephile - sourcephile-nix.git/blob - nixpkgs/overlays/lib/filesystem.nix
nix: revamp secrets
[sourcephile-nix.git] / nixpkgs / overlays / lib / filesystem.nix
1 self: super:
2 with builtins;
3 let lib = super.lib; in
4 {
5 lib = (super.lib or {}) // {
6 loadFile = name: toFile (baseNameOf (toString name)) (readFile name);
7 findFiles = pattern:
8 let go = curr:
9 let dir = readDir curr; in
10 let files = lib.filterAttrs (name: type:
11 type == "regular" &&
12 match pattern name != null) dir; in
13 let dirs = lib.filterAttrs (name: type: type == "directory") dir; in
14 map (name: "${curr}/${name}") (attrNames files) ++
15 lib.concatMap (name: go "${curr}/${name}") (attrNames dirs)
16 ;
17 in go;
18 };
19 }