Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 2.72 KB

nixmeta.md

File metadata and controls

37 lines (28 loc) · 2.72 KB

Getting Started

To get started, follow the Getting Started section from the main README.

As an example, to run the nixmeta from the tiiuae/sbomnix repository:

# '--' signifies the end of argument list for `nix`.
# '--help' is the first argument to `nixmeta`
$ nix run github:tiiuae/sbomnix#nixmeta -- --help

nixmeta

nixmeta is a command line tool to summarize nixpkgs meta-attributes from the given nixpkgs version. The output is written to a csv file. Nixpkgs version is specified with flakeref. As an example, --flakeref=github:NixOS/nixpkgs?ref=master would make nixmeta output the meta-attributes from the nixpkgs version in the master branch. Similarly, --flakeref=github:NixOS/nixpkgs?ref=release-23.11 would output the meta-attributes from the nixpkgs version in the release-23.11 branch. Note that --flakeref does not necessarily have to reference github:NixOS/nixpkgs but any flakeref or even NIX_ENV environment variable can be used to specify the nixpkgs version. As an example, --flakeref=github:tiiuae/sbomnix would make nixmeta output the meta-attributes from the nixpkgs version pinned by the sbomnix flake in its default branch.

As an example, below command outputs nixpkgs meta-attributes from the nixpkgs version pinned by flake github:NixOS/nixpkgs?ref=master:

$ ./src/nixmeta/main.py --flakeref=github:NixOS/nixpkgs?ref=master
INFO     Finding meta-info for nixpkgs pinned in flake: github:NixOS/nixpkgs?ref=master
INFO     Wrote: /home/foo/sbomnix-fork/nixmeta.csv

Output summarizes the meta-attributes of all the target nixpkgs packages enumerated by nix-env --query --available. For each package, the output includes the following details:

$ head -n2 nixmeta.csv | csvlook 
| name       | pname | version | meta_homepage        | meta_unfree | meta_license_short               | meta_license_spdxid                    | meta_maintainers_email |
| ---------- | ----- | ------- | -------------------- | ----------- | -------------------------------- | -------------------------------------- | ---------------------- |
| 0ad-0.0.26 | 0ad   | 0.0.26  | https://play0ad.com/ |       False | gpl2;lgpl21;mit;cc-by-sa-30;zlib | GPL-2.0;LGPL-2.1;MIT;CC-BY-SA-3.0;Zlib | [email protected]   |