Commit 94a66f94 authored by Christoph Honal's avatar Christoph Honal
Browse files

nixos/vsmartcard-vcpd: init

parent d676d208
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -127,6 +127,8 @@

- [Stash](https://github.com/stashapp/stash), An organizer for your adult videos/images, written in Go. Available as [services.stash](#opt-services.stash.enable).

- [vsmartcard-vpcd](https://frankmorgner.github.io/vsmartcard/virtualsmartcard/README.html), a virtual smart card driver. Available as [services.vsmartcard-vpcd](#opt-services.vsmartcard-vpcd.enable).

- [Fider](https://fider.io/), an open platform to collect and prioritize feedback. Available as [services.fider](#opt-services.fider.enable).

- [PDS](https://github.com/bluesky-social/pds), Personal Data Server for [bsky](https://bsky.social/). Available as [services.pds](option.html#opt-services.pds).
+1 −0
Original line number Diff line number Diff line
@@ -567,6 +567,7 @@
  ./services/development/lorri.nix
  ./services/development/nixseparatedebuginfod.nix
  ./services/development/rstudio-server/default.nix
  ./services/development/vsmartcard-vpcd.nix
  ./services/development/zammad.nix
  ./services/display-managers/default.nix
  ./services/display-managers/greetd.nix
+49 −0
Original line number Diff line number Diff line
{
  config,
  lib,
  pkgs,
  ...
}:

let

  cfg = config.services.vsmartcard-vpcd;

in
{

  options.services.vsmartcard-vpcd = {
    enable = lib.mkEnableOption "Virtual smart card driver.";

    port = lib.mkOption {
      type = lib.types.port;
      default = 35963;
      description = ''
        Port number vpcd will be listening on.
      '';
    };

    hostname = lib.mkOption {
      type = lib.types.str;
      default = "/dev/null";
      description = ''
        Hostname of a waiting vpicc server vpcd will be connecting to. Use /dev/null for listening mode.
      '';
    };
  };

  config = lib.mkIf cfg.enable {
    services.pcscd.readerConfigs = [
      ''
        FRIENDLYNAME "Virtual PCD"
        DEVICENAME   ${cfg.hostname}:0x${lib.toHexString cfg.port}
        LIBPATH      ${pkgs.vsmartcard-vpcd}/var/lib/pcsc/drivers/serial/libifdvpcd.so
        CHANNELID    0x${lib.toHexString cfg.port}
      ''
    ];

    environment.systemPackages = [ pkgs.vsmartcard-vpcd ];
  };

  meta.maintainers = with lib.maintainers; [ stargate01 ];
}