aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018, 2022 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu services security-token)
  #:use-module (gnu services)
  #:use-module (gnu services shepherd)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages base)
  #:use-module (gnu packages security-token)
  #:use-module (gnu system shadow)
  #:use-module (guix gexp)
  #:use-module (guix modules)
  #:use-module (guix records)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-26)
  #:export (pcscd-configuration
            pcscd-configuration?
            pcscd-configuration-pcsc-lite
            pcscd-configuration-usb-drivers
            pcscd-service-type))

;;;
;;; PC/SC Smart Card Daemon
;;;

(define-record-type* <pcscd-configuration>
  pcscd-configuration make-pcscd-configuration pcscd-configuration?
  (pcsc-lite pcscd-configuration-pcsc-lite
             (default pcsc-lite))
  (usb-drivers pcscd-configuration-usb-drivers
               (default (list ccid))))

(define pcscd-shepherd-service
  (match-lambda
    (($ <pcscd-configuration> pcsc-lite)
     (shepherd-service
      (documentation "PC/SC Smart Card Daemon")
      (provision '(pcscd))
      (requirement '(syslogd))
      (start #~(lambda _
                 (let ((socket "/run/pcscd/pcscd.comm"))
                   (when (file-exists? socket)
                     (delete-file socket)))
                 (fork+exec-command
                  (list #$(file-append pcsc-lite "/sbin/pcscd")
                        "--foreground")
                  #:log-file "/var/log/pcscd.log")))
      (stop #~(make-kill-destructor))))))

(define pcscd-activation
  (match-lambda
    (($ <pcscd-configuration> pcsc-lite usb-drivers)
     (with-imported-modules (source-module-closure
                             '((guix build utils)))
       #~(begin
           (use-modules (guix build utils))

           (mkdir-p "/var/lib")
           (switch-symlinks "/var/lib/pcsc"
                            #$(directory-union
                               "pcsc"
                               (map (cut file-append <> "/pcsc")
                                    usb-drivers))))))))

(define pcscd-service-type
  (service-type
   (name 'pcscd)
   (description
    "Run @command{pcscd}, the PC/SC smart card daemon.")
   (extensions
    (list (service-extension shepherd-root-service-type
                             (compose list pcscd-shepherd-service))
          (service-extension activation-service-type
                             pcscd-activation)))
   (default-value (pcscd-configuration))))
1-12 03:49:39 -0500'>2022-11-12Revert "teams: Add Raghav Gururajan."...Raghav Gururajan 2022-11-12teams: Add Raghav Gururajan....Raghav Gururajan 2022-11-03gnu: janet: Update to 1.25.1....jgart 2022-11-03gnu: sbcl: Remove obsolete fix-shared-library-makefile phase....Pierre Neidhardt 2022-10-31gnu: sbcl: Update to 2.2.10....Guillaume Le Vaillant 2022-09-18gnu: txr: Update to 282....Guillaume Le Vaillant 2022-09-18gnu: eisl: Update to 2.63....Guillaume Le Vaillant 2022-09-14gnu: txr: Update to 281....Guillaume Le Vaillant 2022-09-11gnu: janet: Update to 1.24.1....jgart 2022-09-03gnu: Add eisl....Joeke de Graaf 2022-08-19gnu: janet: Update to 1.24.0....jgart 2022-08-12gnu: txr: Update to 280....Guillaume Le Vaillant 2022-07-12gnu: sbcl: Fix building on powerpc-linux....Efraim Flashner 2022-07-12gnu: sbcl: Fix building on armhf-linux....Efraim Flashner 2022-07-08gnu: sbcl: Remove Coreutils reference from closure....Pierre Neidhardt 2022-07-06gnu: txr: Install vim syntax files....Efraim Flashner 2022-07-06gnu: txr: Update to 278....Paul A. Patience 2022-07-03gnu: sbcl: Disable SB-SIMD module....Guillaume Le Vaillant 2022-06-30gnu: sbcl: Enable sb-gmp, sb-mpfr and install shared library....Pierre Neidhardt 2022-06-30gnu: sbcl: Fix build on some architectures....Guillaume Le Vaillant 2022-06-30gnu: sbcl: Update to 2.2.6....Guillaume Le Vaillant 2022-06-23gnu: janet: Update to 1.23.0....jgart 2022-06-13gnu: txr: Update to 277....Guillaume Le Vaillant 2022-05-22gnu: sbcl: Improve reproducilbility....Guillaume Le Vaillant 2022-04-18gnu: janet: Update to 1.21.1....jgart 2022-03-25gnu: txr: Update to 274....Guillaume Le Vaillant 2022-03-13gnu: janet: Update to 1.20.0....jgart 2022-03-11gnu: ecl: Run tests conditionally and please lint....Maxime Devos 2022-03-03gnu: sbcl: Update to 2.2.2....Guillaume Le Vaillant 2022-01-16gnu: janet: Use G-expressions....Tobias Geerinckx-Rice 2022-01-16gnu: janet: Update to 1.19.2....Tobias Geerinckx-Rice 2022-01-07gnu: txr: Update to 273....Tobias Geerinckx-Rice 2022-01-07gnu: txr: Remove input labels....Tobias Geerinckx-Rice 2021-12-30gnu: Remove leading article from synopsis....Vagrant Cascadian 2021-12-29gnu: buildapp: Fix trailing whitespace in description....Vagrant Cascadian 2021-12-23gnu: gcl: Avoid referencing GCC from the top-level....Marius Bakke