{ ... }: {
  flake.lib.rbwSshSocket =
    let
      bashSnippet = ''
        if [ -z "''${SSH_AUTH_SOCK:-}" ]; then
          if [ -n "''${XDG_RUNTIME_DIR:-}" ]; then
            export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/rbw/ssh-agent-socket"
          else
            export SSH_AUTH_SOCK="/run/user/$(id -u)/rbw/ssh-agent-socket"
          fi
        fi
      '';
      fishSnippet =
        pkgs: ''
          if test -z "$SSH_AUTH_SOCK"
            if test -n "$XDG_RUNTIME_DIR"
              set -gx SSH_AUTH_SOCK "$XDG_RUNTIME_DIR/rbw/ssh-agent-socket"
            else
              set -l _hm_uid (${pkgs.coreutils}/bin/id -u)
              set -gx SSH_AUTH_SOCK "/run/user/$_hm_uid/rbw/ssh-agent-socket"
            end
          end
        '';
    in
    {
      inherit bashSnippet fishSnippet;
      sessionVariable = "$XDG_RUNTIME_DIR/rbw/ssh-agent-socket";
      activationPath = "/run/user/$(id -u)/rbw/ssh-agent-socket";
    };
}
