diff --git a/overlays/bootstrap.nix b/overlays/bootstrap.nix index a2eb9d8e4b..20fadef3a1 100644 --- a/overlays/bootstrap.nix +++ b/overlays/bootstrap.nix @@ -241,6 +241,7 @@ in { ++ final.lib.optionals (final.stdenv.targetPlatform.isGhcjs) (fromUntil "9.6.1" "9.6.3" ./patches/ghc/ghc-9.6-JS-implement-TH-support.patch) ++ final.lib.optionals (final.stdenv.targetPlatform.isGhcjs) (fromUntil "9.6.3" "9.8" ./patches/ghc/ghc-9.6.3-JS-implement-TH-support.patch) ++ fromUntil "9.8.1" "9.8.2" ./patches/ghc/ghc-9.8-cabal-c-soures-fix.patch + ++ fromUntil "9.6.3" "9.9" ./patches/ghc/ghc-9.6.3-Cabal-9384.patch # the following is a partial reversal of https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4391, to address haskell.nix#1227 ++ final.lib.optional (versionAtLeast "8.10.6" && versionLessThan "9.0" && final.stdenv.targetPlatform.isAarch64) ./patches/ghc/mmap-next.patch diff --git a/overlays/patches/ghc/ghc-9.6.3-Cabal-9384.patch b/overlays/patches/ghc/ghc-9.6.3-Cabal-9384.patch new file mode 100644 index 0000000000..2b1112f6cd --- /dev/null +++ b/overlays/patches/ghc/ghc-9.6.3-Cabal-9384.patch @@ -0,0 +1,48 @@ +diff --git a/libraries/Cabal/Cabal/src/Distribution/Simple/GHC.hs b/libraries/Cabal/Cabal/src/Distribution/Simple/GHC.hs +index 9d653f858..1fbd15318 100644 +--- a/libraries/Cabal/Cabal/src/Distribution/Simple/GHC.hs ++++ b/libraries/Cabal/Cabal/src/Distribution/Simple/GHC.hs +@@ -1861,18 +1861,12 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do + libBi = libBuildInfo lib + comp = compiler lbi + platform = hostPlatform lbi +- vanillaArgs0 = ++ vanillaArgs = + (componentGhcOptions verbosity lbi libBi clbi (componentBuildDir lbi clbi)) + `mappend` mempty { + ghcOptMode = toFlag GhcModeAbiHash, + ghcOptInputModules = toNubListR $ exposedModules lib + } +- vanillaArgs = +- -- Package DBs unnecessary, and break ghc-cabal. See #3633 +- -- BUT, put at least the global database so that 7.4 doesn't +- -- break. +- vanillaArgs0 { ghcOptPackageDBs = [GlobalPackageDB] +- , ghcOptPackages = mempty } + sharedArgs = vanillaArgs `mappend` mempty { + ghcOptDynLinkMode = toFlag GhcDynamicOnly, + ghcOptFPic = toFlag True, +diff --git a/libraries/Cabal/Cabal/src/Distribution/Simple/GHCJS.hs b/libraries/Cabal/Cabal/src/Distribution/Simple/GHCJS.hs +index c8721746a..dcd5b3230 100644 +--- a/libraries/Cabal/Cabal/src/Distribution/Simple/GHCJS.hs ++++ b/libraries/Cabal/Cabal/src/Distribution/Simple/GHCJS.hs +@@ -1573,18 +1573,12 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do + libBi = libBuildInfo lib + comp = compiler lbi + platform = hostPlatform lbi +- vanillaArgs0 = ++ vanillaArgs = + (componentGhcOptions verbosity lbi libBi clbi (componentBuildDir lbi clbi)) + `mappend` mempty { + ghcOptMode = toFlag GhcModeAbiHash, + ghcOptInputModules = toNubListR $ exposedModules lib + } +- vanillaArgs = +- -- Package DBs unnecessary, and break ghc-cabal. See #3633 +- -- BUT, put at least the global database so that 7.4 doesn't +- -- break. +- vanillaArgs0 { ghcOptPackageDBs = [GlobalPackageDB] +- , ghcOptPackages = mempty } + sharedArgs = vanillaArgs `mappend` mempty { + ghcOptDynLinkMode = toFlag GhcDynamicOnly, + ghcOptFPic = toFlag True, diff --git a/test/default.nix b/test/default.nix index ae670df841..18eb973dce 100644 --- a/test/default.nix +++ b/test/default.nix @@ -218,6 +218,7 @@ let ca-derivations-include = callTest ./ca-derivations-include { inherit CADerivationsEnabled; }; test-only = callTest ./test-only { inherit util; }; cabal-project-nix-path = callTest ./cabal-project-nix-path {}; + plugin = callTest ./plugin {}; unit = unitTests; }; diff --git a/test/plugin/default.nix b/test/plugin/default.nix new file mode 100644 index 0000000000..d0a969ed90 --- /dev/null +++ b/test/plugin/default.nix @@ -0,0 +1,27 @@ +{ stdenv, lib, haskellLib, project', recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, buildPackages }: + +with lib; + +let + project = project' { + inherit compiler-nix-name evalPackages; + src = testSrc "plugin"; + }; + + packages = project.hsPkgs; + +in recurseIntoAttrs { + ifdInputs = { + inherit (project) plan-nix; + }; + + # Not sure why this breaks for ghc 8.10.7 + meta.disabled = compiler-nix-name == "ghc8107" + # TODO remove once polysemy works with ghc 9.8.1 + || __compareVersions buildPackages.haskell-nix.compiler.${compiler-nix-name}.version "9.8.1" >= 0 + || stdenv.hostPlatform.isMusl + || stdenv.hostPlatform.isGhcjs + || stdenv.hostPlatform.isWindows + || (haskellLib.isCrossHost && stdenv.hostPlatform.isAarch64); + build = packages.test.components.library; +} diff --git a/test/plugin/src/MyLib.hs b/test/plugin/src/MyLib.hs new file mode 100644 index 0000000000..e657c4403f --- /dev/null +++ b/test/plugin/src/MyLib.hs @@ -0,0 +1,4 @@ +module MyLib (someFunc) where + +someFunc :: IO () +someFunc = putStrLn "someFunc" diff --git a/test/plugin/test.cabal b/test/plugin/test.cabal new file mode 100644 index 0000000000..48d32120bd --- /dev/null +++ b/test/plugin/test.cabal @@ -0,0 +1,11 @@ +cabal-version: 3.4 +name: test +version: 0.1.0.0 +build-type: Simple + +library + exposed-modules: MyLib + build-depends: base, polysemy, polysemy-plugin + ghc-options: -Wall -fplugin=Polysemy.Plugin + hs-source-dirs: src + default-language: Haskell2010