diff mbox

[1/1] gnu: Add ccid.

Message ID 20161027094611.19750-1-mbakke@fastmail.com
State New
Headers show

Commit Message

Marius Bakke Oct. 27, 2016, 9:46 a.m. UTC
* gnu/packages/security-token.scm (ccid): New variable.
---
 gnu/packages/security-token.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

Comments

Mike Gerwitz Oct. 28, 2016, 4:18 a.m. UTC | #1
On Thu, Oct 27, 2016 at 10:46:11 +0100, Marius Bakke wrote:
> +     `(#:configure-flags (list (string-append "--enable-usbdropdir=" %output
> +                                              "/pcsc/drivers"))

When I run pcscd under Guix, I get:

  00000000 hotplug_libudev.c:122:HPReadBundleValues()
  Cannot open PC/SC drivers directory: /var/lib/pcsc/drivers
  00000041 hotplug_libudev.c:123:HPReadBundleValues()
  Disabling USB support for pcscd.

I believe that is what `--enable-usbdropdir' is referencing in
ccid.  pcsc-lite has the same configuration option, but it's currently
hardcoded to /var/lib/pcsc/drivers; could you update it to match ccid's
and see if that works?

Debian has the dependencies structured such that pcscd has ccid as an
input.
Marius Bakke Oct. 28, 2016, 11:27 a.m. UTC | #2
Mike Gerwitz <mtg@gnu.org> writes:

> On Thu, Oct 27, 2016 at 10:46:11 +0100, Marius Bakke wrote:
>> +     `(#:configure-flags (list (string-append "--enable-usbdropdir=" %output
>> +                                              "/pcsc/drivers"))
>
> When I run pcscd under Guix, I get:
>
>   00000000 hotplug_libudev.c:122:HPReadBundleValues()
>   Cannot open PC/SC drivers directory: /var/lib/pcsc/drivers
>   00000041 hotplug_libudev.c:123:HPReadBundleValues()
>   Disabling USB support for pcscd.
>
> I believe that is what `--enable-usbdropdir' is referencing in
> ccid.  pcsc-lite has the same configuration option, but it's currently
> hardcoded to /var/lib/pcsc/drivers; could you update it to match ccid's
> and see if that works?

Packages are not allowed to write to /var, so to run pcscd on Guix you
will have to symlink ~/.guix-profile/pcsc/drivers to
/var/lib/pcsc/drivers manually, until we have a system service for
pcscd. Can you try that?

> Debian has the dependencies structured such that pcscd has ccid as an
> input.

This would work, but ccid is one of potentially many drivers for pcscd,
so I'm reluctant to "hard code" it. It would not be possible to use
other drivers if usbdropdir is set to the ccid output.

Thanks for checking!
Ludovic Courtès Oct. 28, 2016, 12:46 p.m. UTC | #3
Marius Bakke <mbakke@fastmail.com> skribis:

> * gnu/packages/security-token.scm (ccid): New variable.

LGTM; the driver issue that Mike and you are discussing doesn’t seem to
be a blocker.

Ludo’.
Mike Gerwitz Oct. 31, 2016, 2:53 a.m. UTC | #4
Marius:

Sorry for the late reply.

On Fri, Oct 28, 2016 at 12:27:29 +0100, Marius Bakke wrote:
> Packages are not allowed to write to /var, so to run pcscd on Guix you
> will have to symlink ~/.guix-profile/pcsc/drivers to
> /var/lib/pcsc/drivers manually, until we have a system service for
> pcscd. Can you try that?

That does indeed work.  Thanks.

Part of this for me is being unfamiliar with how everything in Guix
works, so I'm sure it'll make a lot more sense once I see what service
you come up with and observe its conventions.


>> Debian has the dependencies structured such that pcscd has ccid as an
>> input.
>
> This would work, but ccid is one of potentially many drivers for pcscd,
> so I'm reluctant to "hard code" it. It would not be possible to use
> other drivers if usbdropdir is set to the ccid output.

Okay, that sounds fine with me if there is a potential to be able to use
other drivers; I'm not familiar enough with pcscd to know.

Thanks for working on this!
Marius Bakke Oct. 31, 2016, 10:09 a.m. UTC | #5
Mike Gerwitz <mtg@gnu.org> writes:

> Marius:
>
> Sorry for the late reply.
>
> On Fri, Oct 28, 2016 at 12:27:29 +0100, Marius Bakke wrote:
>> Packages are not allowed to write to /var, so to run pcscd on Guix you
>> will have to symlink ~/.guix-profile/pcsc/drivers to
>> /var/lib/pcsc/drivers manually, until we have a system service for
>> pcscd. Can you try that?
>
> That does indeed work.  Thanks.

Thanks a lot for testing! :)

> Part of this for me is being unfamiliar with how everything in Guix
> works, so I'm sure it'll make a lot more sense once I see what service
> you come up with and observe its conventions.

I haven't started working on this yet, but the idea is to provide a list
of drivers in the service definition (with ccid as default), and then
symlink each of them to the driver directory before starting pcscd.
diff mbox

Patch

diff --git a/gnu/packages/security-token.scm b/gnu/packages/security-token.scm
index 735b2fe..8f58c58 100644
--- a/gnu/packages/security-token.scm
+++ b/gnu/packages/security-token.scm
@@ -2,6 +2,7 @@ 
 ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Mike Gerwitz <mtg@gnu.org>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,11 +26,50 @@ 
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages man)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config))
 
+(define-public ccid
+  (package
+    (name "ccid")
+    (version "1.4.25")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://alioth.debian.org/frs/download.php/file/4187/"
+                    "ccid-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "029n4lpy5nvg278s4mybisyj4lm0bcjslvwfslw6hkghw162n1kb"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags (list (string-append "--enable-usbdropdir=" %output
+                                              "/pcsc/drivers"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-Makefile
+           (lambda _
+             (substitute* "src/Makefile.in"
+               (("/bin/echo") (which "echo")))
+             #t)))))
+    (native-inputs
+     `(("perl" ,perl)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("libusb" ,libusb)
+       ("pcsc-lite" ,pcsc-lite)))
+    (home-page "https://pcsclite.alioth.debian.org/ccid.html")
+    (synopsis "PC/SC driver for USB smart card devices")
+    (description
+     "This package provides a PC/SC IFD handler implementation for devices
+compliant with the CCID and ICCD protocols.  It supports a wide range of
+readers and is needed to communicate with such devices through the
+@command{pcscd} resource manager.")
+    (license license:lgpl2.1+)))
+
 (define-public libyubikey
   (package
     (name "libyubikey")