diff --git a/nix-store-receipt.py b/nix-store-receipt.py new file mode 100755 index 0000000..ace208a --- /dev/null +++ b/nix-store-receipt.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 + +from printer import p +import subprocess +import sys + + +def get_closure(installables): + closure = subprocess.run( + ["nix", "path-info", "--recursive"] + installables, + encoding="utf8", + stdout=subprocess.PIPE, + ) + + return closure.stdout.replace("/nix/store/", "").split("\n") + +installables = sys.argv[1:] + +with p: + with p.set( + align="center", + bold=True, + invert=True, + smooth=True, + custom_size=True, + width=4, + height=4, + ): + p.textln(" Nix Store ") + + p.ln() + + with p.set(align="center", double_height=True, double_width=True): + p.textln("Everyone's favorite") + p.textln("package store") + + p.ln() + + p.textln("You were looking for:") + for item in installables: + p.textln(f"- {item}") + p.ln() + + p.textln("Your closure today:") + + with p.set( + align="left", + font=1, + ): + for line in get_closure(installables): + p.textln(line)