mirror of
https://github.com/JuLi0n21/publicConfig.git
synced 2026-04-19 16:00:08 +00:00
18 lines
563 B
Nix
18 lines
563 B
Nix
{ lib }:
|
|
|
|
let
|
|
inherit (lib) hasSuffix;
|
|
inherit (builtins) concatMap isPath filter readFileType;
|
|
|
|
expandIfFolder = elem:
|
|
if !isPath elem || readFileType elem != "directory"
|
|
then [ elem ]
|
|
else lib.filesystem.listFilesRecursive elem;
|
|
|
|
in
|
|
list: filter
|
|
# Filter out any path that doesn't look like `*.nix`. Don't forget to use
|
|
# toString to prevent copying paths to the store unnecessarily
|
|
(elem: !isPath elem || hasSuffix ".nix" (toString elem))
|
|
# Expand any folder to all the files within it.
|
|
(concatMap expandIfFolder list) |