1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-12 07:34:36 +00:00
nixpkgs/pkgs/development/tools/haskell/lambdabot/default.nix

44 lines
1.4 KiB
Nix
Raw Normal View History

{ lib, haskell-lib, fetchpatch, makeWrapper, haskellPackages
2015-04-14 00:06:18 +01:00
, mueval
, withDjinn ? true
, aspell ? null
, packages ? (pkgs: [])
, modules ? "oldDefaultModules"
2015-04-20 14:10:35 +01:00
, configuration ? "[]"
2015-04-14 00:06:18 +01:00
}:
# FIXME: fix hoogle search
let allPkgs = pkgs: mueval.defaultPkgs pkgs ++ [ pkgs.lambdabot-trusted ] ++ packages pkgs;
mueval' = mueval.override {
inherit haskellPackages;
2015-04-14 00:06:18 +01:00
packages = allPkgs;
};
bins = lib.makeBinPath ([ mueval'
(haskellPackages.ghcWithPackages allPkgs)
haskellPackages.unlambda
haskellPackages.brainfuck
]
++ lib.optional withDjinn haskellPackages.djinn
++ lib.optional (aspell != null) aspell
);
modulesStr = lib.replaceChars ["\n"] [" "] modules;
2015-04-20 14:10:35 +01:00
configStr = lib.replaceChars ["\n"] [" "] configuration;
2015-04-14 00:06:18 +01:00
in haskell-lib.overrideCabal haskellPackages.lambdabot (self: {
patches = (self.patches or []) ++ [ ./custom-config.patch ];
2015-04-14 00:06:18 +01:00
postPatch = (self.postPatch or "") + ''
2015-04-20 14:10:35 +01:00
substituteInPlace src/Main.hs \
--replace '@config@' '${configStr}'
substituteInPlace src/Modules.hs \
--replace '@modules@' '${modulesStr}'
2015-04-14 00:06:18 +01:00
'';
buildTools = (self.buildTools or []) ++ [ makeWrapper ];
2015-04-14 00:06:18 +01:00
postInstall = (self.postInstall or "") + ''
2015-04-14 00:06:18 +01:00
wrapProgram $out/bin/lambdabot \
--prefix PATH ":" '${bins}'
'';
})