anchor.diff:      tests = nixosTests.wireguard;
     };
   
  -  meta = {
  +  meta = with lib; {
       description = "Tools for the WireGuard secure network tunnel";
       downloadPage = "https://git.zx2c4.com/wireguard-tools/refs/";
       homepage = "https://www.wireguard.com/";
  
positive.code: { lib, stdenv
  , fetchzip
  , nixosTests
  , iptables ? null
  , iproute ? null
  , makeWrapper ? null
  , openresolv ? null
  , procps ? null
  , wireguard-go ? null
  }:
  
  with lib;
  
  stdenv.mkDerivation rec {
    pname = "wireguard-tools";
  
negative.code:   postFixup = ''
      substituteInPlace $out/lib/systemd/system/wg-quick@.service \
        --replace /usr/bin $out/bin
    '' + lib.optionalString stdenv.isLinux ''
      for f in $out/bin/*; do
        wrapProgram $f --prefix PATH : ${lib.makeBinPath [ procps iproute iptables openresolv ]}
      done
    '' + lib.optionalString stdenv.isDarwin ''
      for f in $out/bin/*; do
        wrapProgram $f --prefix PATH : ${wireguard-go}/bin
      done
  