nixpkgs/pkgs/development/ocaml-modules/curly/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

41 lines
1.2 KiB
Nix

{ stdenv, lib, buildDunePackage, fetchurl, ocaml
, result, alcotest, cohttp-lwt-unix, curl, cacert
}:
buildDunePackage rec {
pname = "curly";
version = "0.3.0";
minimalOCamlVersion = "4.03";
duneVersion = "3";
src = fetchurl {
url = "https://github.com/rgrinberg/curly/releases/download/${version}/curly-${version}.tbz";
hash = "sha256-Qn/PKBNOcMt3dk2f7uJD8x0yo4RHobXSjTQck7fcXTw=";
};
propagatedBuildInputs = [ result ];
nativeCheckInputs = [ cacert ];
checkInputs = [ alcotest cohttp-lwt-unix ];
# test dependencies are only available for >= 4.08
# https://github.com/mirage/ca-certs/issues/16
doCheck = lib.versionAtLeast ocaml.version "4.08"
# Some test fails in macOS sandbox
# > Fatal error: exception Unix.Unix_error(Unix.EPERM, "bind", "")
&& !stdenv.hostPlatform.isDarwin;
postPatch = ''
substituteInPlace src/curly.ml \
--replace "exe=\"curl\"" "exe=\"${curl}/bin/curl\""
'';
meta = with lib; {
description = "Curly is a brain dead wrapper around the curl command line utility";
homepage = "https://github.com/rgrinberg/curly";
license = licenses.isc;
maintainers = [ maintainers.sternenseemann ];
};
}