Nix-facts: a tool for auditing and nixpkgs maintainers

Intro

Hi! Over the past week or so I’ve been bodging together a tool to help me with some maintenance duties. I’m sharing it here in case folks might find it useful.

Okay, what does it do?

nix-facts is a flake you can run via nix develop github:crertel/nix-facts. Once you run that command (which will pull down nixpkgs and do some work–and for extra goodies, use nix-facts-enrich as per the README), you’ll have access to a shell that lets you run the following (using curl, hello, and other packages as examples):

nix-facts search will search out a package

nix-facts info will let you see various facts about a particular package. It (like all the other commnads) can output newline-delimited JSON for scripting:

nix-facts maintainers hello will let you see who maintains a package:

nix-facts maintainer will let you see information about a particular maintainer:

nix-facts platform will let you see what architectures are supported for a particular package:

This is stuff I find handy (and again, is nice for scripting purposes with the CSV and NDJSON output), but admittedly we already have easy ways of pulling it.

Okay, show me something I can’t just find in the nixpkgs search

So, there are some queries that are helpful for finding out more about the “health” of the nixpkgs ecosystem.

nix-facts orphans will show all orphaned packages in nixpkgs.

Note that you can also get this as a full list and CSV:

nix-facts broken lets us see all the broken packages:

nix-facts unfree lets us similarly observe what packages are unfree:

nix-facts no-tests helps find packages that don’t have tests (missing passthru.tests attribute):

nix-facts no-update-script looks for packages that don’t have automated update tooling (missing passthru.updateScript attribute):

I’m hoping that–especially with the last two here–we can start pecking away at gaps in our coverage and find ways of making maintenance even easier than it already is. :slight_smile:

That’s all nixpkgs–what about for local stuff?

nix-facts isn’t just for maintainers! It can tell you things about your own system too!

nix-fact audit-system will look at your running system and give you information about what’s on it:

It also provides several other tables that help you see which packages you’re running that are nonfree, broken, unmaintained, missing tests or updates, and so forth.

With nix-facts audit-devshell you can also audit the devshell for any flake:

Any other silly tricks?

All of this is powered by DuckDB, and nix-facts db lets you run queries against the parsed data directly:

Anything else?

This is alpha-quality software, written and designed by somebody with limited experience with the trickier bits of NixOS and muddling along as best I can with computer assistance–I wanted to scratch an itch I had and also explore what some better tooling for maintainers might feel like, ergonomics-wise.

I would appreciate more folks banging on it (and opening issues, and submitting PRs) to help shape it into something that’s more performant and useful for the community at large.

Thank you!

8 Likes

i’m with @crertel here, we should have enough real problems for the toil to be the point

1 Like