Merge pull request #5585 from jraygauthier/diagrams-builder

Add haskell diagrams-builder package and its wrapper.
This commit is contained in:
Peter Simons 2015-01-05 12:52:08 +01:00
commit 88de70ebd4
3 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# This file was auto-generated by cabal2nix. Please do NOT edit manually!
{ cabal, blazeSvg, cmdargs, diagramsCairo, diagramsLib
, diagramsPostscript, diagramsSvg, exceptions, filepath, hashable
, haskellSrcExts, hint, lens, mtl, split, transformers
}:
cabal.mkDerivation (self: {
pname = "diagrams-builder";
version = "0.6.0.2";
sha256 = "18avlhwywhrxlf1cyp9fdiy0i3gy12k4i28cymllmmyx78fv59q5";
isLibrary = true;
isExecutable = true;
buildDepends = [
blazeSvg cmdargs diagramsCairo diagramsLib diagramsPostscript
diagramsSvg exceptions filepath hashable haskellSrcExts hint lens
mtl split transformers
];
configureFlags = "-fcairo -fsvg -fps -frasterific";
meta = {
homepage = "http://projects.haskell.org/diagrams";
description = "hint-based build service for the diagrams graphics EDSL";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
};
})

View File

@ -0,0 +1,53 @@
/*
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`:
~~~
diagramBuilderWrapper.override {
extraPackages = self : [myHaskellPackage];
}
­~~~
WARNING:
Note that this solution works well but however, as this is a
non-cabal derivation, user should be carefull to never put this
package inside the listing passed as argument to `ghcWithPackages`
as it will silently disregard the package. This silent disregard
should be regarded as an issue for `ghcWithPackages`. It should
rather raise an error instead when a non-cabal dirivation is
directly passed to it. The alternative would have been to
use a fake cabal file in order to make this a cabal derivation
such as what `yiCustom` package did.
*/
{ stdenv, diagramsBuilder, ghcWithPackages, makeWrapper,
extraPackages ? (self: []) }:
let
# Used same technique as for the yiCustom package.
w = ghcWithPackages
(self: [ diagramsBuilder ] ++ extraPackages self);
wrappedGhc = w.override { ignoreCollisions = true; };
in
stdenv.mkDerivation {
name = diagramsBuilder.name + "-wrapper";
buildInputs = [ makeWrapper ];
buildCommand = ''
makeWrapper \
"${diagramsBuilder}/bin/diagrams-builder-svg" "$out/bin/diagrams-builder-svg" \
--set NIX_GHC ${wrappedGhc}/bin/ghc \
--set NIX_GHC_LIBDIR ${wrappedGhc}/lib/ghc-${diagramsBuilder.ghc.version}
makeWrapper \
"${diagramsBuilder}/bin/diagrams-builder-cairo" "$out/bin/diagrams-builder-cairo" \
--set NIX_GHC ${wrappedGhc}/bin/ghc \
--set NIX_GHC_LIBDIR ${wrappedGhc}/lib/ghc-${diagramsBuilder.ghc.version}
makeWrapper \
"${diagramsBuilder}/bin/diagrams-builder-ps" "$out/bin/diagrams-builder-ps" \
--set NIX_GHC ${wrappedGhc}/bin/ghc \
--set NIX_GHC_LIBDIR ${wrappedGhc}/lib/ghc-${diagramsBuilder.ghc.version}
'';
preferLocalBuild = true;
meta = diagramsBuilder.meta;
}

View File

@ -661,6 +661,8 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
dice = callPackage ../development/libraries/haskell/dice {};
diagrams = callPackage ../development/libraries/haskell/diagrams/diagrams.nix {};
diagramsBuilder = callPackage ../development/libraries/haskell/diagrams/builder { };
diagramsBuilderWrapper = callPackage ../development/libraries/haskell/diagrams/builder/wrapper.nix { };
diagramsCairo = callPackage ../development/libraries/haskell/diagrams/cairo.nix {};
diagramsCore = callPackage ../development/libraries/haskell/diagrams/core.nix {};
diagramsContrib = callPackage ../development/libraries/haskell/diagrams/contrib.nix {};