i810switch: modernize

+28 -14
+28 -14
pkgs/by-name/i8/i810switch/package.nix
··· 2 2 lib, 3 3 stdenv, 4 4 fetchurl, 5 + installShellFiles, 5 6 pciutils, 6 7 }: 7 8 8 - stdenv.mkDerivation { 9 + stdenv.mkDerivation (finalAttrs: { 9 10 pname = "i810switch"; 10 11 version = "0.6.5"; 11 12 12 - installPhase = " 13 - sed -i -e 's+/usr++' Makefile 14 - sed -i -e 's+^\\(.*putenv(\"PATH=\\).*$+\\1${pciutils}/sbin\");+' i810switch.c 15 - make clean 16 - make install DESTDIR=\${out} 17 - "; 18 - 19 13 src = fetchurl { 20 - url = "http://www16.plala.or.jp/mano-a-mano/i810switch/i810switch-0.6.5.tar.gz"; 21 - sha256 = "d714840e3b14e1fa9c432c4be0044b7c008d904dece0d611554655b979cad4c3"; 14 + url = "http://www16.plala.or.jp/mano-a-mano/i810switch/i810switch-${finalAttrs.version}.tar.gz"; 15 + hash = "sha256-1xSEDjsU4fqcQyxL4ARLfACNkE3s4NYRVUZVuXnK1MM="; 22 16 }; 23 17 18 + nativeBuildInputs = [ installShellFiles ]; 19 + 20 + preBuild = '' 21 + make clean 22 + 23 + substituteInPlace i810switch.c \ 24 + --replace-fail 'define CMD_LSPCI "lspci"' 'define CMD_LSPCI "${lib.getExe' pciutils "lspci"}"' 25 + ''; 26 + 27 + installPhase = " 28 + runHook preInstall 29 + 30 + install -Dm755 -t $out/bin i810switch i810rotate 31 + 32 + installManPage i810switch.1.gz i810rotate.1.gz 33 + 34 + runHook postInstall 35 + "; 36 + 24 37 # Ignore errors since gcc-14. 25 38 # i810switch.c:251:34: error: passing argument 2 of 'getline' from incompatible pointer type [-Wincompatible-pointer-types] 26 39 # i810switch.c:296:34: error: passing argument 2 of 'getline' from incompatible pointer type [-Wincompatible-pointer-types] 27 40 env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; 28 41 29 - meta = with lib; { 42 + meta = { 30 43 description = "Utility for switching between the LCD and external VGA display on Intel graphics cards"; 31 44 homepage = "http://www16.plala.or.jp/mano-a-mano/i810switch.html"; 32 45 maintainers = [ ]; 33 - license = licenses.gpl2Only; 34 - platforms = platforms.linux; 46 + license = lib.licenses.gpl2Only; 47 + platforms = lib.platforms.linux; 48 + mainProgram = "i810switch"; 35 49 }; 36 - } 50 + })