8 , vendorHash ? "sha256-mp+0/DQTNsgAZTnLqcQq1HVLAfKr5vUGYSZlIvM7KpE="
12 attrsToPlugins = attrs:
13 builtins.map ({name, repo, version}: "${name}:${repo}") attrs;
14 attrsToSources = attrs:
15 builtins.map ({name, repo, version}: "${repo}@${version}") attrs;
16 in buildGoModule rec {
20 src = fetchFromGitHub {
24 sha256 = "sha256-8LZMS1rAqEZ8k1IWSRkQ2O650oqHLP0P31T8oUeE4fw=";
29 nativeBuildInputs = [ installShellFiles ];
31 outputs = [ "out" "man" ];
33 # Override the go-modules fetcher derivation to fetch plugins
35 for plugin in ${builtins.toString (attrsToPlugins externalPlugins)}; do echo $plugin >> plugin.cfg; done
36 for src in ${builtins.toString (attrsToSources externalPlugins)}; do go get $src; done
37 GOOS= GOARCH= go generate
42 mv -t vendor go.mod go.sum plugin.cfg
43 cp -r --reflink=auto vendor "$out"
48 mv -t . vendor/go.{mod,sum} vendor/plugin.cfg
50 GOOS= GOARCH= go generate
54 substituteInPlace test/file_cname_proxy_test.go \
55 --replace "TestZoneExternalCNAMELookupWithProxy" \
56 "SkipZoneExternalCNAMELookupWithProxy"
58 substituteInPlace test/readme_test.go \
59 --replace "TestReadme" "SkipReadme"
61 # this test fails if any external plugins were imported.
62 # it's a lint rather than a test of functionality, so it's safe to disable.
63 substituteInPlace test/presubmit_test.go \
64 --replace "TestImportOrdering" "SkipImportOrdering"
65 '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
66 # loopback interface is lo0 on macos
67 sed -E -i 's/\blo\b/lo0/' plugin/bind/setup_test.go
69 # test is apparently outdated but only exhibits this on darwin
70 substituteInPlace test/corefile_test.go \
71 --replace "TestCorefile1" "SkipCorefile1"
79 kubernetes-single-node = nixosTests.kubernetes.dns-single-node;
80 kubernetes-multi-node = nixosTests.kubernetes.dns-multi-node;
84 homepage = "https://coredns.io";
85 description = "DNS server that runs middleware";
86 mainProgram = "coredns";
87 license = licenses.asl20;
88 maintainers = with maintainers; [ rushmorem rtreffer deltaevo ];