7 , vendorHash ? "sha256-tp22jj6DNnYFQhtAFW2uLo10ty//dyNqIDH2egDgbOw="
11 attrsToPlugins = attrs:
12 builtins.map ({name, repo, version}: "${name}:${repo}") attrs;
13 attrsToSources = attrs:
14 builtins.map ({name, repo, version}: "${repo}@${version}") attrs;
15 in buildGoModule rec {
19 src = fetchFromGitHub {
23 sha256 = "sha256-XZoRN907PXNKV2iMn51H/lt8yPxhPupNfJ49Pymdm9Y=";
28 nativeBuildInputs = [ installShellFiles ];
30 outputs = [ "out" "man" ];
32 # Override the go-modules fetcher derivation to fetch plugins
34 for plugin in ${builtins.toString (attrsToPlugins externalPlugins)}; do echo $plugin >> plugin.cfg; done
35 for src in ${builtins.toString (attrsToSources externalPlugins)}; do go get $src; done
36 GOOS= GOARCH= go generate
41 mv -t vendor go.mod go.sum plugin.cfg
42 cp -r --reflink=auto vendor "$out"
47 mv -t . vendor/go.{mod,sum} vendor/plugin.cfg
49 GOOS= GOARCH= go generate
53 substituteInPlace test/file_cname_proxy_test.go \
54 --replace "TestZoneExternalCNAMELookupWithProxy" \
55 "SkipZoneExternalCNAMELookupWithProxy"
57 substituteInPlace test/readme_test.go \
58 --replace "TestReadme" "SkipReadme"
60 # this test fails if any external plugins were imported.
61 # it's a lint rather than a test of functionality, so it's safe to disable.
62 substituteInPlace test/presubmit_test.go \
63 --replace "TestImportOrdering" "SkipImportOrdering"
64 '' + lib.optionalString stdenv.isDarwin ''
65 # loopback interface is lo0 on macos
66 sed -E -i 's/\blo\b/lo0/' plugin/bind/setup_test.go
74 homepage = "https://coredns.io";
75 description = "A DNS server that runs middleware";
76 mainProgram = "coredns";
77 license = licenses.asl20;
78 maintainers = with maintainers; [ rushmorem rtreffer deltaevo ];