Skip to content

Commit

Permalink
Make commit signing work on darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystucki committed Nov 6, 2024
1 parent b87e740 commit 2088820
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
18 changes: 0 additions & 18 deletions common/nixos-home-manager.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{ pkgs, ... }:

let
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG9keparNqpev2qrDO3cAiDzyTUsAAN9Mh+JLbOsdiZs";
in
{
imports = map (x: ../components + x) [
/common-apps.nix
Expand All @@ -11,19 +8,4 @@ in
];

home.homeDirectory = "/home/jeremy";

programs.git.extraConfig = {
commit.gpgsign = true;
user.signingkey = publicKey;
"gpg \"ssh\"".program = "${pkgs._1password-gui}/bin/op-ssh-sign";

gpg = {
format = "ssh";
ssh.allowedSignersFile = builtins.toFile "allowed_signers" ''
dev@jeremystucki.ch ${publicKey}
jeremy.stucki@valora.com ${publicKey}
jeremy.stucki@ost.ch ${publicKey}
'';
};
};
}
19 changes: 19 additions & 0 deletions components/git.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

let
gitPackage = pkgs.git;
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG9keparNqpev2qrDO3cAiDzyTUsAAN9Mh+JLbOsdiZs";
in
{
home.shellAliases = {
Expand Down Expand Up @@ -58,6 +59,24 @@ in
autosquash = true;
updateRefs = true;
};

commit.gpgsign = true;
user.signingkey = publicKey;

"gpg \"ssh\"".program =
if pkgs.stdenv.isDarwin then
"/Applications/1Password.app/Contents/MacOS/op-ssh-sig"
else
"${pkgs._1password-gui}/bin/op-ssh-sign";

gpg = {
format = "ssh";
ssh.allowedSignersFile = builtins.toFile "allowed_signers" ''
dev@jeremystucki.ch ${publicKey}
jeremy.stucki@valora.com ${publicKey}
jeremy.stucki@ost.ch ${publicKey}
'';
};
};

delta = {
Expand Down

0 comments on commit 2088820

Please sign in to comment.