Skip to content

Commit 7199928

Browse files
committed
feat(lock): import atoms from published refs
The evaluation will prefer a local path, if it exists, to make interactive development in repos with more than one atom convenient.
1 parent f9180e1 commit 7199928

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

atom-nix/core/importAtom.nix

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,25 @@ let
9696
if builtins.pathExists lockPath && lock.version == 1 then
9797
builtins.listToAttrs (
9898
map (dep: {
99-
inherit (dep) name;
99+
name = dep.name or dep.id;
100100
value =
101101
let
102-
path = "${root}/${dep.path}@.toml";
102+
path = "${root}/${dep.path or dep.id}@.toml";
103103
in
104-
if dep ? version && dep ? path && builtins.pathExists path then
105-
(import ./importAtom.nix) { } path
104+
if dep ? version && dep ? id then
105+
if builtins.pathExists path then
106+
(import ./importAtom.nix) { } path
107+
else
108+
let
109+
spec = baseNameOf path;
110+
in
111+
(import ./importAtom.nix) { }
112+
"${
113+
(builtins.fetchGit {
114+
inherit (dep) url rev;
115+
ref = "refs/atoms/${dep.id}/${dep.version}/atom";
116+
})
117+
}/${spec}"
106118
else if dep ? rev then
107119
let
108120
repo = builtins.fetchGit {

0 commit comments

Comments
 (0)