@@ -36,7 +36,8 @@ hooks :: [(Dependency, Derivation -> Derivation)]
3636hooks =
3737 [ ("alex", set (executableDepends . tool . contains (bind "self.happy")) True)
3838 , ("alex < 3.1.5", set (testDepends . tool . contains (pkg "perl")) True)
39− , ("Agda", set (executableDepends . tool . contains (pkg "emacs")) True . set phaseOverrides agdaPostInstall)
39+ , ("Agda < 2.5", set (executableDepends . tool . contains (pkg "emacs")) True . set phaseOverrides agdaPostInstall)
40+ , ("Agda >= 2.5", set (executableDepends . tool . contains (pkg "emacs")) True . set phaseOverrides agda25PostInstall)
4041 , ("bindings-GLFW", over (libraryDepends . system) (Set.union (Set.fromList [bind "pkgs.xorg.libXext", bind "pkgs.xorg.libXfixes"])))
4142 , ("bustle", set (libraryDepends . pkgconfig . contains (binding # ("system-glib", path # ["pkgs","glib"]))) True)
4243 , ("cabal-install", set phaseOverrides cabalInstallPostInstall)
@@ -205,6 +206,21 @@ agdaPostInstall = unlines
205206 , "'';"
206207 ]
207208
209+agda25PostInstall :: String
210+agda25PostInstall = unlines
211+ [ "postInstall = ''"
212+ , " files=($out/share/*-ghc-*/Agda-*/lib/prim/Agda/{Primitive.agda,Builtin/*.agda})"
213+ -- Separate loops to avoid internal error
214+ , " for f in \"''${files[@]}\" ; do"
215+ , " $out/bin/agda $f"
216+ , " done"
217+ , " for f in \"''${files[@]}\" ; do"
218+ , " $out/bin/agda -c --no-main $f"
219+ , " done"
220+ , " $out/bin/agda-mode compile"
221+ , "'';"
222+ ]
223+
208224stackOverrides :: String
209225stackOverrides = unlines
210226 [ "preCheck = \"export HOME=$TMPDIR\";"