Files
nixpkgs/pkgs/tools/graphics/diagrams-builder/default.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

64 lines
1.3 KiB
Nix
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
If a user needs access to more haskell packages for building their
diagrams, they simply have to pass these packages through the
extraPackages function, as follows:
~~~
diagrams-builder.override {
extraPackages = self: [ self.myHaskellPackage ];
}
­~~~
*/
{
lib,
stdenv,
ghcWithPackages,
makeWrapper,
diagrams-builder,
extraPackages ? (self: [ ]),
}:
let
# Used same technique as for the yiCustom package.
wrappedGhc = ghcWithPackages (self: [ diagrams-builder ] ++ extraPackages self);
ghc = lib.getExe' wrappedGhc "ghc";
exeWrapper =
backend:
let
exe = "${diagrams-builder}/bin/diagrams-builder-${backend}";
in
''
test ! -x "${exe}" || \
makeWrapper "${exe}" \
"$out/bin/diagrams-builder-${backend}" \
--set NIX_GHC ${ghc} \
--set NIX_GHC_LIBDIR "$(${ghc} --print-libdir)"
'';
# Needs to match executable, suffix, not flag name
allBackends = [
"svg"
"ps"
"cairo"
"rasterific"
"pgf"
];
in
stdenv.mkDerivation {
pname = "diagrams-builder";
inherit (diagrams-builder) version;
nativeBuildInputs = [ makeWrapper ];
buildCommand = lib.concatStringsSep "\n" (map exeWrapper allBackends);
# Will be faster to build the wrapper locally then to fetch it from a binary cache.
preferLocalBuild = true;
meta = diagrams-builder.meta;
}