1 { stdenv, lib, fetchurl, fetchFromGitHub }:
5 sha256 = "1iajg55n47hqxcpdzmyq4g4aprx7bzxcp885i850h355k5vmf68r";
6 # Please don’t forget to update the docs:
7 # clone https://github.com/Profpatsch/cdb-docs
8 # and create a pull request with the result of running
10 # from the repository’s root folder.
11 docRepo = fetchFromGitHub {
14 rev = "359b6c55c9e170ebfc88f3f38face8ae2315eacb";
15 sha256 = "1y0ivviy58i0pmavhvrpznc4yjigjknff298gnw9rkg5wxm0gbbq";
18 in stdenv.mkDerivation {
23 url = "https://cr.yp.to/cdb/cdb-${version}.tar.gz";
27 outputs = [ "bin" "doc" "out" ];
30 # A little patch, borrowed from Archlinux AUR, borrowed from Gentoo Portage
31 sed -e 's/^extern int errno;$/#include <errno.h>/' -i error.h
35 # don't use make setup, but move the binaries ourselves
37 install -m 755 -t $bin/bin/ cdbdump cdbget cdbmake cdbmake-12 cdbmake-sv cdbstats cdbtest
39 # patch paths in scripts
40 function cdbmake-subst {
41 substituteInPlace $bin/bin/$1 \
42 --replace /usr/local/bin/cdbmake $bin/bin/cdbmake
44 cdbmake-subst cdbmake-12
45 cdbmake-subst cdbmake-sv
48 mkdir -p $doc/share/cdb
49 cp -r "${docRepo}/docs" $doc/share/cdb/html
53 homepage = "https://cr.yp.to/cdb.html";
54 license = lib.licenses.publicDomain;
55 maintainers = [ lib.maintainers.Profpatsch ];
56 platforms = lib.platforms.unix;