1{
2 lib,
3 haskellLib,
4 makeWrapper,
5 haskellPackages,
6 mueval,
7 withDjinn ? true,
8 aspell ? null,
9 packages ? (pkgs: [ ]),
10 modules ? "oldDefaultModules",
11 configuration ? "[]",
12}:
13
14let
15 allPkgs = pkgs: mueval.defaultPkgs pkgs ++ [ pkgs.lambdabot-trusted ] ++ packages pkgs;
16 mueval' = mueval.override {
17 inherit haskellPackages;
18 packages = allPkgs;
19 };
20 bins = lib.makeBinPath (
21 [
22 mueval'
23 (haskellPackages.ghcWithHoogle allPkgs)
24 haskellPackages.unlambda
25 haskellPackages.brainfuck
26 ]
27 ++ lib.optional withDjinn haskellPackages.djinn
28 ++ lib.optional (aspell != null) aspell
29 );
30 modulesStr = lib.replaceStrings [ "\n" ] [ " " ] modules;
31 configStr = lib.replaceStrings [ "\n" ] [ " " ] configuration;
32
33in
34haskellLib.overrideCabal (self: {
35 patches = (self.patches or [ ]) ++ [ ./custom-config.patch ];
36 postPatch = (self.postPatch or "") + ''
37 substituteInPlace src/Main.hs \
38 --replace '@config@' '${configStr}'
39 substituteInPlace src/Modules.hs \
40 --replace '@modules@' '${modulesStr}'
41 '';
42
43 buildTools = (self.buildTools or [ ]) ++ [ makeWrapper ];
44
45 postInstall = (self.postInstall or "") + ''
46 wrapProgram $out/bin/lambdabot \
47 --prefix PATH ":" '${bins}'
48 '';
49}) haskellPackages.lambdabot