nitrokey: Force learn keys from card on plug

This allows the signing key to be shared among multiple nitrokeys.
This commit is contained in:
Simon Bruder 2024-01-22 00:28:58 +01:00
parent 04a0a6e5ff
commit 04c7bc089f
Signed by: simon
GPG key ID: 347FF8699CDA0776

View file

@ -15,5 +15,15 @@ lib.mkMerge [
#nitrokey-app2
#pynitrokey
];
systemd.user.services.gpg-force-learn-cards = {
serviceConfig = {
ExecStart = "${pkgs.gnupg}/bin/gpg-connect-agent 'learn --force' '/bye'";
};
};
services.udev.extraRules = ''
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="42b2", ENV{SYSTEMD_USER_WANTS}="gpg-force-learn-cards.service"
'';
})
]