Skip to content

Add on-demand indexing for Nixpkgs in PurlDB#895

Open
chinyeungli wants to merge 2 commits into
mainfrom
758_on_demand_nixpkgs
Open

Add on-demand indexing for Nixpkgs in PurlDB#895
chinyeungli wants to merge 2 commits into
mainfrom
758_on_demand_nixpkgs

Conversation

@chinyeungli

Copy link
Copy Markdown
Contributor

Reference: #758

The code will get the package's metadata from https://search.devbox.sh/v2/ and will use the nix-instantiate command if package cannot be found at devbox and nix is available in the host system.

Following are sample output:

Package: addic7ed-cli
http://127.0.0.1:8001/api/collect/?purl=pkg:nix/nixpkgs/addic7ed-cli
Reference: https://search.devbox.sh/v2/pkg?name=addic7ed-cli

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

[
    {
        "url": "http://127.0.0.1:8001/api/packages/42d5f000-0119-4425-9f05-b86c4fd899e4/",
        "uuid": "42d5f000-0119-4425-9f05-b86c4fd899e4",
        "filename": "01rnl5zyvnijq80z9m2w3ymqqq8rc60dzxvl4ijzg5p5172h2ffs.nar.zst",
        "package_sets": [
            {
                "uuid": "690b8ea9-72b2-4f23-a56a-028681e6a2e1",
                "packages": [
                    "http://127.0.0.1:8001/api/packages/42d5f000-0119-4425-9f05-b86c4fd899e4/",
                    "http://127.0.0.1:8001/api/packages/6972296a-c0f9-4ae9-9216-399bf2c054ee/",
                    "http://127.0.0.1:8001/api/packages/bd83be40-7927-4a96-8784-8c2f2ec1a590/"
                ]
            },
            {
                "uuid": "e00b9c8e-09fb-4e23-a1c4-ff10ee7753a5",
                "packages": [
                    "http://127.0.0.1:8001/api/packages/42d5f000-0119-4425-9f05-b86c4fd899e4/",
                    "http://127.0.0.1:8001/api/packages/c17790c5-8a9b-4e7f-a353-d34a4b4f9640/",
                    "http://127.0.0.1:8001/api/packages/bd83be40-7927-4a96-8784-8c2f2ec1a590/"
                ]
            },
            {
                "uuid": "767a80db-d1ce-41ae-a8c8-ce1c3fd576a0",
                "packages": [
                    "http://127.0.0.1:8001/api/packages/42d5f000-0119-4425-9f05-b86c4fd899e4/",
                    "http://127.0.0.1:8001/api/packages/3c90894d-eb4c-481a-b2c0-1d419936e83e/",
                    "http://127.0.0.1:8001/api/packages/bd83be40-7927-4a96-8784-8c2f2ec1a590/"
                ]
            },
            {
                "uuid": "ff70d700-90f2-4ae8-9f02-ac4729ada6d9",
                "packages": [
                    "http://127.0.0.1:8001/api/packages/42d5f000-0119-4425-9f05-b86c4fd899e4/",
                    "http://127.0.0.1:8001/api/packages/4365dbb4-d620-4193-b63e-810d5c2d7971/",
                    "http://127.0.0.1:8001/api/packages/bd83be40-7927-4a96-8784-8c2f2ec1a590/"
                ]
            }
        ],
        "package_content": "binary",
        "purl": "pkg:nix/nixpkgs/addic7ed-cli@1.4.6?commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=x86_64-linux",
        "type": "nix",
        "namespace": "nixpkgs",
        "name": "addic7ed-cli",
        "version": "1.4.6",
        "qualifiers": "commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=x86_64-linux",
        "subpath": "",
        "primary_language": null,
        "description": "Commandline access to addic7ed subtitles",
        "release_date": "2026-06-27T07:37:20Z",
        "parties": [],
        "keywords": [],
        "homepage_url": "https://github.com/BenoitZugmeyer/addic7ed-cli",
        "download_url": "https://cache.nixos.org/nar/01rnl5zyvnijq80z9m2w3ymqqq8rc60dzxvl4ijzg5p5172h2ffs.nar.zst",
        "bug_tracking_url": null,
        "code_view_url": null,
        "vcs_url": null,
        "repository_homepage_url": null,
        "repository_download_url": null,
        "api_data_url": null,
        "size": null,
        "md5": null,
        "sha1": null,
        "sha256": null,
        "sha512": null,
        "copyright": null,
        "holder": null,
        "declared_license_expression": "mit",
        "declared_license_expression_spdx": "MIT",
        "license_detections": [
            {
                "matches": [
                    {
                        "score": 100.0,
                        "matcher": "1-spdx-id",
                        "end_line": 1,
                        "rule_url": null,
                        "from_file": null,
                        "start_line": 1,
                        "matched_text": "MIT",
                        "match_coverage": 100.0,
                        "matched_length": 1,
                        "rule_relevance": 100,
                        "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06",
                        "license_expression": "mit",
                        "license_expression_spdx": "MIT"
                    }
                ],
                "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf",
                "license_expression": "mit",
                "license_expression_spdx": "MIT"
            }
        ],
        "other_license_expression": null,
        "other_license_expression_spdx": null,
        "other_license_detections": [],
        "extracted_license_statement": "- MIT\n",
        "notice_text": null,
        "source_packages": [],
        "extra_data": {},
        "package_uid": "pkg:nix/nixpkgs/addic7ed-cli@1.4.6?commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=x86_64-linux&uuid=42d5f000-0119-4425-9f05-b86c4fd899e4",
        "datasource_id": null,
        "file_references": [],
        "dependencies": [],
        "resources": "http://127.0.0.1:8001/api/packages/42d5f000-0119-4425-9f05-b86c4fd899e4/resources/",
        "history": "http://127.0.0.1:8001/api/packages/42d5f000-0119-4425-9f05-b86c4fd899e4/history/"
    },
    {
        "url": "http://127.0.0.1:8001/api/packages/c17790c5-8a9b-4e7f-a353-d34a4b4f9640/",
        "uuid": "c17790c5-8a9b-4e7f-a353-d34a4b4f9640",
        "filename": "0givq13zdrsvc9270mbxk6vmnb8xj77ig26yv0sv1ga3bimdjjjx.nar.zst",
        "package_sets": [
            {
                "uuid": "e00b9c8e-09fb-4e23-a1c4-ff10ee7753a5",
                "packages": [
                    "http://127.0.0.1:8001/api/packages/42d5f000-0119-4425-9f05-b86c4fd899e4/",
                    "http://127.0.0.1:8001/api/packages/c17790c5-8a9b-4e7f-a353-d34a4b4f9640/",
                    "http://127.0.0.1:8001/api/packages/bd83be40-7927-4a96-8784-8c2f2ec1a590/"
                ]
            }
        ],
        "package_content": "binary",
        "purl": "pkg:nix/nixpkgs/addic7ed-cli@1.4.6?commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=x86_64-darwin",
        "type": "nix",
        "namespace": "nixpkgs",
        "name": "addic7ed-cli",
        "version": "1.4.6",
        "qualifiers": "commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=x86_64-darwin",
        "subpath": "",
        "primary_language": null,
        "description": "Commandline access to addic7ed subtitles",
        "release_date": "2026-06-27T07:37:20Z",
        "parties": [],
        "keywords": [],
        "homepage_url": "https://github.com/BenoitZugmeyer/addic7ed-cli",
        "download_url": "https://cache.nixos.org/nar/0givq13zdrsvc9270mbxk6vmnb8xj77ig26yv0sv1ga3bimdjjjx.nar.zst",
        "bug_tracking_url": null,
        "code_view_url": null,
        "vcs_url": null,
        "repository_homepage_url": null,
        "repository_download_url": null,
        "api_data_url": null,
        "size": null,
        "md5": null,
        "sha1": null,
        "sha256": null,
        "sha512": null,
        "copyright": null,
        "holder": null,
        "declared_license_expression": "mit",
        "declared_license_expression_spdx": "MIT",
        "license_detections": [
            {
                "matches": [
                    {
                        "score": 100.0,
                        "matcher": "1-spdx-id",
                        "end_line": 1,
                        "rule_url": null,
                        "from_file": null,
                        "start_line": 1,
                        "matched_text": "MIT",
                        "match_coverage": 100.0,
                        "matched_length": 1,
                        "rule_relevance": 100,
                        "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06",
                        "license_expression": "mit",
                        "license_expression_spdx": "MIT"
                    }
                ],
                "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf",
                "license_expression": "mit",
                "license_expression_spdx": "MIT"
            }
        ],
        "other_license_expression": null,
        "other_license_expression_spdx": null,
        "other_license_detections": [],
        "extracted_license_statement": "- MIT\n",
        "notice_text": null,
        "source_packages": [],
        "extra_data": {},
        "package_uid": "pkg:nix/nixpkgs/addic7ed-cli@1.4.6?commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=x86_64-darwin&uuid=c17790c5-8a9b-4e7f-a353-d34a4b4f9640",
        "datasource_id": null,
        "file_references": [],
        "dependencies": [],
        "resources": "http://127.0.0.1:8001/api/packages/c17790c5-8a9b-4e7f-a353-d34a4b4f9640/resources/",
        "history": "http://127.0.0.1:8001/api/packages/c17790c5-8a9b-4e7f-a353-d34a4b4f9640/history/"
    },
    {
        "url": "http://127.0.0.1:8001/api/packages/3c90894d-eb4c-481a-b2c0-1d419936e83e/",
        "uuid": "3c90894d-eb4c-481a-b2c0-1d419936e83e",
        "filename": "17mcfi5p9jj1gh4bpmm194zca9b7zmy13gn2fpgxmwfazz3d5ihs.nar.zst",
        "package_sets": [
            {
                "uuid": "767a80db-d1ce-41ae-a8c8-ce1c3fd576a0",
                "packages": [
                    "http://127.0.0.1:8001/api/packages/42d5f000-0119-4425-9f05-b86c4fd899e4/",
                    "http://127.0.0.1:8001/api/packages/3c90894d-eb4c-481a-b2c0-1d419936e83e/",
                    "http://127.0.0.1:8001/api/packages/bd83be40-7927-4a96-8784-8c2f2ec1a590/"
                ]
            }
        ],
        "package_content": "binary",
        "purl": "pkg:nix/nixpkgs/addic7ed-cli@1.4.6?commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=aarch64-linux",
        "type": "nix",
        "namespace": "nixpkgs",
        "name": "addic7ed-cli",
        "version": "1.4.6",
        "qualifiers": "commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=aarch64-linux",
        "subpath": "",
        "primary_language": null,
        "description": "Commandline access to addic7ed subtitles",
        "release_date": "2026-06-27T07:37:20Z",
        "parties": [],
        "keywords": [],
        "homepage_url": "https://github.com/BenoitZugmeyer/addic7ed-cli",
        "download_url": "https://cache.nixos.org/nar/17mcfi5p9jj1gh4bpmm194zca9b7zmy13gn2fpgxmwfazz3d5ihs.nar.zst",
        "bug_tracking_url": null,
        "code_view_url": null,
        "vcs_url": null,
        "repository_homepage_url": null,
        "repository_download_url": null,
        "api_data_url": null,
        "size": null,
        "md5": null,
        "sha1": null,
        "sha256": null,
        "sha512": null,
        "copyright": null,
        "holder": null,
        "declared_license_expression": "mit",
        "declared_license_expression_spdx": "MIT",
        "license_detections": [
            {
                "matches": [
                    {
                        "score": 100.0,
                        "matcher": "1-spdx-id",
                        "end_line": 1,
                        "rule_url": null,
                        "from_file": null,
                        "start_line": 1,
                        "matched_text": "MIT",
                        "match_coverage": 100.0,
                        "matched_length": 1,
                        "rule_relevance": 100,
                        "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06",
                        "license_expression": "mit",
                        "license_expression_spdx": "MIT"
                    }
                ],
                "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf",
                "license_expression": "mit",
                "license_expression_spdx": "MIT"
            }
        ],
        "other_license_expression": null,
        "other_license_expression_spdx": null,
        "other_license_detections": [],
        "extracted_license_statement": "- MIT\n",
        "notice_text": null,
        "source_packages": [],
        "extra_data": {},
        "package_uid": "pkg:nix/nixpkgs/addic7ed-cli@1.4.6?commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=aarch64-linux&uuid=3c90894d-eb4c-481a-b2c0-1d419936e83e",
        "datasource_id": null,
        "file_references": [],
        "dependencies": [],
        "resources": "http://127.0.0.1:8001/api/packages/3c90894d-eb4c-481a-b2c0-1d419936e83e/resources/",
        "history": "http://127.0.0.1:8001/api/packages/3c90894d-eb4c-481a-b2c0-1d419936e83e/history/"
    },
    {
        "url": "http://127.0.0.1:8001/api/packages/4365dbb4-d620-4193-b63e-810d5c2d7971/",
        "uuid": "4365dbb4-d620-4193-b63e-810d5c2d7971",
        "filename": "0svrk6205zjm4vbf0hb8jhacams8gsjc25i7fwgm97mc1y2aygi8.nar.zst",
        "package_sets": [
            {
                "uuid": "ff70d700-90f2-4ae8-9f02-ac4729ada6d9",
                "packages": [
                    "http://127.0.0.1:8001/api/packages/42d5f000-0119-4425-9f05-b86c4fd899e4/",
                    "http://127.0.0.1:8001/api/packages/4365dbb4-d620-4193-b63e-810d5c2d7971/",
                    "http://127.0.0.1:8001/api/packages/bd83be40-7927-4a96-8784-8c2f2ec1a590/"
                ]
            }
        ],
        "package_content": "binary",
        "purl": "pkg:nix/nixpkgs/addic7ed-cli@1.4.6?commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=aarch64-darwin",
        "type": "nix",
        "namespace": "nixpkgs",
        "name": "addic7ed-cli",
        "version": "1.4.6",
        "qualifiers": "commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=aarch64-darwin",
        "subpath": "",
        "primary_language": null,
        "description": "Commandline access to addic7ed subtitles",
        "release_date": "2026-06-27T07:37:20Z",
        "parties": [],
        "keywords": [],
        "homepage_url": "https://github.com/BenoitZugmeyer/addic7ed-cli",
        "download_url": "https://cache.nixos.org/nar/0svrk6205zjm4vbf0hb8jhacams8gsjc25i7fwgm97mc1y2aygi8.nar.zst",
        "bug_tracking_url": null,
        "code_view_url": null,
        "vcs_url": null,
        "repository_homepage_url": null,
        "repository_download_url": null,
        "api_data_url": null,
        "size": null,
        "md5": null,
        "sha1": null,
        "sha256": null,
        "sha512": null,
        "copyright": null,
        "holder": null,
        "declared_license_expression": "mit",
        "declared_license_expression_spdx": "MIT",
        "license_detections": [
            {
                "matches": [
                    {
                        "score": 100.0,
                        "matcher": "1-spdx-id",
                        "end_line": 1,
                        "rule_url": null,
                        "from_file": null,
                        "start_line": 1,
                        "matched_text": "MIT",
                        "match_coverage": 100.0,
                        "matched_length": 1,
                        "rule_relevance": 100,
                        "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06",
                        "license_expression": "mit",
                        "license_expression_spdx": "MIT"
                    }
                ],
                "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf",
                "license_expression": "mit",
                "license_expression_spdx": "MIT"
            }
        ],
        "other_license_expression": null,
        "other_license_expression_spdx": null,
        "other_license_detections": [],
        "extracted_license_statement": "- MIT\n",
        "notice_text": null,
        "source_packages": [],
        "extra_data": {},
        "package_uid": "pkg:nix/nixpkgs/addic7ed-cli@1.4.6?commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=out&system=aarch64-darwin&uuid=4365dbb4-d620-4193-b63e-810d5c2d7971",
        "datasource_id": null,
        "file_references": [],
        "dependencies": [],
        "resources": "http://127.0.0.1:8001/api/packages/4365dbb4-d620-4193-b63e-810d5c2d7971/resources/",
        "history": "http://127.0.0.1:8001/api/packages/4365dbb4-d620-4193-b63e-810d5c2d7971/history/"
    },
    {
        "url": "http://127.0.0.1:8001/api/packages/6972296a-c0f9-4ae9-9216-399bf2c054ee/",
        "uuid": "6972296a-c0f9-4ae9-9216-399bf2c054ee",
        "filename": "1im9xhbncc52kk3yx2iyzsi99qh5l0vzp82hy9v3naydz9gzpmjl.nar.zst",
        "package_sets": [
            {
                "uuid": "690b8ea9-72b2-4f23-a56a-028681e6a2e1",
                "packages": [
                    "http://127.0.0.1:8001/api/packages/42d5f000-0119-4425-9f05-b86c4fd899e4/",
                    "http://127.0.0.1:8001/api/packages/6972296a-c0f9-4ae9-9216-399bf2c054ee/",
                    "http://127.0.0.1:8001/api/packages/bd83be40-7927-4a96-8784-8c2f2ec1a590/"
                ]
            }
        ],
        "package_content": "binary",
        "purl": "pkg:nix/nixpkgs/addic7ed-cli@1.4.6?commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=dist&system=aarch64-darwin",
        "type": "nix",
        "namespace": "nixpkgs",
        "name": "addic7ed-cli",
        "version": "1.4.6",
        "qualifiers": "commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=dist&system=aarch64-darwin",
        "subpath": "",
        "primary_language": null,
        "description": "Commandline access to addic7ed subtitles",
        "release_date": "2026-06-27T07:37:20Z",
        "parties": [],
        "keywords": [],
        "homepage_url": "https://github.com/BenoitZugmeyer/addic7ed-cli",
        "download_url": "https://cache.nixos.org/nar/1im9xhbncc52kk3yx2iyzsi99qh5l0vzp82hy9v3naydz9gzpmjl.nar.zst",
        "bug_tracking_url": null,
        "code_view_url": null,
        "vcs_url": null,
        "repository_homepage_url": null,
        "repository_download_url": null,
        "api_data_url": null,
        "size": null,
        "md5": null,
        "sha1": null,
        "sha256": null,
        "sha512": null,
        "copyright": null,
        "holder": null,
        "declared_license_expression": "mit",
        "declared_license_expression_spdx": "MIT",
        "license_detections": [
            {
                "matches": [
                    {
                        "score": 100.0,
                        "matcher": "1-spdx-id",
                        "end_line": 1,
                        "rule_url": null,
                        "from_file": null,
                        "start_line": 1,
                        "matched_text": "MIT",
                        "match_coverage": 100.0,
                        "matched_length": 1,
                        "rule_relevance": 100,
                        "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06",
                        "license_expression": "mit",
                        "license_expression_spdx": "MIT"
                    }
                ],
                "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf",
                "license_expression": "mit",
                "license_expression_spdx": "MIT"
            }
        ],
        "other_license_expression": null,
        "other_license_expression_spdx": null,
        "other_license_detections": [],
        "extracted_license_statement": "- MIT\n",
        "notice_text": null,
        "source_packages": [],
        "extra_data": {
            "package_content": 5
        },
        "package_uid": "pkg:nix/nixpkgs/addic7ed-cli@1.4.6?commit=3d46470bb3030020f7e1361f33514854f5bfa86d&output=dist&system=aarch64-darwin&uuid=6972296a-c0f9-4ae9-9216-399bf2c054ee",
        "datasource_id": "nix_api_metadata",
        "file_references": [],
        "dependencies": [],
        "resources": "http://127.0.0.1:8001/api/packages/6972296a-c0f9-4ae9-9216-399bf2c054ee/resources/",
        "history": "http://127.0.0.1:8001/api/packages/6972296a-c0f9-4ae9-9216-399bf2c054ee/history/"
    }
]

