summary refs log tree commit diff
path: root/pkgs/applications/networking/cisco-packet-tracer/7.nix
blob: 33f35ba12af359f08c02faec961861e538031727 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{ stdenv
, lib
, buildFHSUserEnvBubblewrap
, callPackage
, copyDesktopItems
, dpkg
, lndir
, makeDesktopItem
, makeWrapper
, requireFile
}:

let
  version = "7.3.1";

  ptFiles = stdenv.mkDerivation {
    name = "PacketTracer7drv";
    inherit version;

    dontUnpack = true;
    src = requireFile {
      name = "PacketTracer_${builtins.replaceStrings ["."] [""] version}_amd64.deb";
      sha256 = "c39802d15dd61d00ba27fb8c116da45fd8562ab4b49996555ad66b88deace27f";
      url = "https://www.netacad.com";
    };

    nativeBuildInputs = [ dpkg makeWrapper ];

    installPhase = ''
      dpkg-deb -x $src $out
      makeWrapper "$out/opt/pt/bin/PacketTracer7" "$out/bin/packettracer7" \
          --prefix LD_LIBRARY_PATH : "$out/opt/pt/bin"
    '';
  };

  desktopItem = makeDesktopItem {
    name = "cisco-pt7.desktop";
    desktopName = "Cisco Packet Tracer 7";
    icon = "${ptFiles}/opt/pt/art/app.png";
    exec = "packettracer7 %f";
    mimeType = "application/x-pkt;application/x-pka;application/x-pkz;";
  };

  fhs = buildFHSUserEnvBubblewrap {
    name = "packettracer7";
    runScript = "${ptFiles}/bin/packettracer7";

    targetPkgs = pkgs: with pkgs; [
      alsa-lib
      dbus
      expat
      fontconfig
      glib
      libglvnd
      libpulseaudio
      libudev0-shim
      libxkbcommon
      libxml2
      libxslt
      nspr
      nss
      xorg.libICE
      xorg.libSM
      xorg.libX11
      xorg.libXScrnSaver
    ];
  };
in stdenv.mkDerivation {
  pname = "ciscoPacketTracer7";
  inherit version;

  dontUnpack = true;

  installPhase = ''
    mkdir $out
    ${lndir}/bin/lndir -silent ${fhs} $out
  '';

  desktopItems = [ desktopItem ];

  nativeBuildInputs = [ copyDesktopItems ];

  meta = with lib; {
    description = "Network simulation tool from Cisco";
    homepage = "https://www.netacad.com/courses/packet-tracer";
    license = licenses.unfree;
    maintainers = with maintainers; [ lucasew ];
    platforms = [ "x86_64-linux" ];
  };
}