diff --git a/pkgs/by-name/i8/i810switch/package.nix b/pkgs/by-name/i8/i810switch/package.nix index 0291c249274b..f08a9dc97d95 100644 --- a/pkgs/by-name/i8/i810switch/package.nix +++ b/pkgs/by-name/i8/i810switch/package.nix @@ -2,30 +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="; }; - meta = with lib; { + 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 = { 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"; }; -} +})