some cleanup
This commit is contained in:
parent
d2d89d7047
commit
240259f623
7 changed files with 37 additions and 38 deletions
16
lib.nix
16
lib.nix
|
|
@ -1,7 +1,7 @@
|
|||
{ lib, ... }:
|
||||
with builtins;
|
||||
let
|
||||
walk-dir-inner =
|
||||
rec {
|
||||
walk-dir =
|
||||
path:
|
||||
let
|
||||
dir = readDir path;
|
||||
|
|
@ -12,18 +12,8 @@ let
|
|||
if value == "regular" then
|
||||
path + "/${filename}"
|
||||
else if value == "directory" then
|
||||
walk-dir-inner (path + "/${filename}")
|
||||
walk-dir (path + "/${filename}")
|
||||
else
|
||||
throw "Items of type ${value} are unsupported.";
|
||||
}) dir;
|
||||
|
||||
helper-attrs = subpaths: {
|
||||
_map = f: lib.mapAttrsRecursive (_: f) subpaths;
|
||||
};
|
||||
|
||||
with-helper-attrs =
|
||||
x: if isAttrs x then lib.mapAttrs (_: with-helper-attrs) x // helper-attrs x else x;
|
||||
in
|
||||
{
|
||||
walk-dir = p: with-helper-attrs (walk-dir-inner p);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue