nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 pkg-config,
6 openssl,
7 nix-update-script,
8 versionCheckHook,
9}:
10
11rustPlatform.buildRustPackage (finalAttrs: {
12 pname = "ip2asn";
13 version = "0.1.2";
14
15 src = fetchFromGitHub {
16 owner = "x123";
17 repo = "ip2asn";
18 tag = finalAttrs.version;
19 hash = "sha256-2wuxBwllrkPdmmBCt7DPQ38E2k3igAjbICun51bhopY=";
20 };
21
22 cargoHash = "sha256-fYg0aIU8usueMg6cMWUcwMIFCinHdm6H7k9ywZGYfg8=";
23
24 passthru.updateScript = nix-update-script { };
25
26 cargoBuildFlags = [
27 "-p"
28 "ip2asn-cli"
29 ];
30
31 # disable network based tests that download data
32 cargoTestFlags = [
33 "-p"
34 "ip2asn-cli"
35 "--"
36 "--skip"
37 "auto_update_tests::test_auto_update_triggers_download"
38 "--skip"
39 "auto_update_tests::test_auto_update_skips_check_for_recent_cache"
40 ];
41
42 doInstallCheck = true;
43 nativeInstallCheckInputs = [ versionCheckHook ];
44
45 nativeBuildInputs = [
46 pkg-config
47 ];
48
49 buildInputs = [
50 openssl
51 ];
52
53 meta = {
54 description = "CLI tool for mapping IP addresses to Autonomous System information";
55 homepage = "https://github.com/x123/ip2asn/tree/master/ip2asn-cli";
56 changelog = "https://github.com/x123/ip2asn/blob/${finalAttrs.version}/CHANGELOG.md";
57 license = lib.licenses.mit;
58 maintainers = with lib.maintainers; [ x123 ];
59 mainProgram = "ip2asn";
60 };
61})