refactor in style of synaptic standard
This commit is contained in:
parent
ce295da1c1
commit
2fa2ecce0c
119 changed files with 1099 additions and 3109 deletions
21
util/recursively-import.nix
Normal file
21
util/recursively-import.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ lib }:
|
||||
let
|
||||
recurseIntoFolders =
|
||||
elem:
|
||||
if lib.isPath elem && lib.pathIsDirectory elem then
|
||||
lib.filesystem.listFilesRecursive elem
|
||||
else
|
||||
# If it's not a folder, return it unchanged. This handles single-files and
|
||||
# literal modules (written with {} syntax)
|
||||
lib.singleton elem;
|
||||
|
||||
filterNixFiles =
|
||||
paths:
|
||||
builtins.filter
|
||||
# filter the files for `.nix` files. if it's not a file, it can stay.
|
||||
(path: !builtins.isPath path || lib.hasSuffix ".nix" path)
|
||||
# Expand any folders into all the files within them. Note that this comes
|
||||
# BEFORE the filtering that's happening above
|
||||
(builtins.concatMap recurseIntoFolders paths);
|
||||
in
|
||||
filterNixFiles
|
Loading…
Add table
Add a link
Reference in a new issue