Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage with age plugins #237

Open
dghubble opened this issue Jan 14, 2024 · 1 comment
Open

Usage with age plugins #237

dghubble opened this issue Jan 14, 2024 · 1 comment

Comments

@dghubble
Copy link

I'm able to use agenix (the CLI) with age or rage using the age-plugin-yubikey, but when using agenix as NixOS module and referencing secrets, agenix is not able to invoke the age or rage commands and have them detect the installed plugin.

When running sudo nixos-rebuild, age doesn't want to invoke the age-plugin-yubikey. Or using rage, it can't find the plugin at all.

  # Configure agenix
  age = {
    ageBin = "${pkgs.age}/bin/age";
    #ageBin = "${pkgs.rage}/bin/rage";
    identityPaths = [ ../identity.txt ];

    # Reference age secret files
    secrets = {
      bar = {
        file = ../secrets/bar.age;
      };
    };
  };
# age 1.1.1
$ sudo nixos-rebuild switch
...
[agenix] decrypting secrets...
decrypting '/nix/store/7daqifqz4avszwsm5r2kmf2lvqmw00zx-bar.age' to '/run/agenix.d/30/bar'...
age: error: yubikey plugin: couldn't start plugin: age-plugin-yubikey resolves to executable in current directory (./age-plugin-yubikey)
# rage 0.9.2
$ sudo nixos-rebuild switch
...
[agenix] decrypting secrets...
decrypting '/nix/store/7daqifqz4avszwsm5r2kmf2lvqmw00zx-bar.age' to '/run/agenix.d/31/bar'...
Error: Could not find '⁨age-plugin-yubikey⁩' on the PATH.
Have you installed the plugin?

Both age and rage are able to detect and use the plugin when I use them directly or when I use the agenix CLI. I've tried installing them with both environment.systemPackage and home-manage home-packages. I think this is something to do with the nixos-rebuild environment's view of the PATH, like it just can't see plugins in general. Is there a way to tell this module about these plugins that I'm missing?

Related: #115

@nrabulinski
Copy link

I’m pretty sure you should be able to wrap age and overwrite ageBin so that it always has the plugin in PATH. That could potentially work, at least as a workaround until there’s first party support for that in agenix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants