Is it possible to use the tpm or a yubikey during a package’s install phase? The following derivation was working before on nixos-26.05, but after updating the channel, it no longer seems to work, despite the age file still being decryptable outside of a build:
If you know the hash of the font file and are willing to update it when/if there are any updates, why not just use requireFile? It’s basically built for this exact use-case:
Seems better than trying to expose impure TPM/Yubikey/age stuff to the Nix build environment.
Unless it’s fingerprinted every download or something. But if you’re storing it in age I think you could just rely on the hash of that decrypted.
Hmm… I’m a little confused. The font itself is licensed, so I don’t want to push it to a public repo, hence why I’m storing it as an age secret. I’d also like to be able to provision new systems without any user input, so I’d prefer to keep it with the rest of the repo instead of downloading it manually every single time.
What you could do is manually decrypt it with age before the install and then do nix-store --add-fixed sha256 <decrypted-font-file>/nix-prefetch-url --type sha256 file:///<decrypted-font-file>.
Is there no way to do it in the install itself? If I were just bootstrapping the system, then that’d be fine, but otherwise, I will most likely forget.
I tried adding /dev/tpmrm0 to the extra sandbox paths, for example, but that didn’t work.
If you want to try and punch holes into the sandbox you can try, but I would personally prefer requireFile as it is designed specifically for this use-case of using non-redistributable unfree files in a derivation.
If you decide to go that route, what is your current list of extra-sandbox-paths? I’m actually interested in why this worked before…
Basically what happened is that my previous system didn’t use a tpm key, so it wasn’t really complaining. Then, something updated on my new system and the package has to rebuild. Weirdly enough, while both the tpm identity and yubikey identity fail on the new system, the yubikey identity works fine on the old system, it seems.
Currently, only my builder account’s identities are being passed into the sandbox, so --option extra-sandbox-paths /persist/home/unexpectedgimli/.age/identities. The font isn’t so secretive that I can’t let it get leaked, for example.
However, adding --option extra-sandbox-paths /dev/tpmrm0 didn’t seem to work along with the first option flag.
Ah, well… I might just switch to a regular age identity for the builder account until we find a solution here. Fingers crossed, and thanks for the help so far!
You might wish to change the title to “USB hardware key” to avoid endorsing a particular product—especially since open source/open hardware options exist so a more generic label would be more inclusive to the category.