Skip to content

lib.fileset.gitTracked should support out-of-tree builds #269283

@infinisil

Description

@infinisil

Issue description

Currently, using gitTracked ./. in a local project fails when that project is fetched with e.g. fetchGit, since there's no .git directory in that case.

Steps to reproduce

With https://github.com/infinisil/gitTracked-example/blob/main/default.nix:

$ nix-instantiate https://github.com/infinisil/gitTracked-example/tarball/master --eval -A outPath
error: lib.fileset.gitTracked: Expected the argument (/nix/store/sdhphiawzjiw9yxr50iqf729sd14wmy1-source) to point to a local working tree of a Git repository, but it's not.

Proposed solution

Detect whether the passed path is already in the Nix store, in which case just return the set of all its files. Only fail if that's not the case.
A bit icky but might be fine? Needs a bit more thought.

This issue is sponsored by Antithesis

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions