2015-04-28 04:55:54 +02:00
|
|
|
|
/*
|
|
|
|
|
If user need access to more haskell package for building his
|
|
|
|
|
diagrams, he simply has to pass these package through the
|
|
|
|
|
extra packages function as follow in `config.nix`:
|
2020-11-05 22:06:46 +01:00
|
|
|
|
|
2015-04-28 04:55:54 +02:00
|
|
|
|
~~~
|
|
|
|
|
diagrams-builder.override {
|
|
|
|
|
extraPackages = self : [myHaskellPackage];
|
|
|
|
|
}
|
|
|
|
|
~~~
|
|
|
|
|
*/
|
|
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
|
{ lib, stdenv, ghcWithPackages, makeWrapper, diagrams-builder, extraPackages ? (self: []) }:
|
2015-04-30 03:45:57 +02:00
|
|
|
|
|
2015-04-28 04:55:54 +02:00
|
|
|
|
let
|
2015-04-30 03:45:57 +02:00
|
|
|
|
|
2015-04-28 04:55:54 +02:00
|
|
|
|
# Used same technique as for the yiCustom package.
|
2020-11-05 22:06:46 +01:00
|
|
|
|
wrappedGhc = ghcWithPackages
|
2015-04-28 04:55:54 +02:00
|
|
|
|
(self: [ diagrams-builder ] ++ extraPackages self);
|
2015-04-30 03:45:57 +02:00
|
|
|
|
ghcVersion = wrappedGhc.version;
|
|
|
|
|
|
|
|
|
|
exeWrapper = backend : ''
|
|
|
|
|
makeWrapper \
|
|
|
|
|
"${diagrams-builder}/bin/diagrams-builder-${backend}" "$out/bin/diagrams-builder-${backend}" \
|
|
|
|
|
--set NIX_GHC ${wrappedGhc}/bin/ghc \
|
|
|
|
|
--set NIX_GHC_LIBDIR ${wrappedGhc}/lib/ghc-${ghcVersion}
|
|
|
|
|
'';
|
2020-11-05 22:06:46 +01:00
|
|
|
|
|
2015-04-30 03:45:57 +02:00
|
|
|
|
backends = ["svg" "cairo" "ps"];
|
|
|
|
|
|
2015-04-28 04:55:54 +02:00
|
|
|
|
in
|
2015-04-30 03:45:57 +02:00
|
|
|
|
|
2015-04-28 04:55:54 +02:00
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
|
name = "diagrams-builder";
|
2015-04-30 03:45:57 +02:00
|
|
|
|
|
2021-02-07 10:17:39 +01:00
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2015-04-28 04:55:54 +02:00
|
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
|
buildCommand = with lib;
|
2015-04-30 03:45:57 +02:00
|
|
|
|
concatStrings (intersperse "\n" (map exeWrapper backends));
|
2015-04-28 04:55:54 +02:00
|
|
|
|
|
|
|
|
|
# Will be faster to build the wrapper locally then to fetch it from a binary cache.
|
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
meta = diagrams-builder.meta;
|
2020-11-06 00:28:15 +01:00
|
|
|
|
}
|