summaryrefslogtreecommitdiff
path: root/sys/hardware/athena.nix
blob: b9a230bd2b3f647944488e82b3e916065c32fec9 (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
{ config, lib, pkgs, ... }:
with lib; let
  cfg = config.local.hardware.athena;

  athena = pkgs.local.athena-bccr.${cfg.release};
in
{
  options.local.hardware.athena = {
    enable = mkEnableOption "Athena ASEDrive III smartcard reader";

    release = mkOption {
      type = types.str;
      default = "latest";
      description = "athena-bccr release tag";
    };
  };

  config = mkIf cfg.enable {
    environment.etc = {
      "Athena".source = "${athena.ase-idprotect}/etc/Athena";

      "pkcs11/modules/asep11".text = ''
        module: ${athena.libasep11}
      '';
    };

    services = {
      pcscd.enable = true;

      #TODO: Sería mejor agregar un grupo separado
      udev.extraRules = ''
        # Athena Smartcard Solutions, Inc. ASEDrive V3CR
        ATTRS{idVendor}=="0dc3", ATTRS{idProduct}=="1004", MODE="660", GROUP="users", TAG+="uaccess"
      '';
    };
  };
}