nixpkgs/pkgs/by-name/et/ethtool/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

51 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchurl
, libmnl
, pkg-config
, writeScript
}:
stdenv.mkDerivation rec {
pname = "ethtool";
version = "6.9";
src = fetchurl {
url = "mirror://kernel/software/network/ethtool/ethtool-${version}.tar.xz";
sha256 = "sha256-pxsDVAEGYcXPF4vGBu1Q/LkYBc8Yl60OsoGDh6X9DNk=";
};
nativeBuildInputs = [
pkg-config
];
buildInputs = [
libmnl
];
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 ethtool "$new_version"
'';
};
meta = with lib; {
description = "Utility for controlling network drivers and hardware";
homepage = "https://www.kernel.org/pub/software/network/ethtool/";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ bjornfor ];
mainProgram = "ethtool";
};
}