From 9469c20cb8246fb8c83221e8035c98842a766af1 Mon Sep 17 00:00:00 2001 From: Moraxyc Date: Sat, 22 Feb 2025 21:04:50 +0800 Subject: [PATCH 1/2] i810switch: fix build on gcc-14 --- pkgs/by-name/i8/i810switch/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/i8/i810switch/package.nix b/pkgs/by-name/i8/i810switch/package.nix index 0291c249274b..250465601c35 100644 --- a/pkgs/by-name/i8/i810switch/package.nix +++ b/pkgs/by-name/i8/i810switch/package.nix @@ -21,6 +21,11 @@ stdenv.mkDerivation { sha256 = "d714840e3b14e1fa9c432c4be0044b7c008d904dece0d611554655b979cad4c3"; }; + # Ignore errors since gcc-14. + # i810switch.c:251:34: error: passing argument 2 of 'getline' from incompatible pointer type [-Wincompatible-pointer-types] + # i810switch.c:296:34: error: passing argument 2 of 'getline' from incompatible pointer type [-Wincompatible-pointer-types] + env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; + meta = with lib; { description = "Utility for switching between the LCD and external VGA display on Intel graphics cards"; homepage = "http://www16.plala.or.jp/mano-a-mano/i810switch.html"; From 39a2802a51125b48b071b2d186e7f22855f12cd7 Mon Sep 17 00:00:00 2001 From: Moraxyc Date: Sat, 22 Feb 2025 21:28:42 +0800 Subject: [PATCH 2/2] i810switch: modernize --- pkgs/by-name/i8/i810switch/package.nix | 42 +++++++++++++++++--------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/i8/i810switch/package.nix b/pkgs/by-name/i8/i810switch/package.nix index 250465601c35..f08a9dc97d95 100644 --- a/pkgs/by-name/i8/i810switch/package.nix +++ b/pkgs/by-name/i8/i810switch/package.nix @@ -2,35 +2,49 @@ lib, stdenv, fetchurl, + installShellFiles, pciutils, }: -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "i810switch"; version = "0.6.5"; - installPhase = " - sed -i -e 's+/usr++' Makefile - sed -i -e 's+^\\(.*putenv(\"PATH=\\).*$+\\1${pciutils}/sbin\");+' i810switch.c - make clean - make install DESTDIR=\${out} - "; - src = fetchurl { - url = "http://www16.plala.or.jp/mano-a-mano/i810switch/i810switch-0.6.5.tar.gz"; - sha256 = "d714840e3b14e1fa9c432c4be0044b7c008d904dece0d611554655b979cad4c3"; + url = "http://www16.plala.or.jp/mano-a-mano/i810switch/i810switch-${finalAttrs.version}.tar.gz"; + hash = "sha256-1xSEDjsU4fqcQyxL4ARLfACNkE3s4NYRVUZVuXnK1MM="; }; + nativeBuildInputs = [ installShellFiles ]; + + preBuild = '' + make clean + + substituteInPlace i810switch.c \ + --replace-fail 'define CMD_LSPCI "lspci"' 'define CMD_LSPCI "${lib.getExe' pciutils "lspci"}"' + ''; + + installPhase = " + runHook preInstall + + install -Dm755 -t $out/bin i810switch i810rotate + + installManPage i810switch.1.gz i810rotate.1.gz + + runHook postInstall + "; + # Ignore errors since gcc-14. # i810switch.c:251:34: error: passing argument 2 of 'getline' from incompatible pointer type [-Wincompatible-pointer-types] # i810switch.c:296:34: error: passing argument 2 of 'getline' from incompatible pointer type [-Wincompatible-pointer-types] env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; - meta = with lib; { + meta = { description = "Utility for switching between the LCD and external VGA display on Intel graphics cards"; homepage = "http://www16.plala.or.jp/mano-a-mano/i810switch.html"; maintainers = [ ]; - license = licenses.gpl2Only; - platforms = platforms.linux; + license = lib.licenses.gpl2Only; + platforms = lib.platforms.linux; + mainProgram = "i810switch"; }; -} +})