2021-10-28 06:52:43 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, libmnl
|
|
|
|
, pkg-config
|
2022-04-27 09:35:20 +00:00
|
|
|
, writeScript
|
2021-10-28 06:52:43 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ethtool";
|
2022-07-14 12:49:19 +00:00
|
|
|
version = "5.18";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://kernel/software/network/${pname}/${pname}-${version}.tar.xz";
|
2022-07-14 12:49:19 +00:00
|
|
|
sha256 = "sha256-lXey/7znELZZ+yOVmOySvO0cpADKDxKGdiv6ROR4QnA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libmnl
|
|
|
|
];
|
2021-08-22 07:53:02 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = writeScript "update-ethtool" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl pcre common-updater-scripts
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
# Expect the text in format of '<a href="ethtool-VER.tar.xz">...</a>'
|
|
|
|
# The page always lists versions newest to oldest. Pick the first one.
|
|
|
|
new_version="$(curl -s https://mirrors.edge.kernel.org/pub/software/network/ethtool/ |
|
|
|
|
pcregrep -o1 '<a href="ethtool-([0-9.]+)[.]tar[.]xz">' |
|
|
|
|
head -n1)"
|
|
|
|
update-source-version ${pname} "$new_version"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Utility for controlling network drivers and hardware";
|
|
|
|
homepage = "https://www.kernel.org/pub/software/network/ethtool/";
|
2021-10-28 06:52:43 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
2021-10-28 06:52:43 +00:00
|
|
|
maintainers = with maintainers; [ bjornfor ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|