I am trying to place a sops-nix template [1] into a file within my home directory via home-manager option – home.file.source. However, evaluation fails with:
error: access to absolute path '/Users/me/.config/sops-nix/secrets/rendered/example-yaml' is forbidden in pure evaluation mode (use '--impure' to override)
Not sure if it’s the best solution, but I did find some people use lib.file.mkOutOfStoreSymlink on GH. I tried using this with my own configuration, and seems to work:
Tell us which service you use so we can help you find a way to get it to read the secret
You try to set the path option of the template (haven’t done that so far but it should work according to the docs) where you want the config file to be.
If your service uses yaml it might be possible to reference a link to the secrets file.
Here is a flake-parts module that works for me; the sops-nix template part doesn’t require hjem or home-manager, but I do assume that I’m the only user on the system and define a variable that references this user. I also assume that /home is that user’s home directory.