nixpkgs/pkgs/by-name/sn/sniffnet/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
2.1 KiB
Nix
Raw Normal View History

2022-12-05 03:58:15 +00:00
{ lib
, rustPlatform
, fetchFromGitHub
2022-12-05 03:58:15 +00:00
, pkg-config
, libpcap
, libxkbcommon
, openssl
2022-12-05 03:58:15 +00:00
, stdenv
, alsa-lib
, expat
2022-12-05 03:58:15 +00:00
, fontconfig
, vulkan-loader
2024-08-09 16:44:59 +00:00
, wayland
2022-12-05 03:58:15 +00:00
, xorg
, darwin
}:
rustPlatform.buildRustPackage rec {
pname = "sniffnet";
2024-07-22 19:10:57 +00:00
version = "1.3.1";
2022-12-05 03:58:15 +00:00
src = fetchFromGitHub {
owner = "gyulyvgc";
repo = "sniffnet";
2023-03-19 10:26:51 +00:00
rev = "refs/tags/v${version}";
2024-07-22 19:10:57 +00:00
hash = "sha256-wepy56LOhliU6t0ZRPviEbZtsWNqrtUnpUXsEdkRDqI=";
2022-12-05 03:58:15 +00:00
};
2024-07-22 19:10:57 +00:00
cargoHash = "sha256-cV3WhidnH2CBlmHa3IVHTQfTuPdSHwwY0XhgNPyLDN4=";
2022-12-05 03:58:15 +00:00
nativeBuildInputs = [ pkg-config ];
buildInputs = [
libpcap
openssl
2022-12-05 03:58:15 +00:00
] ++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
expat
2022-12-05 03:58:15 +00:00
fontconfig
vulkan-loader
2022-12-05 03:58:15 +00:00
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.AppKit
rustPlatform.bindgenHook
2022-12-05 03:58:15 +00:00
];
# requires internet access
checkFlags = [
"--skip=secondary_threads::check_updates::tests::fetch_latest_release_from_github"
];
2023-12-01 21:17:20 +00:00
postInstall = ''
for res in $(ls resources/packaging/linux/graphics | sed -e 's/sniffnet_//g' -e 's/x.*//g'); do
install -Dm444 resources/packaging/linux/graphics/sniffnet_''${res}x''${res}.png \
$out/share/icons/hicolor/''${res}x''${res}/apps/sniffnet.png
done
install -Dm444 resources/packaging/linux/sniffnet.desktop -t $out/share/applications
substituteInPlace $out/share/applications/sniffnet.desktop \
--replace 'Exec=/usr/bin/sniffnet' 'Exec=sniffnet'
'';
2022-12-05 03:58:15 +00:00
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf $out/bin/sniffnet \
2024-08-09 16:44:59 +00:00
--add-rpath ${lib.makeLibraryPath [ vulkan-loader xorg.libX11 libxkbcommon wayland ]}
2022-12-05 03:58:15 +00:00
'';
meta = with lib; {
description = "Cross-platform application to monitor your network traffic with ease";
homepage = "https://github.com/gyulyvgc/sniffnet";
2023-03-19 10:26:51 +00:00
changelog = "https://github.com/gyulyvgc/sniffnet/blob/v${version}/CHANGELOG.md";
2022-12-05 03:58:15 +00:00
license = with licenses; [ mit /* or */ asl20 ];
maintainers = with maintainers; [ figsoda ];
2023-11-27 01:17:53 +00:00
mainProgram = "sniffnet";
2022-12-05 03:58:15 +00:00
};
}