ciscoPacketTracer8: 8.2.0 -> 8.2.1, refactor

Signed-off-by: lucasew <lucas59356@gmail.com>
This commit is contained in:
lucasew 2023-05-10 17:43:17 -03:00 committed by Anderson Torres
parent a2420e26d3
commit 2920b6fc16

View file

@ -1,8 +1,9 @@
{ stdenv { stdenvNoCC
, lib , lib
, alsa-lib , alsa-lib
, autoPatchelfHook , autoPatchelfHook
, buildFHSEnv , buildFHSEnv
, ciscoPacketTracer8
, copyDesktopItems , copyDesktopItems
, dbus , dbus
, dpkg , dpkg
@ -21,106 +22,90 @@
, makeWrapper , makeWrapper
, nspr , nspr
, nss , nss
, qt5
, requireFile , requireFile
, xorg , xorg
}: }:
let let
version = "8.2.0"; hashes = {
"8.2.0" = "1b19885d59f6130ee55414fb02e211a1773460689db38bfd1ac7f0d45117ed16";
ptFiles = stdenv.mkDerivation { "8.2.1" = "1fh79r4fnh9gjxjh39gcp4j7npgs5hh3qhrhx74x8x546an3i0s2";
name = "PacketTracer8Drv";
inherit version;
dontUnpack = true;
src = requireFile {
name = "CiscoPacketTracer_${builtins.replaceStrings ["."] [""] version}_Ubuntu_64bit.deb";
sha256 = "1b19885d59f6130ee55414fb02e211a1773460689db38bfd1ac7f0d45117ed16";
url = "https://www.netacad.com";
};
nativeBuildInputs = [
alsa-lib
autoPatchelfHook
dbus
dpkg
expat
fontconfig
glib
libdrm
libglvnd
libpulseaudio
libudev0-shim
libxkbcommon
libxml2
libxslt
makeWrapper
nspr
nss
] ++ (with xorg; [
libICE
libSM
libX11
libxcb
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXScrnSaver
libXtst
xcbutilimage
xcbutilkeysyms
xcbutilrenderutil
xcbutilwm
]);
installPhase = ''
dpkg-deb -x $src $out
chmod 755 "$out"
makeWrapper "$out/opt/pt/bin/PacketTracer" "$out/bin/packettracer" \
--prefix LD_LIBRARY_PATH : "$out/opt/pt/bin"
# Keep source archive cached, to avoid re-downloading
ln -s $src $out/usr/share/
'';
};
desktopItem = makeDesktopItem {
name = "cisco-pt8.desktop";
desktopName = "Cisco Packet Tracer 8";
icon = "${ptFiles}/opt/pt/art/app.png";
exec = "packettracer8 %f";
mimeTypes = [ "application/x-pkt" "application/x-pka" "application/x-pkz" ];
};
fhs = buildFHSEnv {
name = "packettracer8";
runScript = "${ptFiles}/bin/packettracer";
targetPkgs = pkgs: [ libudev0-shim ];
extraInstallCommands = ''
mkdir -p "$out/share/applications"
cp "${desktopItem}"/share/applications/* "$out/share/applications/"
'';
}; };
in in
stdenv.mkDerivation {
stdenvNoCC.mkDerivation rec {
pname = "ciscoPacketTracer8"; pname = "ciscoPacketTracer8";
inherit version;
dontUnpack = true; version = "8.2.1";
installPhase = '' src = requireFile {
mkdir $out name = "CiscoPacketTracer_${builtins.replaceStrings ["."] [""] version}_Ubuntu_64bit.deb";
${lndir}/bin/lndir -silent ${fhs} $out sha256 = hashes.${version};
url = "https://www.netacad.com";
};
unpackPhase = ''
runHook preUnpack
dpkg-deb -x $src $out
chmod 755 "$out"
runHook postUnpack
''; '';
desktopItems = [ desktopItem ]; nativeBuildInputs = [
nativeBuildInputs = [ copyDesktopItems ]; autoPatchelfHook
copyDesktopItems
dpkg
makeWrapper
qt5.wrapQtAppsHook
];
buildInputs = [
alsa-lib
dbus
expat
fontconfig
glib
qt5.qtbase
qt5.qtmultimedia
qt5.qtnetworkauth
qt5.qtscript
qt5.qtspeech
qt5.qtwebengine
qt5.qtwebsockets
];
installPhase = ''
runHook preInstall
makeWrapper "$out/opt/pt/bin/PacketTracer" "$out/bin/packettracer8" \
"''${qtWrapperArgs[@]}" \
--prefix LD_LIBRARY_PATH : "$out/opt/pt/bin"
install -D $out/opt/pt/art/app.png $out/share/icons/hicolor/128x128/apps/ciscoPacketTracer8.png
rm $out/opt/pt/bin/libQt5* -f
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = "cisco-pt8.desktop";
desktopName = "Cisco Packet Tracer 8";
icon = "ciscoPacketTracer8";
exec = "packettracer8 %f";
mimeTypes = [ "application/x-pkt" "application/x-pka" "application/x-pkz" ];
})
];
dontWrapQtApps = true;
passthru = {
inherit hashes;
};
meta = with lib; { meta = with lib; {
description = "Network simulation tool from Cisco"; description = "Network simulation tool from Cisco";