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
John Ericson 74f5fe5068 haskell infra: Misc cleanups
- The haskell lib is very close to not relying on Nixpkgs. I think
   this is good---simpler to think about and matches Nixpkgs's lib.

 - The haskell lib is only imported once

 - stdenv is exposed more shallowly so it can be overriden more easily.
   I'll eventually use this on Darwin to avoid the Sierra shared
   library problems (unless changes are to be made system-wide).

Closes https://github.com/NixOS/nixpkgs/pull/27840.
2017-08-03 13:12:01 +02:00

44 lines
1.4 KiB
Nix

{ lib, haskellLib, fetchpatch, makeWrapper, haskellPackages
, mueval
, withDjinn ? true
, aspell ? null
, packages ? (pkgs: [])
, modules ? "oldDefaultModules"
, configuration ? "[]"
}:
# FIXME: fix hoogle search
let allPkgs = pkgs: mueval.defaultPkgs pkgs ++ [ pkgs.lambdabot-trusted ] ++ packages pkgs;
mueval' = mueval.override {
inherit haskellPackages;
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;
configStr = lib.replaceChars ["\n"] [" "] configuration;
in haskellLib.overrideCabal haskellPackages.lambdabot (self: {
patches = (self.patches or []) ++ [ ./custom-config.patch ];
postPatch = (self.postPatch or "") + ''
substituteInPlace src/Main.hs \
--replace '@config@' '${configStr}'
substituteInPlace src/Modules.hs \
--replace '@modules@' '${modulesStr}'
'';
buildTools = (self.buildTools or []) ++ [ makeWrapper ];
postInstall = (self.postInstall or "") + ''
wrapProgram $out/bin/lambdabot \
--prefix PATH ":" '${bins}'
'';
})