Add custom lib

This commit is contained in:
Toast 2025-11-02 09:59:40 +01:00
parent 8f97bc80e3
commit 2240c4e256
3 changed files with 22 additions and 0 deletions

13
lib/patches.nix Normal file
View file

@ -0,0 +1,13 @@
{lib}: {
/**
Get a list of patches from a path.
*/
patchesInPath = path: let
pathContents = builtins.readDir path;
filter = name: value:
(value == "regular" || value == "symlink") && lib.strings.hasSuffix ".patch" name;
filteredContents = lib.attrsets.filterAttrs filter pathContents;
patchFilenames = builtins.attrNames filteredContents;
in
builtins.map (value: lib.path.append path value) patchFilenames;
}