Unverified Commit faa68fc8 authored by misuzu's avatar misuzu Committed by GitHub
Browse files

vsmartcard-vpcd, vsmartcard-pcsc-relay: init at 0.9-unstable-2025-01-25,...

vsmartcard-vpcd, vsmartcard-pcsc-relay: init at 0.9-unstable-2025-01-25, nixos/vsmartcard-vpcd: init (#194957)
parents 3b880a25 94a66f94
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -129,6 +129,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 ];
}
+58 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  pkg-config,
  libtool,
  autoreconfHook,
  pcsclite,
  libnfc,
  python3,
  help2man,
  gengetopt,
  vsmartcard-vpcd,
  darwin,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "vsmartcard-pcsc-relay";

  inherit (vsmartcard-vpcd) version src;

  sourceRoot = "${finalAttrs.src.name}/pcsc-relay";

  nativeBuildInputs = [
    autoreconfHook
    libtool
    pkg-config
    help2man
  ];

  buildInputs =
    [
      pcsclite
      libnfc
      gengetopt
      (python3.withPackages (
        pp: with pp; [
          pyscard
          pycrypto
          pbkdf2
          pillow
          gnureadline
        ]
      ))
    ]
    ++ lib.optionals stdenv.isDarwin [
      darwin.apple_sdk.frameworks.PCSC
    ];

  meta = {
    description = "Relays a smart card using an contact-less interface";
    homepage = "https://frankmorgner.github.io/vsmartcard/pcsc-relay/README.html";
    license = lib.licenses.gpl3Only;
    platforms = lib.platforms.all;
    broken = stdenv.isDarwin;
    maintainers = with lib.maintainers; [ stargate01 ];
  };
})
+63 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  pkg-config,
  libtool,
  autoreconfHook,
  pcsclite,
  qrencode,
  python3,
  help2man,
  darwin,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "vsmartcard-vpcd";
  version = "0.9-unstable-2025-01-25";

  src = fetchFromGitHub {
    owner = "frankmorgner";
    repo = "vsmartcard";
    rev = "7369dae26bcb709845003ae2128b8db9df7031ae";
    hash = "sha256-mfw/Yv12ceBVZIyAKJqBh+w4otj3rYYZbJUjKRLcsr4=";
  };

  sourceRoot = "${finalAttrs.src.name}/virtualsmartcard";

  nativeBuildInputs = [
    autoreconfHook
    libtool
    pkg-config
    help2man
  ];

  buildInputs =
    [
      pcsclite
      qrencode
      (python3.withPackages (
        pp: with pp; [
          pyscard
          pycrypto
          pbkdf2
          pillow
          gnureadline
        ]
      ))
    ]
    ++ lib.optionals stdenv.isDarwin [
      darwin.apple_sdk.frameworks.PCSC
    ];

  configureFlags = lib.optional stdenv.isDarwin "--enable-infoplist";

  meta = {
    description = "Emulates a smart card and makes it accessible through PC/SC";
    homepage = "http://frankmorgner.github.io/vsmartcard/virtualsmartcard/README.html";
    license = lib.licenses.gpl3Only;
    platforms = lib.platforms.all;
    broken = stdenv.isDarwin;
    maintainers = with lib.maintainers; [ stargate01 ];
  };
})