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

HM: default age.secrets.<name>.path isn’t a path #300

Open
sellout opened this issue Nov 25, 2024 · 0 comments
Open

HM: default age.secrets.<name>.path isn’t a path #300

sellout opened this issue Nov 25, 2024 · 0 comments

Comments

@sellout
Copy link

sellout commented Nov 25, 2024

In the Home Manager module, age.secretsDir doesn’t default to a path, but a shell expression that expands to a path. This means that config.age.secrets.<name>.path often can’t be referenced the way it is in the passwordFile example from the age.secrets.<name>.path docs.

E.g., I have a config like

{
  age.secrets.fooCfgForKey.file = ../secrets/foo.cfg.age;
  file.home.".foo.cfg".text = lib.generators.toINI {} {
    settings.include_cfg = config.age.secrets.fooCfgForKey.path;
  };
}

and the generated ~/.foo.cfg looks like

[settings]
include_cfg=${XDG_RUNTIME_DIR}/agenix/fooCfgForKey

which is invalid, as the INI file wants a path, and doesn’t do shell expansion.

My workaround has been to set age.secretsDir to an actual path1, rather than a shell expression, but I get why it’s done the way it is. It would be very useful for age.secrets.<name>.path to be a path, though.

Footnotes

  1. Taking what Home Manager already does with home.homeDirectory, I have added an xdg.runtimeDir option that has to be explicitly set, and then I ensure it matches the actual XDG_RUNTIME_DIR or DARWIN_USER_TEMP_DIR. So age.secretsDir = "${config.xdg.runtimeDir}/agenix does it for me.

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

1 participant