mirror of
https://github.com/JuLi0n21/publicConfig.git
synced 2026-04-19 16:00:08 +00:00
first commit
This commit is contained in:
18
rI.nix
Normal file
18
rI.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{ 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)
|
||||
Reference in New Issue
Block a user