some cleanup

This commit is contained in:
Henri Dohmen 2025-07-15 11:15:07 +02:00
parent d2d89d7047
commit 240259f623
Signed by: hd
GPG key ID: AB79213B044674AE
7 changed files with 37 additions and 38 deletions

16
lib.nix
View file

@ -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);
}