Skip to content

Commit 0f9255e

Browse files
committed
Force root sources like "./." into the Nix store
1 parent 5a16547 commit 0f9255e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

default.nix

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,20 @@ let
104104
then
105105
let res = builtins.fetchGit src;
106106
in if res.rev == "0000000000000000000000000000000000000000" then removeAttrs res ["rev" "shortRev"] else res
107-
else { outPath = src; };
107+
else {
108+
outPath =
109+
# Massage `src` into a store path.
110+
if builtins.isPath src
111+
then
112+
if dirOf (toString src) == builtins.storeDir
113+
then
114+
# If it's already a store path, don't copy it again.
115+
builtins.storePath src
116+
else
117+
"${src}"
118+
else
119+
src;
120+
};
108121
# NB git worktrees have a file for .git, so we don't check the type of .git
109122
isGit = builtins.pathExists (src + "/.git");
110123
isShallow = builtins.pathExists (src + "/.git/shallow");
@@ -149,7 +162,7 @@ let
149162

150163
subdir = if key == lockFile.root then "" else node.locked.dir or "";
151164

152-
outPath = (builtins.storePath sourceInfo) + ((if subdir == "" then "" else "/") + subdir);
165+
outPath = sourceInfo + ((if subdir == "" then "" else "/") + subdir);
153166

154167
flake = import (outPath + "/flake.nix");
155168

0 commit comments

Comments
 (0)