64 lines
2.0 KiB
Nix
64 lines
2.0 KiB
Nix
{ config, lib, pkgs, ...}:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.yubikey;
|
|
|
|
in
|
|
|
|
{
|
|
options.programs.yubikey = {
|
|
enable = mkEnableOption "Yubikey";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
environment.systemPackages = with pkgs; [
|
|
yubikey-personalization
|
|
];
|
|
services.udev = {
|
|
packages = with pkgs; [
|
|
yubikey-personalization
|
|
(pkgs.writeTextFile {
|
|
name = "wally_udev";
|
|
text = ''
|
|
# NXP LPC55 ROM bootloader (unmodified)
|
|
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0021", TAG+="uaccess"
|
|
# NXP LPC55 ROM bootloader (with Solo 2 VID:PID)
|
|
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="b000", TAG+="uaccess"
|
|
# Solo 2
|
|
SUBSYSTEM=="tty", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="beee", TAG+="uaccess"
|
|
# Solo 2
|
|
SUBSYSTEM=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="beee", TAG+="uaccess"
|
|
'';
|
|
destination = "/etc/udev/rules.d/70-solo2.rules";
|
|
})
|
|
];
|
|
extraRules = ''
|
|
# Yubikey: create a symlink when key is plugged in, register this in systemd
|
|
ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0010|0110|0111|0114|0116|0401|0403|0405|0407|0410", TAG+="systemd", SYMLINK="yubikey"
|
|
'';
|
|
};
|
|
# services.pcscd.enable = true;
|
|
programs.ssh.startAgent = false;
|
|
programs.gnupg.agent = {
|
|
# Note that this setting alone doesn't help with the pinentry bug. The
|
|
# pinentry is set as `--pinentry <something>`, but this is overriden when
|
|
# the first sighup comes along and the config is read. At that point
|
|
# gnupg forces the original pinentry, which no longer exists.
|
|
#
|
|
# A hacky fix is to use home-manager to write the pinentry path to the
|
|
# ~/.gnupg/gpg-agent.conf
|
|
# pinentryFlavor = "gnome3";
|
|
|
|
enable = true;
|
|
enableSSHSupport = true;
|
|
enableExtraSocket = true;
|
|
enableBrowserSocket = true;
|
|
};
|
|
};
|
|
}
|
|
|
|
|