From 76a8089d96670fbb5dd35edaea7e83877c35a7ad Mon Sep 17 00:00:00 2001 From: Raymond Gauthier Date: Mon, 27 Apr 2015 22:55:54 -0400 Subject: [PATCH] Added standalone diagram-builder haskell package. Simple wrapper over `haskellng`'s `diagram-builder` package that allows for simpler install. --- .../graphics/diagrams-builder/default.nix | 43 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++ 2 files changed, 47 insertions(+) create mode 100644 pkgs/tools/graphics/diagrams-builder/default.nix diff --git a/pkgs/tools/graphics/diagrams-builder/default.nix b/pkgs/tools/graphics/diagrams-builder/default.nix new file mode 100644 index 00000000000..fc7766b403c --- /dev/null +++ b/pkgs/tools/graphics/diagrams-builder/default.nix @@ -0,0 +1,43 @@ +/* + 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`: + + ~~~ + diagrams-builder.override { + extraPackages = self : [myHaskellPackage]; + } + ­~~~ +*/ + +{ stdenv, ghcWithPackages, makeWrapper, diagrams-builder, extraPackages ? (self: []) }: +let + # Used same technique as for the yiCustom package. + w = ghcWithPackages + (self: [ diagrams-builder ] ++ extraPackages self); + wrappedGhc = w.override { ignoreCollisions = true; }; + ghcVersion = w.version; +in +stdenv.mkDerivation { + name = "diagrams-builder"; + buildInputs = [ makeWrapper ]; + buildCommand = '' + makeWrapper \ + "${diagrams-builder}/bin/diagrams-builder-svg" "$out/bin/diagrams-builder-svg" \ + --set NIX_GHC ${wrappedGhc}/bin/ghc \ + --set NIX_GHC_LIBDIR ${wrappedGhc}/lib/ghc-${ghcVersion} + + makeWrapper \ + "${diagrams-builder}/bin/diagrams-builder-cairo" "$out/bin/diagrams-builder-cairo" \ + --set NIX_GHC ${wrappedGhc}/bin/ghc \ + --set NIX_GHC_LIBDIR ${wrappedGhc}/lib/ghc-${ghcVersion} + + makeWrapper \ + "${diagrams-builder}/bin/diagrams-builder-ps" "$out/bin/diagrams-builder-ps" \ + --set NIX_GHC ${wrappedGhc}/bin/ghc \ + --set NIX_GHC_LIBDIR ${wrappedGhc}/lib/ghc-${ghcVersion} + ''; + # Will be faster to build the wrapper locally then to fetch it from a binary cache. + preferLocalBuild = true; + meta = diagrams-builder.meta; +} \ No newline at end of file diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 95bd693a9f8..a8e23ea89bd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -764,6 +764,10 @@ let ddate = callPackage ../tools/misc/ddate { }; + diagrams-builder = callPackage ../tools/graphics/diagrams-builder { + inherit (haskellngPackages) ghcWithPackages diagrams-builder; + }; + direnv = callPackage ../tools/misc/direnv { }; discount = callPackage ../tools/text/discount { };