Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ciscoPacketTracer8: fix script modules #356289

Merged
merged 6 commits into from
Dec 31, 2024

Conversation

gepbird
Copy link
Contributor

@gepbird gepbird commented Nov 15, 2024

Closes #291445

As the bug got introduced with a refactor that moved away from buildFHSEnv, the only fix I found is moving back to it.

This PR is mostly a revert of 2920b6f with additional refactors and the addition of wayland for newer versions of packet tracer.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@gepbird gepbird force-pushed the packet-tracer-fix-script-modules branch from 533e674 to 2788485 Compare November 15, 2024 22:08
@ofborg ofborg bot requested a review from lucasew November 16, 2024 11:34
@ofborg ofborg bot added 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Nov 16, 2024
@gepbird gepbird force-pushed the packet-tracer-fix-script-modules branch from 2788485 to 98f30f6 Compare November 16, 2024 13:45
@gepbird
Copy link
Contributor Author

gepbird commented Nov 21, 2024

cc @griffi-gh @cooparo @ob7 @NemoSomnium @Guccel @Anifyuli @doolphin @sjcp7 for being involved in #291445.

You can test this PR with this command, as usual you may need to download the packet tracer deb file and rename it to what you see in the error message:

NIXPKGS_EXPORT_ALLOW_UNFREE=1 nix run github:gepbird/nixpkgs/packet-tracer-fix-script-modules#ciscoPacketTracer8 --impure --extra-experimental-features nix-command --extra-experimental-features flakes

The "Required Script Modules do not appear to be running. Please reinstall Cisco Packet Tracer." and the "Unable to deserialize." message boxes should be gone, and you should be able to see the script modules loaded. IoT devices also seem to work.

@griffi-gh
Copy link
Member

griffi-gh commented Nov 22, 2024

Minor complaint but the way the -unwrapped package is currently defined makes it kinda hard to override the source;
what if i do not want to use the stateful/non-reproducible prefetch-url?

the only thing i was able to come up with is

  • copy the ciscoPacketTracer8 derivation into my repo
  • call callPackage on it and override requireFile with fetchurl (hacky~)
ciscoPacketTracer8' = (callPackage ./ciscoPacketTracer8.nix {
  requireFile = _: fetchurl {
    url = "https://.../cisco/Packet_Tracer822_amd64_signed.deb";
    sha256 = "6cd2b8891df92d2cad8b6fdc47480fc089de085c4f3fe95eb80d5450a2a7f72d";
  };
});

@griffi-gh
Copy link
Member

griffi-gh commented Nov 22, 2024

Another thing:
my cursor looks weird whenever i hover over the Packet tracer window

image

Actually the same weird cursor as i see in Steam.. huh

and under KDE Plasma (aka the Qt GUI), it runs under x11 instead of Wayland, even without any env vars

@gepbird
Copy link
Contributor Author

gepbird commented Nov 22, 2024

Minor complaint but the way the -unwrapped package is currently defined makes it kinda hard to override the source; what if i do not want to use the stateful/non-reproducible prefetch-url?

the only thing i was able to come up with is

* copy the `ciscoPacketTracer8` derivation into my repo

* call `callPackage` on it and override `requireFile` with `fetchurl` (hacky~)
ciscoPacketTracer8' = (callPackage ./ciscoPacketTracer8.nix {
  requireFile = _: fetchurl {
    url = "https://.../cisco/Packet_Tracer822_amd64_signed.deb";
    sha256 = "6cd2b8891df92d2cad8b6fdc47480fc089de085c4f3fe95eb80d5450a2a7f72d";
  };
});

Thanks for feedback! I'm not sure what's the best way to allow overriding, wrapping unwrapped and fhs-env with a function that takes in src should do the job but its a bit ugly, what do you think? (I intentionally didn't format the file to make the diff easier to read, here is that: 2647141)

Edit: what about putting packetTracerSource ? null at the top (next to version ? "8.2.2)? Then later using the provided packetTracerSource as a src if not null, otherwise the already defined requireFile (a1ee67c).

@gepbird
Copy link
Contributor Author

gepbird commented Nov 22, 2024

Another thing: my cursor looks weird whenever i hover over the Packet tracer window

image

Actually the same weird cursor as i see in Steam.. huh

and under KDE Plasma (aka the Qt GUI), it runs under x11 instead of Wayland, even without any env vars

That looks normal to me as I see that cursor everywhere on my own system. I haven't looked into cursor themes, but could be that packet tracer is trying to use some other cursor icon that is not in your cursor theme. Do you also experience it with PT on master?

@gepbird gepbird force-pushed the packet-tracer-fix-script-modules branch from 2647141 to a1ee67c Compare November 22, 2024 21:08
@ob7
Copy link
Contributor

ob7 commented Nov 23, 2024

tested this out. seems to work well. also seems to fix some issues with certain pka files causing PT to crash. ( haven't tested extensively, just surface level )

@gepbird
Copy link
Contributor Author

gepbird commented Nov 23, 2024

I'm not sure why ofborg-eval is failing, maybe rebasing to master will help.

@gepbird gepbird force-pushed the packet-tracer-fix-script-modules branch from a1ee67c to 0012692 Compare November 23, 2024 18:08
@gepbird gepbird force-pushed the packet-tracer-fix-script-modules branch from 0012692 to a67194f Compare November 29, 2024 18:46
@gepbird
Copy link
Contributor Author

gepbird commented Nov 29, 2024

Fixed the merge conflict caused by #342352

@griffi-gh
Copy link
Member

(another common pattern for packages using FHSenv is moving -unwrapped into a separate package, should this be applied here? idk i don't have much experience with this)

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Dec 4, 2024
@misuzu misuzu merged commit 5329eb8 into NixOS:master Dec 31, 2024
35 checks passed
@gepbird gepbird deleted the packet-tracer-fix-script-modules branch December 31, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 11.by: package-maintainer This PR was created by the maintainer of the package it changes 12.approvals: 1 This PR was reviewed and approved by one reputable person
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cisco Packet Tracer 8 install broken
5 participants