Skip to content

Commit

Permalink
amneziawg-tools: init at 1.0.20241018
Browse files Browse the repository at this point in the history
  • Loading branch information
averyanalex authored and cab404 committed Nov 17, 2024
1 parent 1b6fe61 commit c0072d3
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions pkgs/by-name/am/amneziawg-tools/package.nix
Original file line number Diff line number Diff line change
@@ -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/[email protected] \
--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";
};
})

0 comments on commit c0072d3

Please sign in to comment.