nix: exclude local worktrees from package source

This commit is contained in:
Keisuke Hirata 2026-05-29 01:41:09 +09:00
parent b5e608c597
commit 401d0912b7

View File

@ -16,13 +16,19 @@ let
pathString = toString path;
relPath = lib.removePrefix "${srcRootString}/" pathString;
baseName = baseNameOf pathString;
isExcludedTree = dir: relPath == dir || lib.hasPrefix "${dir}/" relPath;
in
# Keep the package source closure focused on build inputs: exclude VCS/build
# outputs plus local coordination state, generated reports, and child
# worktrees that may live under the repository root during development.
!(
baseName == ".git"
|| baseName == "target"
|| baseName == "result"
|| lib.hasPrefix ".insomnia" relPath
|| lib.hasPrefix "work-items" relPath
|| isExcludedTree ".insomnia"
|| isExcludedTree ".worktree"
|| isExcludedTree "work-items"
|| isExcludedTree "docs/report"
);
in
rustPlatform.buildRustPackage rec {