Skip to content

Commit cc6699b

Browse files
ttuegelangerman
authored andcommitted
stack2nix: Parse extra-deps/github key (input-output-hk#59)
Fixes: input-output-hk#213
1 parent 98ca24d commit cc6699b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

nix-tools/stack2nix/Stack2nix/Stack.hs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,17 @@ pkgIndex = PkgIndex <$> parse <*> suffix <* eof
163163
-- JSON/YAML destructors
164164

165165
instance FromJSON Location where
166-
parseJSON = withObject "Location" $ \l -> Git
167-
<$> l .: "git"
168-
<*> l .: "commit"
166+
parseJSON = withObject "Location" $ \l ->
167+
parseGitHub l <|> parseGit l
168+
where
169+
parseGit l = Git
170+
<$> l .: "git"
171+
<*> l .: "commit"
172+
parseGitHub l = Git
173+
<$> do gitHubUrl <$> l .: "github"
174+
<*> l .: "commit"
175+
gitHubUrl ownerRepo =
176+
"https://github.com/" <> ownerRepo <> ".git"
169177

170178
instance FromJSON Stack where
171179
parseJSON = withObject "Stack" $ \s -> Stack

0 commit comments

Comments
 (0)