forward gpg and ssh agent

This commit is contained in:
Charlotte 🦝 Delenk 2024-11-21 09:44:10 +01:00
parent 3b6838cb08
commit e48c086eb6
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
2 changed files with 24 additions and 0 deletions

View file

@ -18,6 +18,7 @@
"build-rainbow-resort" "build-rainbow-resort"
"build-aarch64" "build-aarch64"
"build-riscv" "build-riscv"
"rainbow-resort.int.chir.rs"
] ]
{ {
identityFile = identityFile =
@ -26,6 +27,15 @@
else else
config.sops.secrets.".ssh/id_ed25519_sk".path; config.sops.secrets.".ssh/id_ed25519_sk".path;
}; };
matchBlocks."rainbow-resort.int.chir.rs" = {
forwardAgent = true;
remoteForwards = [
{
bind.address = "/%d/.local/state/gnupg/S.gpg-agent";
host.address = "/%d/.local/state/gnupg/S.gpg-agent.extra";
}
];
};
enable = true; enable = true;
}; };
sops.secrets = lib.mkIf (config.home.username != "root") { sops.secrets = lib.mkIf (config.home.username != "root") {

View file

@ -22,6 +22,7 @@
enable = true; enable = true;
enableSshSupport = true; enableSshSupport = true;
pinentryPackage = pkgs.pinentry-qt; pinentryPackage = pkgs.pinentry-qt;
enableExtraSocket = true;
}; };
sops.secrets."pgp/0xB4E3D4801C49EC5E.asc".sopsFile = ./privkey.yaml; sops.secrets."pgp/0xB4E3D4801C49EC5E.asc".sopsFile = ./privkey.yaml;
home.activation.import-gpg-privkey = home.activation.import-gpg-privkey =
@ -36,4 +37,17 @@
config.sops.secrets."pgp/0xB4E3D4801C49EC5E.asc".path config.sops.secrets."pgp/0xB4E3D4801C49EC5E.asc".path
} }
''; '';
programs.fish.loginShellInit = "gpgconf --launch gpg-agent";
systemd.user.services.link-gnupg-sockets = {
Unit = {
Description = "link gnupg sockets from /run to /home";
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.coreutils}/bin/ln -Tfs /run/user/%U/gnupg %h/.local/state/gnupg";
ExecStop = "${pkgs.coreutils}/bin/rm $HOME/.local/state/gnupg";
RemainAfterExit = true;
};
Install.WantedBy = [ "default.target" ];
};
} }