add nix store receipt printer
This commit is contained in:
parent
ea894f9172
commit
5c13522445
1 changed files with 51 additions and 0 deletions
51
nix-store-receipt.py
Executable file
51
nix-store-receipt.py
Executable file
|
@ -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)
|
Loading…
Reference in a new issue