build(nix): prove the wordlist is actually installed
`pythonImportsCheck` only imports, and `hhstream_live.phrase` reads its wordlist lazily, so a wheel that dropped `wordlist.txt` sailed past the check and would have failed at the first `enable` instead. The package now reads the list from the installed tree and mints a phrase through `validate`, which is the only place the packaged data is exercised -- `doCheck = false`, the suite runs in the flake's `checks`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01URhyHGQnmKH9zBXxoznfQY
This commit is contained in:
1 parent
bd3ca2e644
commit
db7aaf8276
1 file changed
+18
-2
+18
-2
@@ -29,11 +29,27 @@ python3.pkgs.buildPythonApplication {
|
||||
"hhstream_pointer.ops"
|
||||
"hhstream_pointer._protocol.wlr_virtual_pointer_unstable_v1"
|
||||
# The web app: importing the server pulls in the router, the publisher and
|
||||
# the pages. The phrase generator's wordlist is covered by the unit suite,
|
||||
# which reads the *installed* package.
|
||||
# the pages.
|
||||
"hhstream_live.server"
|
||||
];
|
||||
|
||||
# `pythonImportsCheck` only *imports*, and `hhstream_live.phrase` reads its
|
||||
# wordlist lazily -- so a wheel that dropped `wordlist.txt` would sail past it
|
||||
# and fail at the first `enable` instead. Read the list for real, against the
|
||||
# installed tree, and mint a phrase so the generator and its validator are
|
||||
# proven on the same words. `doCheck = false` (the suite runs in the flake's
|
||||
# `checks`), so this is the only place the packaged data is exercised.
|
||||
postFixup = ''
|
||||
echo "checking the installed wordlist..."
|
||||
PYTHONPATH="$out/${python3.sitePackages}:$PYTHONPATH" ${python3.interpreter} -c '
|
||||
import hhstream_live.phrase as phrase
|
||||
count = len(phrase.words())
|
||||
assert count > 7000, f"wordlist has only {count} words; is wordlist.txt installed?"
|
||||
assert phrase.validate(phrase.generate())
|
||||
print(f"wordlist ok: {count} words, ~{phrase.entropy_bits():.1f} bits a phrase")
|
||||
'
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Publish a headless Hyprland session's frames on a Unix socket";
|
||||
license = lib.licenses.mit;
|
||||
|
||||
Reference in new issue
Block a user