2017-08-01 18:44:08 +02:00
|
|
|
{ lib, haskellLib, fetchpatch, makeWrapper, haskellPackages
|
2015-04-14 01:06:18 +02:00
|
|
|
, mueval
|
|
|
|
, withDjinn ? true
|
|
|
|
, aspell ? null
|
|
|
|
, packages ? (pkgs: [])
|
2015-09-08 16:17:09 +02:00
|
|
|
, modules ? "oldDefaultModules"
|
2015-04-20 15:10:35 +02:00
|
|
|
, configuration ? "[]"
|
2015-04-14 01:06:18 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
let allPkgs = pkgs: mueval.defaultPkgs pkgs ++ [ pkgs.lambdabot-trusted ] ++ packages pkgs;
|
|
|
|
mueval' = mueval.override {
|
2015-09-08 16:17:09 +02:00
|
|
|
inherit haskellPackages;
|
2015-04-14 01:06:18 +02:00
|
|
|
packages = allPkgs;
|
|
|
|
};
|
2016-04-13 14:53:51 +02:00
|
|
|
bins = lib.makeBinPath ([ mueval'
|
2018-01-31 12:29:02 +01:00
|
|
|
(haskellPackages.ghcWithHoogle allPkgs)
|
2016-04-13 14:53:51 +02:00
|
|
|
haskellPackages.unlambda
|
|
|
|
haskellPackages.brainfuck
|
|
|
|
]
|
|
|
|
++ lib.optional withDjinn haskellPackages.djinn
|
|
|
|
++ lib.optional (aspell != null) aspell
|
|
|
|
);
|
2015-09-08 16:17:09 +02:00
|
|
|
modulesStr = lib.replaceChars ["\n"] [" "] modules;
|
2015-04-20 15:10:35 +02:00
|
|
|
configStr = lib.replaceChars ["\n"] [" "] configuration;
|
2015-04-14 01:06:18 +02:00
|
|
|
|
2017-08-01 18:44:08 +02:00
|
|
|
in haskellLib.overrideCabal haskellPackages.lambdabot (self: {
|
2015-09-08 16:17:09 +02:00
|
|
|
patches = (self.patches or []) ++ [ ./custom-config.patch ];
|
2015-04-14 01:06:18 +02:00
|
|
|
postPatch = (self.postPatch or "") + ''
|
2015-04-20 15:10:35 +02:00
|
|
|
substituteInPlace src/Main.hs \
|
|
|
|
--replace '@config@' '${configStr}'
|
2015-09-08 16:17:09 +02:00
|
|
|
substituteInPlace src/Modules.hs \
|
|
|
|
--replace '@modules@' '${modulesStr}'
|
2015-04-14 01:06:18 +02:00
|
|
|
'';
|
|
|
|
|
2015-09-08 16:17:09 +02:00
|
|
|
buildTools = (self.buildTools or []) ++ [ makeWrapper ];
|
2015-04-14 01:06:18 +02:00
|
|
|
|
2015-09-08 16:17:09 +02:00
|
|
|
postInstall = (self.postInstall or "") + ''
|
2015-04-14 01:06:18 +02:00
|
|
|
wrapProgram $out/bin/lambdabot \
|
|
|
|
--prefix PATH ":" '${bins}'
|
|
|
|
'';
|
|
|
|
})
|