Skip to content

Commit d20a062

Browse files
committed
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.
1 parent f106cc6 commit d20a062

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

nix/package.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ buildNpmPackage {
1616
src =
1717
let
1818
fs = lib.fileset;
19+
# gitTracked fails when source is already a store path (path: flake inputs).
20+
# Detect this and fall back to cleanSource which handles both cases.
21+
isStorePath = builtins.storeDir == builtins.substring 0 (builtins.stringLength builtins.storeDir) (toString ../.);
22+
baseFiles = if isStorePath then fs.fromSource (lib.cleanSource ../.) else fs.gitTracked ../.;
1923
in
2024
fs.toSource {
2125
root = ../.;
22-
fileset = fs.difference (fs.gitTracked ../.) (
26+
fileset = fs.difference baseFiles (
2327
fs.unions [
2428
../nix
2529
../flake.nix

0 commit comments

Comments
 (0)