nixpkgs/pkgs/servers/http/couchdb/2.0.0.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
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
2021-01-11 10:38:22 +01:00

58 lines
1.6 KiB
Nix

{ lib, stdenv, fetchurl, erlang, icu, openssl, spidermonkey_1_8_5
, coreutils, bash, makeWrapper, python3 }:
stdenv.mkDerivation rec {
pname = "couchdb";
version = "2.3.1";
# when updating this, please consider bumping the OTP version
# in all-packages.nix
src = fetchurl {
url = "mirror://apache/couchdb/source/${version}/apache-${pname}-${version}.tar.gz";
sha256 = "0z926hjqyhxhyr65kqxwpmp80nyfqbig6d9dy8dqflpb87n8rss3";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ erlang icu openssl spidermonkey_1_8_5 (python3.withPackages(ps: with ps; [ requests ]))];
patches = [ ./jsapi.patch ];
postPatch = ''
substituteInPlace src/couch/rebar.config.script --replace '-DHAVE_CURL -I/usr/local/include' "-DHAVE_CURL -I/usr/local/include $NIX_CFLAGS_COMPILE"
patch bin/rebar <<EOF
1c1
< #!/usr/bin/env escript
---
> #!${coreutils}/bin/env escript
EOF
'';
# Configure a username. The build system would use "couchdb" as
# default if none is provided. Note that it is unclear where this
# username is actually used in the build, as any choice seems to be
# working.
configurePhase = ''
./configure -u nobody
'';
buildPhase = ''
make release
'';
installPhase = ''
mkdir -p $out
cp -r rel/couchdb/* $out
wrapProgram $out/bin/couchdb --suffix PATH : ${bash}/bin
'';
meta = with lib; {
description = "A database that uses JSON for documents, JavaScript for MapReduce queries, and regular HTTP for an API";
homepage = "http://couchdb.apache.org";
license = licenses.asl20;
platforms = platforms.all;
maintainers = with maintainers; [ ];
};
}