nixpkgs/pkgs/tools/networking/djbdns/default.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

51 lines
1.5 KiB
Nix

{ lib, stdenv, fetchurl, glibc, dns-root-data } :
let
version = "1.05";
manSrc = fetchurl {
url = "http://smarden.org/pape/djb/manpages/djbdns-${version}-man-20031023.tar.gz";
sha256 = "0sg51gjy6j1hnrra406q1qhf5kvk1m00y8qqhs6r0a699gqmh75s";
};
in
stdenv.mkDerivation {
pname = "djbdns";
inherit version;
src = fetchurl {
url = "https://cr.yp.to/djbdns/djbdns-${version}.tar.gz";
sha256 = "0j3baf92vkczr5fxww7rp1b7gmczxmmgrqc8w2dy7kgk09m85k9w";
};
patches = [ ./hier.patch ./fix-nix-usernamespace-build.patch ];
postPatch = ''
echo gcc -O2 -include ${glibc.dev}/include/errno.h > conf-cc
echo $out > conf-home
# djbdns ships with an outdated list of root servers
awk '/^.?.ROOT-SERVERS.NET/ { print $4 }' ${dns-root-data}/root.hints > dnsroots.global
sed -i "s|/etc/dnsroots.global|$out/etc/dnsroots.global|" dnscache-conf.c
'';
installPhase = ''
mkdir -pv $out/etc;
make setup
cd $out;
tar xzvf ${manSrc};
for n in 1 5 8; do
mkdir -p man/man$n;
mv -iv djbdns-man/*.$n man/man$n;
done;
rm -rv djbdns-man;
'';
meta = with lib; {
description = "A collection of Domain Name System tools";
longDescription = "Includes software for all the fundamental DNS operations: DNS cache: finding addresses of Internet hosts; DNS server: publishing addresses of Internet hosts; and DNS client: talking to a DNS cache.";
homepage = "https://cr.yp.to/djbdns.html";
license = licenses.publicDomain;
maintainers = with maintainers; [ jerith666 ];
};
}