blob: 1e6aa221dc37980f76e8c67e8cc5eafc7a0de715 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
{ config, lib, pkgs, ... }:
let
cfg = config.orbekk.yubikey;
yubikey-pkgs = with pkgs; [
ccid
libu2f-host
libusb
rng-tools
yubikey-manager
yubikey-personalization
gnupg
pinentry
];
in
{
options = {
orbekk.yubikey = {
enable = lib.mkEnableOption "Enable yubikey config";
};
};
config = lib.mkIf cfg.enable {
services.pcscd.enable = true;
services.udev.packages = with pkgs; [
libu2f-host
yubikey-personalization
];
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# Use GPG agent instead.
programs.ssh.startAgent = lib.mkDefault false;
environment = {
systemPackages = yubikey-pkgs;
};
security.sudo.extraRules = [
{
groups = [ "wheel" ];
commands = [ { command = "${pkgs.systemd}/bin/systemctl restart pcscd"; options = [ "NOPASSWD" ]; } ];
}
];
systemd.user.services.restart-pcscd = {
description = "Restart pcscd on startup";
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
serviceConfig = {
ExecStart = ''
sudo systemctl restart pcscd
'';
Type = "oneshot";
};
};
};
}
|