From a02643d6a595f3aea405a942f904d32b788eab6c Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Thu, 21 Apr 2022 13:12:16 +0100 Subject: [PATCH 1/2] lshw: B.02.18 -> B.02.19 - Bump version - Switch to `fetchFromGitHub` to get updates from @r-ryantm bot - Remove patches (they're merged upstream) - Update dependencies - Fix version workaround (not necessary anymore) - Add myself as maintainer --- pkgs/tools/system/lshw/default.nix | 49 +++++++++++++----------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/pkgs/tools/system/lshw/default.nix b/pkgs/tools/system/lshw/default.nix index 25bf79cadddf..6cdbecfb1ba0 100644 --- a/pkgs/tools/system/lshw/default.nix +++ b/pkgs/tools/system/lshw/default.nix @@ -1,40 +1,33 @@ -{ stdenv, lib, fetchurl, fetchpatch -, withGUI ? false, gtk2, pkg-config, sqlite # compile GUI +{ stdenv +, lib +, fetchFromGitHub +, hwdata +, gtk2 +, pkg-config +, sqlite # compile GUI +, withGUI ? false }: stdenv.mkDerivation rec { pname = "lshw"; - version = "B.02.18"; + version = "B.02.19"; - src = fetchurl { - url = "https://ezix.org/software/files/lshw-${version}.tar.gz"; - sha256 = "0brwra4jld0d53d7jsgca415ljglmmx1l2iazpj4ndilr48yy8mf"; + src = fetchFromGitHub { + owner = "lyonel"; + repo = pname; + rev = version; + sha256 = "sha256-PzbNGc1pPiPLWWgTeWoNfAo+SsXgi1HcjnXfYXA9S0I="; }; - patches = [ - (fetchpatch { - # fix crash in scan_dmi_sysfs() when run as non-root - url = "https://github.com/lyonel/lshw/commit/fbdc6ab15f7eea0ddcd63da355356ef156dd0d96.patch"; - sha256 = "147wyr5m185f8swsmb4q1ahs9r1rycapbpa2548aqbv298bbish3"; - }) - (fetchpatch { - # support cross-compilation - url = "https://github.com/lyonel/lshw/commit/8486d25cea9b68794504fbd9e5c6e294bac6cb07.patch"; - sha256 = "08f0wnxsq0agvsc66bhc7lxvk564ir0pp8pg3cym6a621prb9lm0"; - }) - ]; - nativeBuildInputs = [ pkg-config ]; - buildInputs = lib.optionals withGUI [ gtk2 sqlite ]; + buildInputs = [ hwdata ] + ++ lib.optionals withGUI [ gtk2 sqlite ]; - # Fix version info. - preConfigure = '' - sed -e "s/return \"unknown\"/return \"${version}\"/" \ - -i src/core/version.cc - ''; - - makeFlags = [ "PREFIX=$(out)" ]; + makeFlags = [ + "PREFIX=$(out)" + "VERSION=${version}" + ]; buildFlags = [ "all" ] ++ lib.optional withGUI "gui"; @@ -46,7 +39,7 @@ stdenv.mkDerivation rec { homepage = "https://ezix.org/project/wiki/HardwareLiSter"; description = "Provide detailed information on the hardware configuration of the machine"; license = licenses.gpl2; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ thiagokokada ]; platforms = platforms.linux; }; } From 5b17034ddcc2a4942f2c806b2541313f52f8cfc7 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Thu, 21 Apr 2022 13:34:34 +0100 Subject: [PATCH 2/2] 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 8d0267dc8f02e010785d6f90573ea1135b7957e7, 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`. --- pkgs/tools/system/lshw/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/system/lshw/default.nix b/pkgs/tools/system/lshw/default.nix index 6cdbecfb1ba0..76897823029a 100644 --- a/pkgs/tools/system/lshw/default.nix +++ b/pkgs/tools/system/lshw/default.nix @@ -10,12 +10,15 @@ stdenv.mkDerivation rec { pname = "lshw"; - version = "B.02.19"; + # 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 = version; + rev = "B.${version}"; sha256 = "sha256-PzbNGc1pPiPLWWgTeWoNfAo+SsXgi1HcjnXfYXA9S0I="; }; @@ -26,7 +29,7 @@ stdenv.mkDerivation rec { makeFlags = [ "PREFIX=$(out)" - "VERSION=${version}" + "VERSION=${src.rev}" ]; buildFlags = [ "all" ] ++ lib.optional withGUI "gui";