mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
Simplify standalone diagrams-builder
expression.
This commit is contained in:
parent
76a8089d96
commit
6119355c9c
1 changed files with 18 additions and 17 deletions
|
@ -11,32 +11,33 @@
|
|||
*/
|
||||
|
||||
{ stdenv, ghcWithPackages, makeWrapper, diagrams-builder, extraPackages ? (self: []) }:
|
||||
|
||||
let
|
||||
|
||||
# Used same technique as for the yiCustom package.
|
||||
w = ghcWithPackages
|
||||
wrappedGhc = ghcWithPackages
|
||||
(self: [ diagrams-builder ] ++ extraPackages self);
|
||||
wrappedGhc = w.override { ignoreCollisions = true; };
|
||||
ghcVersion = w.version;
|
||||
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}
|
||||
'';
|
||||
|
||||
backends = ["svg" "cairo" "ps"];
|
||||
|
||||
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}
|
||||
buildCommand = with stdenv.lib;
|
||||
concatStrings (intersperse "\n" (map exeWrapper backends));
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue