diff --git a/pkgs/by-name/ru/rustnet/package.nix b/pkgs/by-name/ru/rustnet/package.nix new file mode 100644 index 000000000000..9b687f956ae2 --- /dev/null +++ b/pkgs/by-name/ru/rustnet/package.nix @@ -0,0 +1,70 @@ +{ + lib, + rustPlatform, + fetchFromGitHub, + nix-update-script, + pkg-config, + versionCheckHook, + elfutils, + zlib, + libbpf, + libpcap, + clangStdenv, +}: +let + pname = "rustnet"; + version = "1.2.0"; +in +rustPlatform.buildRustPackage.override { stdenv = clangStdenv; } { + inherit pname version; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "domcyrus"; + repo = "rustnet"; + tag = "v${version}"; + hash = "sha256-ZTCcPTKlKnUNlD4Ayf5dV7Yi2BuKwJ/0IwO3YqlB6u8="; + }; + + cargoHash = "sha256-5Zgo6Ypyrhy5IHC1IiWxgP4aOOdyBNEBBHWi0rsDji0="; + + nativeBuildInputs = [ + pkg-config + versionCheckHook + ]; + + buildInputs = [ + elfutils + libbpf + libpcap + zlib + ]; + + # Required for libbpf-sys to build correctly + hardeningDisable = [ + "zerocallusedregs" + ]; + + # Set environment variables for libbpf-sys + env = { + LIBBPF_SYS_LIBRARY_PATH = "${libbpf}/lib"; + LIBBPF_SYS_INCLUDE_PATH = "${libbpf}/include"; + }; + + checkFlags = [ + "--skip=network::platform::linux::interface_stats::tests::test_get_all_stats" + "--skip=network::platform::linux::interface_stats::tests::test_list_interfaces" + ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "High-performance, cross-platform network monitoring terminal UI tool built with Rust"; + homepage = "https://github.com/domcyrus/rustnet"; + changelog = "https://github.com/domcyrus/rustnet/releases/tag/v${version}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ dvaerum ]; + mainProgram = "rustnet"; + platforms = lib.platforms.linux; + }; +}