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

amazon-ec2-net-utils: init at 2.5.2 #355111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
115 changes: 115 additions & 0 deletions pkgs/by-name/am/amazon-ec2-net-utils/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
lib,
bash,
coreutils,
curl,
fetchFromGitHub,
gnugrep,
gnused,
installShellFiles,
iproute2,
makeWrapper,
nix-update-script,
stdenv,
systemd,
}:

stdenv.mkDerivation rec {
pname = "amazon-ec2-net-utils";
version = "2.5.2";

src = fetchFromGitHub {
owner = "amazonlinux";
repo = "amazon-ec2-net-utils";
tag = "v${version}";
hash = "sha256-fTWTHHsjkT8TV++lhQuQ7vAstfpSH52Oa0LGjDnIu0k=";
};

strictDeps = true;

nativeBuildInputs = [
installShellFiles
makeWrapper
];

buildInputs = [
bash
];

# See https://github.com/amazonlinux/amazon-ec2-net-utils/blob/v2.5.2/GNUmakefile#L26-L37.
installPhase = ''
mkdir $out

for file in bin/*.sh; do
install -D -m 755 "$file" $out/bin/$(basename --suffix ".sh" "$file")
substituteInPlace $out/bin/$(basename --suffix ".sh" "$file") \
--replace-fail AMAZON_EC2_NET_UTILS_LIBDIR $out/share/amazon-ec2-net-utils
done

substituteInPlace $out/bin/setup-policy-routes \
--replace-fail /lib/systemd ${systemd}/lib/systemd

wrapProgram $out/bin/setup-policy-routes \
--prefix PATH : ${
lib.makeBinPath [
coreutils
# bin/setup-policy-roots.sh sources lib/lib.sh which needs these.
#
# lib/lib.sh isn't executable so we can't use it with wrapProgram.
curl
gnugrep
gnused
iproute2
systemd
]
}

for file in lib/*.sh; do
install -D -m 644 -t $out/share/amazon-ec2-net-utils "$file"
done

substituteInPlace $out/share/amazon-ec2-net-utils/lib.sh \
--replace-fail /usr/lib/systemd $out/lib/systemd

for file in udev/*.rules; do
install -D -m 644 -t $out/lib/udev/rules.d "$file"
done

substituteInPlace $out/lib/udev/rules.d/99-vpc-policy-routes.rules \
--replace-fail /usr/bin/systemctl ${systemd}/bin/systemctl

for file in systemd/network/*.network; do
install -D -m 644 -t $out/lib/systemd/network "$file"
done

for file in systemd/system/*.{service,timer}; do
install -D -m 644 -t $out/lib/systemd/system "$file"
done

substituteInPlace $out/lib/systemd/system/[email protected] \
--replace-fail /usr/bin/setup-policy-routes $out/bin/setup-policy-routes

substituteInPlace $out/lib/systemd/system/[email protected] \
--replace-fail /usr/bin/setup-policy-routes $out/bin/setup-policy-routes

installManPage doc/*.8
'';

outputs = [
"out"
"man"
];

passthru = {
updateScript = nix-update-script { };
};

meta = {
description = "Contains a set of utilities for managing elastic network interfaces on Amazon EC2";
homepage = "https://github.com/amazonlinux/amazon-ec2-net-utils";
license = lib.licenses.asl20;
platforms = lib.platforms.linux;
# TODO: Find maintainer(s).
maintainers = with lib.maintainers; [ ];
Comment on lines +112 to +113
Copy link
Member

Choose a reason for hiding this comment

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

New packages must have a maintainer.

Copy link
Contributor Author

@commiterate commiterate Jan 4, 2025

Choose a reason for hiding this comment

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

@sielicki Do the EFA and ENA kernel modules need the networkd rules for full performance on networkd systems? If so, it probably would make more sense to have you and @arianvp maintain this since you two also maintain those kernel module packages.

};
}