Can't commit with git after installing 1password

Hi,
After installing _1password, _1password-gui and activating the ssh agent, whenever I try to commit anything I get the following message:

fatal: cannot run /opt/1Password/op-ssh-sign: No such file or directory
error:
fatal: failed to write commit object

But if I ask for the location of that executable, I can see it exists but in another place:

~/ ❱ which op-ssh-sign
/run/current-system/sw/bin/op-ssh-sign

My configuration regarding that is basically:

programs = {
	  _1password.enable = true;
	  _1password-gui = {
		  enable = true;
		  polkitPolicyOwners = [ "myusername" ];
	  };
}

Now, I saw that someone had the same issue as me here: 1Password: op-ssh-sign nowhere in PATH · Issue #230357 · NixOS/nixpkgs · GitHub but I don’t quite understand when he says:

I realized I could just link it as “{pkgs._1password-gui}/share/1password/op-ssh-sign”…

Does that mean that it is possible to override the location of those files? If so, could you point me into the direction on how to do it?

Hey, I am the author of that issue

If I remember correctly, op-ssh-sign is meant for commit signing. In your git config you can set the right path of op-ssh-sign. The default /opt/1Password/op-ssh-sign doesn’t exist in NixOS

If you manage your git config through e.g. home-manager, you can do something like

programs.git = {
   extraConfig = {
      gpg."ssh".program = "${pkgs._1password-gui}/bin/op-ssh-sign";
  };
};

You should probably also set the IdentityAgent in your ssh config.

See my git and ssh configs for more context.

That solved the issue.
Thanks a lot @cbr9 !

Note that this path won’t work on Darwin, the path there is

${pkgs._1password-gui}/Applications/1Password.app/Contents/MacOS/op-ssh-sign

And since I share my configs across linux and darwin, well, sigh.