summary refs log tree commit diff
path: root/pkgs/applications/networking
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/networking')
-rw-r--r--pkgs/applications/networking/cluster/dnsname-cni/default.nix20
-rw-r--r--pkgs/applications/networking/cluster/dnsname-cni/hardcode-dnsmasq-path.patch19
2 files changed, 15 insertions, 24 deletions
diff --git a/pkgs/applications/networking/cluster/dnsname-cni/default.nix b/pkgs/applications/networking/cluster/dnsname-cni/default.nix
index 8f5e2889521..c14033382b5 100644
--- a/pkgs/applications/networking/cluster/dnsname-cni/default.nix
+++ b/pkgs/applications/networking/cluster/dnsname-cni/default.nix
@@ -1,4 +1,11 @@
-{ buildGoModule, fetchFromGitHub, lib, dnsmasq }:
+{
+  buildGoModule,
+  dnsmasq,
+  fetchFromGitHub,
+  lib,
+  nixosTests,
+  makeWrapper,
+}:
 
 buildGoModule rec {
   pname = "cni-plugin-dnsname";
@@ -11,10 +18,9 @@ buildGoModule rec {
     sha256 = "sha256-hHkQOHDso92gXFCz40iQ7j2cHTEAMsaeW8MCJV2Otqo=";
   };
 
-  patches = [ ./hardcode-dnsmasq-path.patch ];
-
-  postPatch = ''
-    substituteInPlace plugins/meta/dnsname/service.go --replace '@DNSMASQ@' '${dnsmasq}/bin/dnsmasq'
+  nativeBuildInputs = [ makeWrapper ];
+  postInstall = ''
+    wrapProgram $out/bin/dnsname --prefix PATH : ${lib.makeBinPath [ dnsmasq ]}
   '';
 
   vendorSha256 = null;
@@ -22,6 +28,10 @@ buildGoModule rec {
 
   doCheck = false; # NOTE: requires root privileges
 
+  passthru.tests = {
+    inherit (nixosTests) podman-dnsname;
+  };
+
   meta = with lib; {
     description = "DNS name resolution for containers";
     homepage = "https://github.com/containers/dnsname";
diff --git a/pkgs/applications/networking/cluster/dnsname-cni/hardcode-dnsmasq-path.patch b/pkgs/applications/networking/cluster/dnsname-cni/hardcode-dnsmasq-path.patch
deleted file mode 100644
index 24ef5eb85d1..00000000000
--- a/pkgs/applications/networking/cluster/dnsname-cni/hardcode-dnsmasq-path.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff --git a/plugins/meta/dnsname/service.go b/plugins/meta/dnsname/service.go
-index fc05f75..f6b4caf 100644
---- a/plugins/meta/dnsname/service.go
-+++ b/plugins/meta/dnsname/service.go
-@@ -16,10 +16,14 @@ import (
- 
- // newDNSMasqFile creates a new instance of a dnsNameFile
- func newDNSMasqFile(domainName, networkInterface, networkName string) (dnsNameFile, error) {
-+	/*
- 	dnsMasqBinary, err := exec.LookPath("dnsmasq")
- 	if err != nil {
- 		return dnsNameFile{}, errors.Errorf("the dnsmasq cni plugin requires the dnsmasq binary be in PATH")
- 	}
-+	*/
-+	_ = errors.Errorf // XXX(mikroskeem): reduce diff
-+	dnsMasqBinary := "@DNSMASQ@"
- 	masqConf := dnsNameFile{
- 		ConfigFile:       makePath(networkName, confFileName),
- 		Domain:           domainName,