Package: python3Packages.numpy
http://127.0.0.1:8001/api/collect/?purl=pkg:nix/nixpkgs/python3Packages.numpy
No reference found in devbox: https://search.devbox.sh/v2/pkg?name=python3Packages.numpy

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

[
    {
        "url": "http://127.0.0.1:8001/api/packages/3a248d82-66c1-4e6e-861b-693da10122c5/",
        "uuid": "3a248d82-66c1-4e6e-861b-693da10122c5",
        "filename": "00p5prnnrcz6yb96q4p6zpqlfrbn3r4f75289nc06bzw0qj6i0wy.nar.zst",
        "package_sets": [
            {
                "uuid": "34ca4e76-c47e-43e6-bb2b-abce048854e3",
                "packages": [
                    "http://127.0.0.1:8001/api/packages/d2aff49e-5b80-47e9-805c-b094523f05cc/",
                    "http://127.0.0.1:8001/api/packages/3a248d82-66c1-4e6e-861b-693da10122c5/",
                    "http://127.0.0.1:8001/api/packages/8165fefa-8b9c-4fd5-9a0b-69ddb093d1c7/"
                ]
            }
        ],
        "package_content": "binary",
        "purl": "pkg:nix/nixpkgs/python3Packages.numpy@2.4.4?output=out&system=x86_64-linux",
        "type": "nix",
        "namespace": "nixpkgs",
        "name": "python3Packages.numpy",
        "version": "2.4.4",
        "qualifiers": "output=out&system=x86_64-linux",
        "subpath": "",
        "primary_language": null,
        "description": "Scientific tools for Python",
        "release_date": null,
        "parties": [],
        "keywords": [],
        "homepage_url": "https://numpy.org/",
        "download_url": "https://cache.nixos.org/nar/00p5prnnrcz6yb96q4p6zpqlfrbn3r4f75289nc06bzw0qj6i0wy.nar.zst",
        "bug_tracking_url": null,
        "code_view_url": null,
        "vcs_url": null,
        "repository_homepage_url": null,
        "repository_download_url": null,
        "api_data_url": null,
        "size": null,
        "md5": null,
        "sha1": null,
        "sha256": null,
        "sha512": null,
        "copyright": null,
        "holder": null,
        "declared_license_expression": "bsd-new",
        "declared_license_expression_spdx": "BSD-3-Clause",
        "license_detections": [
            {
                "matches": [
                    {
                        "score": 100.0,
                        "matcher": "1-hash",
                        "end_line": 1,
                        "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/bsd-new_10.RULE",
                        "from_file": null,
                        "start_line": 1,
                        "matched_text": "BSD-3-Clause",
                        "match_coverage": 100.0,
                        "matched_length": 3,
                        "rule_relevance": 100,
                        "rule_identifier": "bsd-new_10.RULE",
                        "license_expression": "bsd-new",
                        "license_expression_spdx": "BSD-3-Clause"
                    }
                ],
                "identifier": "bsd_new-50fa5753-f24d-ec04-33a1-36bb8ac0492c",
                "license_expression": "bsd-new",
                "license_expression_spdx": "BSD-3-Clause"
            }
        ],
        "other_license_expression": null,
        "other_license_expression_spdx": null,
        "other_license_detections": [],
        "extracted_license_statement": "- BSD-3-Clause\n",
        "notice_text": null,
        "source_packages": [],
        "extra_data": {},
        "package_uid": "pkg:nix/nixpkgs/python3Packages.numpy@2.4.4?output=out&system=x86_64-linux&uuid=3a248d82-66c1-4e6e-861b-693da10122c5",
        "datasource_id": null,
        "file_references": [],
        "dependencies": [],
        "resources": "http://127.0.0.1:8001/api/packages/3a248d82-66c1-4e6e-861b-693da10122c5/resources/",
        "history": "http://127.0.0.1:8001/api/packages/3a248d82-66c1-4e6e-861b-693da10122c5/history/"
    },
    {
        "url": "http://127.0.0.1:8001/api/packages/d2aff49e-5b80-47e9-805c-b094523f05cc/",
        "uuid": "d2aff49e-5b80-47e9-805c-b094523f05cc",
        "filename": "07vdkbbxgz7lisqxzryjp4qrz02zwjvcl0891b5j1nadn5gm1nv0.nar.xz",
        "package_sets": [
            {
                "uuid": "34ca4e76-c47e-43e6-bb2b-abce048854e3",
                "packages": [
                    "http://127.0.0.1:8001/api/packages/d2aff49e-5b80-47e9-805c-b094523f05cc/",
                    "http://127.0.0.1:8001/api/packages/3a248d82-66c1-4e6e-861b-693da10122c5/",
                    "http://127.0.0.1:8001/api/packages/8165fefa-8b9c-4fd5-9a0b-69ddb093d1c7/"
                ]
            }
        ],
        "package_content": "binary",
        "purl": "pkg:nix/nixpkgs/python3Packages.numpy@2.4.4?output=dist&system=x86_64-linux",
        "type": "nix",
        "namespace": "nixpkgs",
        "name": "python3Packages.numpy",
        "version": "2.4.4",
        "qualifiers": "output=dist&system=x86_64-linux",
        "subpath": "",
        "primary_language": null,
        "description": "Scientific tools for Python",
        "release_date": null,
        "parties": [],
        "keywords": [],
        "homepage_url": "https://numpy.org/",
        "download_url": "https://cache.nixos.org/nar/07vdkbbxgz7lisqxzryjp4qrz02zwjvcl0891b5j1nadn5gm1nv0.nar.xz",
        "bug_tracking_url": null,
        "code_view_url": null,
        "vcs_url": null,
        "repository_homepage_url": null,
        "repository_download_url": null,
        "api_data_url": null,
        "size": null,
        "md5": null,
        "sha1": null,
        "sha256": null,
        "sha512": null,
        "copyright": null,
        "holder": null,
        "declared_license_expression": "bsd-new",
        "declared_license_expression_spdx": "BSD-3-Clause",
        "license_detections": [
            {
                "matches": [
                    {
                        "score": 100.0,
                        "matcher": "1-hash",
                        "end_line": 1,
                        "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/bsd-new_10.RULE",
                        "from_file": null,
                        "start_line": 1,
                        "matched_text": "BSD-3-Clause",
                        "match_coverage": 100.0,
                        "matched_length": 3,
                        "rule_relevance": 100,
                        "rule_identifier": "bsd-new_10.RULE",
                        "license_expression": "bsd-new",
                        "license_expression_spdx": "BSD-3-Clause"
                    }
                ],
                "identifier": "bsd_new-50fa5753-f24d-ec04-33a1-36bb8ac0492c",
                "license_expression": "bsd-new",
                "license_expression_spdx": "BSD-3-Clause"
            }
        ],
        "other_license_expression": null,
        "other_license_expression_spdx": null,
        "other_license_detections": [],
        "extracted_license_statement": "- BSD-3-Clause\n",
        "notice_text": null,
        "source_packages": [],
        "extra_data": {},
        "package_uid": "pkg:nix/nixpkgs/python3Packages.numpy@2.4.4?output=dist&system=x86_64-linux&uuid=d2aff49e-5b80-47e9-805c-b094523f05cc",
        "datasource_id": null,
        "file_references": [],
        "dependencies": [],
        "resources": "http://127.0.0.1:8001/api/packages/d2aff49e-5b80-47e9-805c-b094523f05cc/resources/",
        "history": "http://127.0.0.1:8001/api/packages/d2aff49e-5b80-47e9-805c-b094523f05cc/history/"
    }
]

Note that if no version is provided, the code will try to get all the available version.
The purl follows the proposed syntax at package-url/purl-spec#877

Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant