Skip to content

Commit

Permalink
Set planned for whole package if it is pre-existing.
Browse files Browse the repository at this point in the history
This should fix a problem where `exe:happy` is not `planned` because happy is already installed.
  • Loading branch information
hamishmack committed Jul 20, 2021
1 parent a1a6b39 commit 2cea910
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plan2nix/Plan2Nix.hs
Expand Up @@ -247,10 +247,11 @@ value2plan plan = Plan { packages, components, extras, compilerVersion, compiler
components =
Set.fromList
$ map (\pkg ->
quoted (pkg ^. key "pkg-name" . _String) <> ".components." <>
quoted (pkg ^. key "pkg-name" . _String) <>
if pkg ^. key "type" . _String == "pre-existing"
then "library"
else Text.pack . componentNameToHaskellNixAttr (pkg ^. key "pkg-name" . _String) . Text.unpack $ pkg ^. key "component-name" . _String)
then ""
else ".components." <> (
Text.pack . componentNameToHaskellNixAttr (pkg ^. key "pkg-name" . _String) . Text.unpack $ pkg ^. key "component-name" . _String))
$ Vector.toList (plan ^. key "install-plan" . _Array)

componentNameToHaskellNixAttr :: Text -> String -> String
Expand Down

0 comments on commit 2cea910

Please sign in to comment.