refactor: pull out template filter into variable

This commit is contained in:
Kiana Sheibani 2026-01-19 14:11:17 -05:00
parent f5427d28a9
commit 9201edf945
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -16,6 +16,9 @@
rust = "rust_cargo-nightly_crane+fenix"; rust = "rust_cargo-nightly_crane+fenix";
}; };
# Files to filter out of the template
template-ignore = [ "flake.lock" "Cargo.lock" ];
# Get all subdirectories of the given path # Get all subdirectories of the given path
# Returns [str] # Returns [str]
subdirs = dir: subdirs = dir:
@ -37,7 +40,7 @@
${concatStringsSep "_" subds} = { ${concatStringsSep "_" subds} = {
description = generateDesc subds; description = generateDesc subds;
path = filterSource path = filterSource
(p: _: !(elem (baseNameOf p) [ "flake.lock" "Cargo.lock" ])) (p: _: !(elem (baseNameOf p) template-ignore))
(foldl' (dir: subd: /${dir}/${subd}) ./. subds); (foldl' (dir: subd: /${dir}/${subd}) ./. subds);
}; };
}) (flakeSubdirs ./.) // mapAttrs (from: to: }) (flakeSubdirs ./.) // mapAttrs (from: to: