Skip to content

Commit

Permalink
Fix source-repo under Cabal 3.4 generated plans (input-output-hk#106)
Browse files Browse the repository at this point in the history
They are no longer always local:

haskell/cabal@2b6cd51

haskell/cabal#5586
  • Loading branch information
puffnfresh authored Jul 10, 2021
1 parent fd74ee4 commit 5af6d11
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions nix-tools/plan2nix/Plan2Nix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,15 @@ value2plan plan = Plan { packages, extras, compilerVersion, compilerPackages }
}
_ -> Nothing

extras = fmap Just $ filterInstallPlan $ \pkg -> case ( pkg ^. key "type" . _String
, pkg ^. key "style" . _String
, pkg ^. key "pkg-src" . key "type" . _String
, pkg ^. key "pkg-src" . _Object) of
(_, "local", "local", _) -> Just $ Package
extras = fmap Just $ filterInstallPlan $ \pkg -> case ( pkg ^. key "style" . _String
, pkg ^. key "pkg-src" . key "type" . _String) of
("local", "local") -> Just $ Package
{ packageVersion = pkg ^. key "pkg-version" . _String
, packageRevision = Nothing
, packageFlags = Map.mapMaybe (^? _Bool) $ pkg ^. key "flags" . _Object
, packageSrc = Just . LocalPath . Text.unpack $ pkg ^. key "pkg-src" . key "path" . _String
}
(_, "local", "source-repo", _) -> Just $ Package
(_, "source-repo") -> Just $ Package
{ packageVersion = pkg ^. key "pkg-version" . _String
, packageRevision = Nothing
, packageFlags = Map.mapMaybe (^? _Bool) $ pkg ^. key "flags" . _Object
Expand Down

0 comments on commit 5af6d11

Please sign in to comment.