Home Manager - Path relative to own config folder

I want to manage all of my dotfiles in my ~/.config/home-manager folder. That includes my secrets. I made a folder in ~/.config/home-manager/secrets/ssh where I want to store my ssh private keys.

{...}: {
  programs.ssh = {
    enable = true;

    matchBlocks = {
      "aur.archlinux.org" = {
        identityFile = "~/.config/home-manager/secrets/ssh/aur"; # TODO this is really bad
        user = "aur";
      "github.com" = {
        identityFile = "~/.config/home-manager/secrets/ssh/github";
        user = "git";

This is my current config but I highly dislike the ~/.config/home-manager part. I don’t really need to but I’d like to support macOS or at least alternative home config folder positions.

If the ssh module identityFile were of the type path it would be relative to my current config file, which would be great. But the module doesn’t so yeah. Is there any way to convert a path type to a string maybe?