nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 erlang,
6 icu,
7 openssl,
8 python3,
9 nixosTests,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "couchdb";
14 version = "3.5.0";
15
16 src = fetchurl {
17 url = "mirror://apache/couchdb/source/${version}/apache-${pname}-${version}.tar.gz";
18 hash = "sha256-api5CpqYC77yw1tJlqjnGi8a5SJ1RshfBMQ2EBvfeL8=";
19 };
20
21 postPatch = ''
22 patchShebangs bin/rebar
23 ''
24 + lib.optionalString stdenv.hostPlatform.isDarwin ''
25 # LTO with Clang produces LLVM bitcode, which causes linking to fail quietly.
26 # (There are warnings, but no hard errors, and it produces an empty dylib.)
27 substituteInPlace src/jiffy/rebar.config.script --replace '"-flto"' '""'
28 '';
29
30 nativeBuildInputs = [
31 erlang
32 ];
33
34 buildInputs = [
35 icu
36 openssl
37 (python3.withPackages (ps: with ps; [ requests ]))
38 ];
39
40 dontAddPrefix = "True";
41
42 configureFlags = [
43 "--js-engine=quickjs"
44 "--disable-spidermonkey"
45 ];
46
47 buildFlags = [
48 "release"
49 ];
50
51 installPhase = ''
52 runHook preInstall
53 mkdir -p $out
54 cp -r rel/couchdb/* $out
55 runHook postInstall
56 '';
57
58 passthru.tests = {
59 inherit (nixosTests) couchdb;
60 };
61
62 meta = {
63 description = "Database that uses JSON for documents, JavaScript for MapReduce queries, and regular HTTP for an API";
64 homepage = "https://couchdb.apache.org";
65 license = lib.licenses.asl20;
66 platforms = lib.platforms.all;
67 maintainers = [ ];
68 broken = stdenv.isDarwin && stdenv.isAarch64;
69 };
70}