From 0162d1179e0205a17fd7bd70772c76500b537e7b Mon Sep 17 00:00:00 2001 From: x123 Date: Sun, 3 Aug 2025 12:44:24 +0200 Subject: [PATCH] ip2asn: init at 0.1.2 --- pkgs/by-name/ip/ip2asn/package.nix | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 pkgs/by-name/ip/ip2asn/package.nix diff --git a/pkgs/by-name/ip/ip2asn/package.nix b/pkgs/by-name/ip/ip2asn/package.nix new file mode 100644 index 000000000000..cac2fd031c1e --- /dev/null +++ b/pkgs/by-name/ip/ip2asn/package.nix @@ -0,0 +1,61 @@ +{ + lib, + rustPlatform, + fetchFromGitHub, + pkg-config, + openssl, + nix-update-script, + versionCheckHook, +}: + +rustPlatform.buildRustPackage (finalAttrs: { + pname = "ip2asn"; + version = "0.1.2"; + + src = fetchFromGitHub { + owner = "x123"; + repo = "ip2asn"; + tag = finalAttrs.version; + hash = "sha256-2wuxBwllrkPdmmBCt7DPQ38E2k3igAjbICun51bhopY="; + }; + + cargoHash = "sha256-fYg0aIU8usueMg6cMWUcwMIFCinHdm6H7k9ywZGYfg8="; + + passthru.updateScript = nix-update-script { }; + + cargoBuildFlags = [ + "-p" + "ip2asn-cli" + ]; + + # disable network based tests that download data + cargoTestFlags = [ + "-p" + "ip2asn-cli" + "--" + "--skip" + "auto_update_tests::test_auto_update_triggers_download" + "--skip" + "auto_update_tests::test_auto_update_skips_check_for_recent_cache" + ]; + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + openssl + ]; + + meta = { + description = "CLI tool for mapping IP addresses to Autonomous System information"; + homepage = "https://github.com/x123/ip2asn/tree/master/ip2asn-cli"; + changelog = "https://github.com/x123/ip2asn/blob/${finalAttrs.version}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ x123 ]; + mainProgram = "ip2asn"; + }; +})