mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-26 15:44:20 +00:00
ca20a96b5f
Update all usage of lib.concatStrings (lib.intersperse ...) to lib.concatStringsSep. This produces the same result as per https://github.com/NixOS/nixpkgs/pull/135843, however it yields a performance benefit on Nix versions that support the builtins.concatStringsSep primop.
45 lines
1.1 KiB
Nix
45 lines
1.1 KiB
Nix
/*
|
||
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];
|
||
}
|
||
~~~
|
||
*/
|
||
|
||
{ lib, stdenv, ghcWithPackages, makeWrapper, diagrams-builder, extraPackages ? (self: []) }:
|
||
|
||
let
|
||
|
||
# Used same technique as for the yiCustom package.
|
||
wrappedGhc = ghcWithPackages
|
||
(self: [ diagrams-builder ] ++ extraPackages self);
|
||
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";
|
||
|
||
nativeBuildInputs = [ makeWrapper ];
|
||
|
||
buildCommand = with lib;
|
||
concatStringsSep "\n" (map exeWrapper backends);
|
||
|
||
# Will be faster to build the wrapper locally then to fetch it from a binary cache.
|
||
preferLocalBuild = true;
|
||
meta = diagrams-builder.meta;
|
||
}
|