nixpkgs/pkgs/tools/system/lshw/default.nix
Thiago Kenji Okada 5b17034ddc lshw: rename version to fix repology listing
`lshw` is not showing in the nixpkgs-unstable listings in repology, but
it is showing in the previous stable release (release-21.11). The reason
for this was a change in 8d0267dc8f, that
fixed the `lshw` version to include its letter prefix.

However, the way the version is computed for repology is to parse the
`name` attr instead, separating it in `pname` and `version`. The
function that does this (`builtins.parseDrvName`) considers anything
that is a `name` everything up to the first dash followed by a digit.
Because the `version` includes the letter `B` as prefix, it them ends up
splitting it wrong.

See https://github.com/NixOS/nix/pull/4463 for a proper fix, but for now
let's just "fix" this by not including the prefix in the `version`.
2022-04-21 14:30:34 +01:00

49 lines
1.2 KiB
Nix

{ stdenv
, lib
, fetchFromGitHub
, hwdata
, gtk2
, pkg-config
, sqlite # compile GUI
, withGUI ? false
}:
stdenv.mkDerivation rec {
pname = "lshw";
# Fix repology.org by not including the prefixed B, otherwise the `pname` attr
# gets filled as `lshw-B.XX.XX` in `nix-env --query --available --attr nixpkgs.lshw --meta`
# See https://github.com/NixOS/nix/pull/4463 for a definitive fix
version = "02.19";
src = fetchFromGitHub {
owner = "lyonel";
repo = pname;
rev = "B.${version}";
sha256 = "sha256-PzbNGc1pPiPLWWgTeWoNfAo+SsXgi1HcjnXfYXA9S0I=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ hwdata ]
++ lib.optionals withGUI [ gtk2 sqlite ];
makeFlags = [
"PREFIX=$(out)"
"VERSION=${src.rev}"
];
buildFlags = [ "all" ] ++ lib.optional withGUI "gui";
installTargets = [ "install" ] ++ lib.optional withGUI "install-gui";
enableParallelBuilding = true;
meta = with lib; {
homepage = "https://ezix.org/project/wiki/HardwareLiSter";
description = "Provide detailed information on the hardware configuration of the machine";
license = licenses.gpl2;
maintainers = with maintainers; [ thiagokokada ];
platforms = platforms.linux;
};
}