diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index cdcc182577df..994a4e95b4ab 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -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). diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 81dca2243104..a07a08dbdd7c 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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 diff --git a/nixos/modules/services/development/vsmartcard-vpcd.nix b/nixos/modules/services/development/vsmartcard-vpcd.nix new file mode 100644 index 000000000000..c1ce972b998e --- /dev/null +++ b/nixos/modules/services/development/vsmartcard-vpcd.nix @@ -0,0 +1,49 @@ +{ + 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 ]; +} diff --git a/pkgs/by-name/vs/vsmartcard-pcsc-relay/package.nix b/pkgs/by-name/vs/vsmartcard-pcsc-relay/package.nix new file mode 100644 index 000000000000..a277b2c63fa8 --- /dev/null +++ b/pkgs/by-name/vs/vsmartcard-pcsc-relay/package.nix @@ -0,0 +1,58 @@ +{ + 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 ]; + }; +}) diff --git a/pkgs/by-name/vs/vsmartcard-vpcd/package.nix b/pkgs/by-name/vs/vsmartcard-vpcd/package.nix new file mode 100644 index 000000000000..d4fcf0d63f18 --- /dev/null +++ b/pkgs/by-name/vs/vsmartcard-vpcd/package.nix @@ -0,0 +1,63 @@ +{ + 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 ]; + }; +})