lambdabot, mueval: move to development/tools/haskell

This commit is contained in:
Nikolay Amiantov
2015-04-16 15:53:57 +03:00
parent 138de6b6e1
commit 5dec393125
3 changed files with 3 additions and 3 deletions
@@ -0,0 +1,47 @@
{ lib, makeWrapper, haskellngPackages
, mueval
, withDjinn ? true
, aspell ? null
, packages ? (pkgs: [])
, modules ? ''
haskellPlugins
++ ["irc", "localtime", "topic"]
++ ["dummy", "fresh", "todo"]
++ ["bf", "dice", "elite", "filter", "quote", "slap", "unlambda", "vixen"]
++ referencePlugins
++ socialPlugins
''
}:
# FIXME: fix hoogle search
let allPkgs = pkgs: mueval.defaultPkgs pkgs ++ [ pkgs.lambdabot-trusted ] ++ packages pkgs;
mueval' = mueval.override {
inherit haskellngPackages;
packages = allPkgs;
};
bins = lib.makeSearchPath "bin" ([ mueval'
(haskellngPackages.ghcWithPackages allPkgs)
haskellngPackages.unlambda
haskellngPackages.brainfuck
]
++ lib.optional withDjinn haskellngPackages.djinn
++ lib.optional (aspell != null) aspell
);
modulesStr = lib.replaceChars ["\n"] [" "] ("corePlugins ++ " + modules);
in lib.overrideDerivation haskellngPackages.lambdabot (self: {
postPatch = (self.postPatch or "") + ''
sed -i 's/\(\$(modules \$ \).*/\1@modules@)/; /@modules@/q' src/Modules.hs
# not via sed to avoid escaping issues
substituteInPlace src/Modules.hs \
--replace '@modules@' '${modulesStr}'
'';
buildInputs = self.buildInputs ++ [ makeWrapper ];
postInstall = (self.postInstall or "") + lib.optionalString (bins != "") ''
wrapProgram $out/bin/lambdabot \
--prefix PATH ":" '${bins}'
'';
})
@@ -0,0 +1,32 @@
{ stdenv, makeWrapper, haskellngPackages, packages ? (pkgs: [])
}:
let defaultPkgs = pkgs: [ pkgs.show
pkgs.simple-reflect
pkgs.QuickCheck
pkgs.mtl
];
env = haskellngPackages.ghcWithPackages
(pkgs: defaultPkgs pkgs ++ packages pkgs);
libDir = "${env}/lib/ghc-${env.version}";
in stdenv.mkDerivation {
name = "mueval-env";
inherit (haskellngPackages) mueval;
nativeBuildInputs = [ makeWrapper ];
buildCommand = ''
mkdir -p $out/bin
makeWrapper $mueval/bin/mueval $out/bin/mueval \
--prefix PATH ":" "$out/bin"
makeWrapper $mueval/bin/mueval-core $out/bin/mueval \
--set "NIX_GHC_LIBDIR" "${libDir}"
'';
passthru = { inherit defaultPkgs; };
}