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