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

packetry: init at 0.3.0 #351392

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions pkgs/by-name/pa/packetry/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
fetchFromGitHub,
lib,
stdenv,
rustPlatform,
gtk4,
pkg-config,
pango,
wrapGAppsHook4,
darwin,
versionCheckHook,
}:

rustPlatform.buildRustPackage rec {
pname = "packetry";
version = "0.3.0";

src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = "packetry";
rev = "refs/tags/v${version}";
hash = "sha256-yar4HusBSaiKj2QMwtt83jmbfzwt+oFTQ6UVVbOZbYQ=";
};

cargoHash = "sha256-W3J3MnRPxhXXc7MBQemnYKloVnuU52p48vrNsd+FCY4=";

nativeBuildInputs = [
pkg-config
wrapGAppsHook4
];

buildInputs =
[
gtk4
pango
]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk_11_0.frameworks.AppKit
];

# Disable test_replay tests as they need a gui
preCheck = ''
sed -i 's:#\[test\]:#[test] #[ignore]:' src/test_replay.rs
'';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
postInstall = lib.optionalString (!hostPlatform.isWindows) ''
rm $out/bin/packetry-cli
'';

packetry-cli is only needed on windows atm: greatscottgadgets/packetry#154
So we could remove it. Not tested.

The check for windows is not needed so long as meta.platforms doesn't include it but better be safe than sorry?
Upstream builds for windows but I can't test it so I will not suggest adding it to meta.platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this, but I am a little conflicted about adding the hostPlatform check when windows is not part of the supported platforms (in this package.nix).

I am also unaware of how to approach testing the build on windows.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of the check a comment about it being needed only on windows with a link to the pr?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I opted to do that instead.

nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
doInstallCheck = true;

carlossless marked this conversation as resolved.
Show resolved Hide resolved
# packetry-cli is only necessary on windows https://github.com/greatscottgadgets/packetry/pull/154
postInstall = ''
rm $out/bin/packetry-cli
'';

meta = {
description = "USB 2.0 protocol analysis application for use with Cynthion";
homepage = "https://github.com/greatscottgadgets/packetry";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ carlossless ];
mainProgram = "packetry";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}