Agenix/Ragenix issues with age-plugin-yubikey and the mysterious "age-plugin-yubikey resolves to executable in current directory" error

Hey guys, I’ve been extremely stuck on this particular issue. I’ve been trying to setup agenix/ragenix with age-plugin-yubikey. But I oddly keep getting the following error with both agenix and ragenix whenever I run nixos-rebuild, no matter if I include the age-plugin-yubikey package in the list of packages to be installed or not:

[agenix] creating new generation in /run/agenix.d/10
[agenix] decrypting secrets...
decrypting '/nix/store/k8mya20ny4l3hkgg969bb886046m4d8i-pass.age' to '/run/agenix.d/10/pass'...
age: error: yubikey plugin: couldn't start plugin: age-plugin-yubikey resolves to executable in current directory (./age-plugin-yubikey)
age: report unexpected or unhelpful errors at https://filippo.io/age/report
chmod: cannot access '/run/agenix.d/10/pass.tmp': No such file or directory
mv: cannot stat '/run/agenix.d/10/pass.tmp': No such file or directory
[agenix] symlinking new secrets to /run/agenix (generation 10)...
[agenix] removing old secrets (generation 9)...
Activation script snippet 'agenixInstall' failed (1)
warning: password file ‘/run/agenix/pass’ does not exist
[agenix] chowning...
chown: cannot access '/run/agenix.d/10/pass': No such file or directory
Activation script snippet 'agenixChown' failed (1)

This is my PR of my flake that I’m currently working with; but I’m seriously completely and utterly lost as I’ve spent the last week trying to figure out why the error is occuring. The absolutely oddest thing is that when I run agenix or ragenix directly on the command line, the yubikey plugin works just fine with no errors; it’s specifically whenever I have NixOS rebuilding my config that it just fails to function at all! Any help would be highly appreciated!!

I just figured it out! I found this line on danielphan’s repo and adding it fixed the issue completely for both agenix and ragenix!

2 Likes