summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2021-05-31 08:32:21 +0200
committerRobert Hensing <robert@roberthensing.nl>2021-06-02 10:20:11 +0200
commit03e08759f7bb0dc34e2df35a2bb952f20b780fb5 (patch)
treec536ad73054fc74599f77dadca930dac9925a8a3
parentpodman: Add iproute2, fixing docker network rm (diff)
downloadnixpkgs-03e08759f7bb0dc34e2df35a2bb952f20b780fb5.tar.gz
dnsname-cni: Use wrapper instead of patch for dnsmasq
The patch proved to be an incomplete solution while developing nixosTests.podman-dnsname (cherry picked from commit 651777934941480a36f7df9c434e6044957d045d)
-rw-r--r--pkgs/applications/networking/cluster/dnsname-cni/default.nix16
-rw-r--r--pkgs/applications/networking/cluster/dnsname-cni/hardcode-dnsmasq-path.patch19
2 files changed, 11 insertions, 24 deletions
diff --git a/pkgs/applications/networking/cluster/dnsname-cni/default.nix b/pkgs/applications/networking/cluster/dnsname-cni/default.nix
index 91ef8b68fb63..2770617db7e5 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 = "090kpq2ppan9ayajdk5vwbvww30nphylgajn2p3441d4jg2nvsm3";
};
- 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;
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 24ef5eb85d13..000000000000
--- 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,