fix(nix): handle store path sources for path: flake inputs

gitTracked uses builtins.fetchGit which fails when the source is
already a store path (happens with path: flake inputs from consuming
flakes). Detect store paths at eval time and fall back to cleanSource.
This commit is contained in:
Enriquefft
2026-04-13 06:17:07 -05:00
parent f106cc6835
commit d20a062150
+5 -1
View File
@@ -16,10 +16,14 @@ buildNpmPackage {
src =
let
fs = lib.fileset;
# gitTracked fails when source is already a store path (path: flake inputs).
# Detect this and fall back to cleanSource which handles both cases.
isStorePath = builtins.storeDir == builtins.substring 0 (builtins.stringLength builtins.storeDir) (toString ../.);
baseFiles = if isStorePath then fs.fromSource (lib.cleanSource ../.) else fs.gitTracked ../.;
in
fs.toSource {
root = ../.;
fileset = fs.difference (fs.gitTracked ../.) (
fileset = fs.difference baseFiles (
fs.unions [
../nix
../flake.nix