Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amneziawg-tools: init at 1.0.20240213 #331582

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
]
Comment on lines +55 to +58
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When starting the systemd unit, awg-quick complained about readlink missing. I added coreutils here to resolve it.

Copy link
Contributor Author

@averyanalex averyanalex Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked awg-quick@name service, it doen't work, like the wg-quick@name. In wg-quick module some tools, like config.networking.firewall.package are added to service path. I think the best solution is to update wireguard modules and add something like type = wireguard | amneziawg option.

} \
--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";
};
})