Add custom lib
This commit is contained in:
parent
8f97bc80e3
commit
2240c4e256
3 changed files with 22 additions and 0 deletions
13
lib/patches.nix
Normal file
13
lib/patches.nix
Normal 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue