Skip to content

Instantly share code, notes, and snippets.

@YuMingLiao
Created September 25, 2024 03:47
Show Gist options
  • Save YuMingLiao/4fc2d3e0deb26bf9c77548ddcc9d052c to your computer and use it in GitHub Desktop.
Save YuMingLiao/4fc2d3e0deb26bf9c77548ddcc9d052c to your computer and use it in GitHub Desktop.
{ pkgs }:
with builtins;
with pkgs;
with lib.attrsets;
with stdenv;
with rec {
deepReadDir = path:
let
attrset = readDir path;
go = name: value:
if value == "directory" then
deepReadDir (path + "/${name}")
else
path + "/${name}";
in mapAttrs go attrset;
freezeFiles = path: freezeFileSet (deepReadDir path);
freezeFileSet = attrset: mapAttrsRecursive go attrset;
go = _: filepath: "${filepath}";
}; {
inherit freezeFiles;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment