From c0072d342d6110cc1e08f7b888bb4e505528c5e0 Mon Sep 17 00:00:00 2001 From: AveryanAlex Date: Thu, 1 Aug 2024 21:51:34 +0300 Subject: [PATCH] amneziawg-tools: init at 1.0.20241018 --- pkgs/by-name/am/amneziawg-tools/package.nix | 88 +++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 pkgs/by-name/am/amneziawg-tools/package.nix diff --git a/pkgs/by-name/am/amneziawg-tools/package.nix b/pkgs/by-name/am/amneziawg-tools/package.nix new file mode 100644 index 000000000000..a21bb621b123 --- /dev/null +++ b/pkgs/by-name/am/amneziawg-tools/package.nix @@ -0,0 +1,88 @@ +{ + lib, + stdenv, + fetchFromGitHub, + makeWrapper, + bash, + procps, + iproute2, + iptables, + openresolv, + amneziawg-go, + nix-update-script, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "amneziawg-tools"; + version = "1.0.20241018"; + + src = fetchFromGitHub { + owner = "amnezia-vpn"; + repo = "amneziawg-tools"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-y6xkOLT9KVD6ACCH60Myk2iA1S8/+tGXEQbOYnu+dPI="; + }; + + sourceRoot = "${finalAttrs.src.name}/src"; + + outputs = [ + "out" + "man" + ]; + + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ bash ]; + + makeFlags = [ + "DESTDIR=${placeholder "out"}" + "PREFIX=/" + "WITH_BASHCOMPLETION=yes" + "WITH_SYSTEMDUNITS=yes" + "WITH_WGQUICK=yes" + ]; + + postFixup = + '' + substituteInPlace $out/lib/systemd/system/awg-quick@.service \ + --replace-fail /usr/bin $out/bin + '' + + lib.optionalString stdenv.isLinux '' + for f in $out/bin/*; do + # Which firewall and resolvconf implementations to use should be determined by the + # environment, we provide the "default" ones as fallback. + wrapProgram $f \ + --prefix PATH : ${ + lib.makeBinPath [ + procps + iproute2 + ] + } \ + --suffix PATH : ${ + lib.makeBinPath [ + iptables + openresolv + ] + } + done + '' + + lib.optionalString stdenv.isDarwin '' + for f in $out/bin/*; do + wrapProgram $f \ + --prefix PATH : ${lib.makeBinPath [ amneziawg-go ]} + done + ''; + + strictDeps = true; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Tools for configuring AmneziaWG"; + homepage = "https://amnezia.org"; + changelog = "https://github.com/amnezia-vpn/amneziawg-tools/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.gpl2Only; + maintainers = with lib.maintainers; [ averyanalex ]; + platforms = lib.platforms.unix; + mainProgram = "awg"; + }; +})