;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 Ricardo Wurmus ;;; Copyright © 2015, 2016 Ludovic Courtès ;;; Copyright © 2015, 2016 Efraim Flashner ;;; Copyright © 2016 Danny Milosavljevic ;;; Copyright © 2017 Leo Famulari ;;; ;;; 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 . (define-module (gnu packages cups) #:use-mo
aboutsummaryrefslogtreecommitdiff
blob: 45b4995574a5ff56dd7fa7d8b4006e15986c05d3 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
;; -*- mode: scheme; -*-
;; This is an operating system configuration template
;; for a "bare bones" setup, with no X11 display server.

(use-modules (gnu))
(use-service-modules networking ssh)
(use-package-modules screen ssh)

(operating-system
  (host-name "komputilo")
  (timezone "Europe/Berlin")
  (locale "en_US.utf8")

  ;; Boot in "legacy" BIOS mode, assuming /dev/sdX is the
  ;; target hard disk, and "my-root" is the label of the target
  ;; root file system.
  (bootloader (bootloader-configuration
                (bootloader grub-bootloader)
                (targets '("/dev/sdX"))))
  ;; It's fitting to support the equally bare bones ‘-nographic’
  ;; QEMU option, which also nicely sidesteps forcing QWERTY.
  (kernel-arguments (list "console=ttyS0,115200"))
  (file-systems (cons (file-system
                        (device (file-system-label "my-root"))
                        (mount-point "/")
                        (type "ext4"))
                      %base-file-systems))

  ;; This is where user accounts are specified.  The "root"
  ;; account is implicit, and is initially created with the
  ;; empty password.
  (users (cons (user-account
                (name "alice")
                (comment "Bob's sister")
                (group "users")

                ;; Adding the account to the "wheel" group
                ;; makes it a sudoer.  Adding it to "audio"
                ;; and "video" allows the user to play sound
                ;; and access the webcam.
                (supplementary-groups '("wheel"
                                        "audio" "video")))
               %base-user-accounts))

  ;; Globally-installed packages.
  (packages (cons screen %base-packages))

  ;; Add services to the baseline: a DHCP client and
  ;; an SSH server.
  (services (append (list (service dhcp-client-service-type)
                          (service openssh-service-type
                                   (openssh-configuration
                                    (openssh openssh-sans-x)
                                    (port-number 2222))))
                    %base-services)))
TDIR@") "INITDIR = @prefix@/@INITDIR@") (("/bin/sh") (which "sh"))))) (add-before 'build 'patch-tests (lambda _ (substitute* "test/ippserver.c" (("# else /\\* HAVE_AVAHI \\*/") "#elif defined(HAVE_AVAHI)"))))))) (native-inputs `(("pkg-config" ,pkg-config))) (inputs `(("zlib" ,zlib) ("gnutls" ,gnutls))) (home-page "https://www.cups.org") (synopsis "The Common Unix Printing System") (description "CUPS is a printing system that uses the Internet Printing Protocol (IPP). It provides System V and BSD command-line interfaces, as well as a Web interface and a C programming interface to manage printers and print jobs. It supports printing to both local (parallel, serial, USB) and networked printers, and printers can be shared from one computer to another. Internally, CUPS uses PostScript Printer Description (PPD) files to describe printer capabilities and features and a wide variety of generic and device-specific programs to convert and print many types of files.") (license license:gpl2))) (define-public cups (package (inherit cups-minimal) (name "cups") (arguments `(;; Three tests fail: ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6: ;; Get-Jobs Operation" ;; * test of number of error/warning messages, probably related to a ;; missing font. #:tests? #f #:configure-flags '("--disable-launchd" "--disable-systemd") #:phases (modify-phases %standard-phases (add-before 'configure 'patch-makedefs (lambda _ (substitute* "Makedefs.in" (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@") (("/bin/sh") (which "sh"))))) (add-before 'check 'patch-tests (lambda _ (let ((filters (assoc-ref %build-inputs "cups-filters")) (catpath (string-append (assoc-ref %build-inputs "coreutils") "/bin/")) (testdir (string-append (getcwd) "/tmp/"))) (mkdir testdir) (substitute* "test/run-stp-tests.sh" ((" *BASE=/tmp/") (string-append "BASE=" testdir)) ;; allow installation of filters from output dir and from ;; cups-filters (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter") (string-append "for dir in " (assoc-ref %outputs "out") "/lib/cups/filter " filters "/lib/cups/filter")) ;; check for charsets in cups-filters output (("/usr/share/cups/charsets") (string-append filters "/share/cups/charsets")) ;; install additional required filters (("instfilter texttopdf texttopdf pdf") (string-append "instfilter texttopdf texttopdf pdf;" "instfilter imagetoraster imagetoraster raster;" "instfilter gstoraster gstoraster raster;" "instfilter urftopdf urftopdf pdf;" "instfilter rastertopdf rastertopdf pdf;" "instfilter pstopdf pstopdf pdf")) ;; specify location of lpstat binary (("description=\"`lpstat -l") "description=\"`../systemv/lpstat -l") ;; patch shebangs of embedded scripts (("#!/bin/sh") (string-append "#!" (which "sh"))) ;; also link mime definitions from cups-filters ;; to enable the additional filters for the test suite (("ln -s \\$root/conf/mime\\.types") (string-append "ln -s " filters "/share/cups/mime/cupsfilters.types $BASE/share/mime; " "ln -s $root/conf/mime.types")) (("ln -s \\$root/conf/mime\\.convs") (string-append "ln -s " filters "/share/cups/mime/cupsfilters.convs $BASE/share/mime; " "ln -s $root/conf/mime.convs"))) ;; fix search path for "cat" (substitute* "cups/testfile.c" (("cupsFileFind\\(\"cat\", \"/bin\"") (string-append "cupsFileFind(\"cat\", \"" catpath "\"")) (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"") (string-append "cupsFileFind(\"cat\", \"" catpath "\"")))))) (add-after 'install 'install-cups-filters-symlinks (lambda* (#:key inputs outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) (cups-filters (assoc-ref inputs "cups-filters"))) ;; charsets (symlink (string-append cups-filters "/share/cups/charsets") (string-append out "/share/charsets")) ;; mime types, driver file, ppds (for-each (lambda (f) (symlink (string-append cups-filters f) (string-append out f))) '("/share/cups/mime/cupsfilters.types" "/share/cups/mime/cupsfilters.convs" "/share/cups/drv/cupsfilters.drv" "/share/ppd")) ;; filters (for-each (lambda (f) (symlink f (string-append out "/lib/cups/filter" (basename f)))) (find-files (string-append cups-filters "/lib/cups/filter"))) ;; backends (for-each (lambda (f) (symlink (string-append cups-filters f) (string-append out "/lib/cups/backend/" (basename f)))) '("/lib/cups/backend/parallel" "/lib/cups/backend/serial")) ;; banners (let ((banners "/share/cups/banners")) (delete-file-recursively (string-append out banners)) (symlink (string-append cups-filters banners) (string-append out banners))) ;; assorted data (let ((data "/share/cups/data")) (delete-file-recursively (string-append out data)) (symlink (string-append cups-filters data) (string-append out data))))))))) (inputs `(("avahi" ,avahi) ("gnutls" ,gnutls) ("cups-filters" ,cups-filters) ("zlib" ,zlib))))) (define-public hplip (package (name "hplip") (version "3.16.11") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/hplip/hplip/" version "/hplip-" version ".tar.gz")) (sha256 (base32 "094vkyr0rjng72m13dgr824cdl7q20x23qjxzih4w7l9njn0rqpn")))) (build-system gnu-build-system) (home-page "http://hplipopensource.com/") (synopsis "HP Printer Drivers") (description "Hewlett-Packard Printer Drivers and PPDs.") ;; The 'COPYING' file lists directories where each of these 3 licenses ;; applies. (license (list license:gpl2+ license:bsd-3 license:expat)) ;; TODO install apparmor profile files eventually. (arguments `(#:configure-flags `("--disable-network-build" ,(string-append "--prefix=" (assoc-ref %outputs "out")) ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc") ;; Disable until mime.types merging works (FIXME). "--disable-fax-build" "--enable-hpcups-install" "--enable-new-hpcups" "--enable-cups_ppd_install" "--enable-cups_drv_install" ;; TODO add foomatic drv install eventually. ;; TODO --enable-policykit eventually. ,(string-append "--with-cupsfilterdir=" (assoc-ref %outputs "out") "/lib/cups/filter") ,(string-append "--with-cupsbackenddir=" (assoc-ref %outputs "out") "/lib/cups/backend") ,(string-append "--with-icondir=" (assoc-ref %outputs "out") "/share/applications") ,(string-append "--with-systraydir=" (assoc-ref %outputs "out") "/etc/xdg")) #:imported-modules ((guix build python-build-system) ,@%gnu-build-system-modules) #:modules ((guix build gnu-build-system) (guix build utils) ((guix build python-build-system) #:prefix python:)) #:phases (modify-phases %standard-phases (add-after 'unpack 'fix-hard-coded-file-names (lambda* (#:key inputs outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) ;; FIXME: use merged ppds (I think actually only ;; drvs need to be merged). (cupsdir (assoc-ref inputs "cups-minimal"))) (substitute* "base/g.py" (("'/usr/share;[^']*'") (string-append "'" cupsdir "/share'")) (("'/etc/hp/hplip.conf'") (string-append "'" out "/etc/hp/hplip.conf" "'"))) (substitute* "Makefile.in" (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ") ;; FIXME Use beginning-of-word in regexp. (("[[:blank:]]plugin\\.py[[:blank:]]") " ") (("/usr/include/libusb-1.0") (string-append (assoc-ref inputs "libusb") "/include/libusb-1.0")) (("^\tinstall-dist_hplip_stateDATA") ;; Remove dependencies on ;; 'install-dist_hplip_stateDATA' so we don't bail ;; out while trying to create /var/lib/hplip. "\t") (("hplip_confdir = /etc/hp") ;; This is only used for installing the default config. (string-append "hplip_confdir = " out "/etc/hp")) (("halpredir = /usr/share/hal/fdi/preprobe/10osvendor") ;; Note: We don't use hal. (string-append "halpredir = " out "/share/hal/fdi/preprobe/10osvendor")) (("rulesdir = /etc/udev/rules.d") ;; udev rules will be merged by base service. (string-append "rulesdir = " out "/lib/udev/rules.d")) (("rulessystemdir = /usr/lib/systemd/system") ;; We don't use systemd. (string-append "rulessystemdir = " out "/lib/systemd/system")) (("/etc/sane.d") (string-append out "/etc/sane.d")))))) ;; Wrap bin/* so that the Python libs are found. (add-after 'install 'wrap-binaries (assoc-ref python:%standard-phases 'wrap))))) ;; Python3 support is available starting from hplip@3.15.2. (inputs `(("libjpeg" ,libjpeg) ("cups-minimal" ,cups-minimal) ("libusb" ,libusb) ("sane-backends" ,sane-backends-minimal) ("dbus" ,dbus) ("python-wrapper" ,python-wrapper) ("python" ,python) ;; TODO: Make hp-setup find python-dbus. ("python-dbus" ,python-dbus))) (native-inputs `(("pkg-config" ,pkg-config)))))