1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-10 23:00:39 +02:00

fix: add yubikey gpg keygrips to avoid having to call gpg --card-status each boot

This commit is contained in:
oddlama 2024-06-13 12:52:03 +02:00
parent 4b68bec5bb
commit aa659fa085
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
5 changed files with 14 additions and 0 deletions

View file

@ -28,6 +28,12 @@ in
mode = "640";
};
age.secrets."my-gpg-yubikey-keygrip.tar" = {
rekeyFile = ./secrets/gpg-keygrip.tar.age;
group = myuser;
mode = "640";
};
home-manager.users.${myuser} = {
imports = [
../config

View file

@ -1,8 +1,16 @@
{
lib,
nixosConfig,
pkgs,
...
}: {
# Make sure the keygrips exist, otherwise we'd need to run `gpg --card-status`
# before being able to use the yubikey.
home.activation.installKeygrips = lib.hm.dag.entryAfter ["writeBoundary"] ''
run mkdir -p "$HOME/.gnupg/private-keys-v1.d"
run ${lib.getExe pkgs.gnutar} xvf ${lib.escapeShellArg nixosConfig.age.secrets."my-gpg-yubikey-keygrip.tar".path} -C "$HOME/.gnupg/private-keys-v1.d/"
'';
programs.gpg = {
enable = true;
scdaemonSettings.disable-ccid = true;

Binary file not shown.