15 lines
404 B
Nix
15 lines
404 B
Nix
{ lib }: { root, subdir ? null }:
|
|
let
|
|
fs = lib.fileset;
|
|
sourceFiles = fs.difference
|
|
(fs.gitTracked root)
|
|
(fs.fileFilter (file: file.hasExt "nix") root);
|
|
finalSourceFiles =
|
|
if subdir == null then
|
|
sourceFiles
|
|
else
|
|
fs.intersection sourceFiles subdir;
|
|
finalRoot = if subdir == null then root else subdir;
|
|
in
|
|
fs.toSource { root = finalRoot; fileset = finalSourceFiles; }
|