4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
45 lines
1.4 KiB
Nix
45 lines
1.4 KiB
Nix
{ lib, stdenv, fetchzip, ocaml, findlib, dune, cppo, easy-format, biniou }:
|
|
let
|
|
pname = "yojson";
|
|
param =
|
|
if stdenv.lib.versionAtLeast ocaml.version "4.02" then rec {
|
|
version = "1.7.0";
|
|
url = "https://github.com/ocaml-community/yojson/releases/download/${version}/yojson-${version}.tbz";
|
|
sha256 = "08llz96if8bcgnaishf18si76cv11zbkni0aldb54k3cn7ipiqvd";
|
|
nativeBuildInputs = [ dune ];
|
|
extra = { inherit (dune) installPhase; };
|
|
} else rec {
|
|
version = "1.2.3";
|
|
url = "https://github.com/ocaml-community/yojson/archive/v${version}.tar.gz";
|
|
sha256 = "10dvkndgwanvw4agbjln7kgb1n9s6lii7jw82kwxczl5rd1sgmvl";
|
|
extra = {
|
|
createFindlibDestdir = true;
|
|
|
|
makeFlags = [ "PREFIX=$(out)" ];
|
|
|
|
preBuild = "mkdir $out/bin";
|
|
};
|
|
};
|
|
in
|
|
stdenv.mkDerivation ({
|
|
|
|
name = "ocaml${ocaml.version}-${pname}-${param.version}";
|
|
|
|
src = fetchzip {
|
|
inherit (param) url sha256;
|
|
};
|
|
|
|
nativeBuildInputs = [ ocaml findlib ] ++ (param.nativeBuildInputs or []);
|
|
propagatedNativeBuildInputs = [ cppo ];
|
|
propagatedBuildInputs = [ easy-format biniou ];
|
|
configurePlatforms = [];
|
|
|
|
meta = with lib; {
|
|
description = "An optimized parsing and printing library for the JSON format";
|
|
homepage = "https://github.com/ocaml-community/${pname}";
|
|
license = licenses.bsd3;
|
|
maintainers = [ maintainers.vbgl ];
|
|
platforms = ocaml.meta.platforms or [];
|
|
};
|
|
} // param.extra)
|