aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;; 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
;;;
;;; 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 installer hardware)
  #:use-module (gnu build linux-modules)
  #:use-module (guix i18n)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-71)
  #:export (unsupported-pci-device?
            pci-device-description))

(define %unsupported-linux-modules
  ;; List of Linux modules that are useless without non-free firmware.
  ;;
  ;; Currently only drivers for PCI devices are listed.  USB devices such as
  ;; "btintel" would require support to list USB devices and read the USB
  ;; device ID database.  Punt for now as this is usually less critical.
  ;;
  ;; This list is currently manually maintained based on information on
  ;; non-free firmware available from
  ;; <https://packages.debian.org/search?keywords=firmware&searchon=names&suite=stable&section=all>.
  '(;; WiFi.
    "brcmfmac"
    "ipw2100"
    "ipw2200"
    "iwlwifi"
    "mwl8k"
    "rtl8188ee"
    "rtl818x_pci"
    "rtl8192ce"
    "rtl8192de"
    "rtl8192ee"

    ;; Ethernet.
    "bnx2"
    "bnx2x"
    "liquidio"

    ;; Graphics.
    "amdgpu"
    "radeon"

    ;; Multimedia.
    "ivtv"))

(define unsupported-pci-device?
  ;; Arrange to load the module alias database only once.
  (let ((aliases (delay (known-module-aliases))))
    (lambda (device)
      "Return true if DEVICE is known to not be supported by free software."
      (any (lambda (module)
             (member module %unsupported-linux-modules))
           (matching-modules (pci-device-module-alias device)
                             (force aliases))))))

(define (pci-device-description pci-database)
  "Return a procedure that, given a PCI device, returns a string describing
it."
  (define (with-fallback lookup)
    (lambda (vendor-id id)
      (let ((vendor name (lookup vendor-id id)))
        (values (or vendor (number->string vendor-id 16))
                (or name (number->string id 16))))))

  (define pci-lookup
    (with-fallback (load-pci-device-database pci-database)))

  (lambda (device)
    (let ((vendor name (pci-lookup (pci-device-vendor device)
                                   (pci-device-id device))))
      (if (network-pci-device? device)
          ;; TRANSLATORS: The two placeholders are the manufacturer
          ;; and name of a PCI device.
          (format #f (G_ "~a ~a (networking device)")
                  vendor name)
          (string-append vendor " " name)))))
gt;. * guix/import/snix.scm, guix/scripts/import/nix.scm, tests/snix.scm: Remove. * Makefile.am (MODULES, SCM_TESTS): Remove them. * guix/scripts/import.scm (importers): Remove "nix". * build-aux/test-env.in: Remove NIXPKGS variable. * configure.ac: Remove '--with-nixpkgs' option. * doc/guix.texi (Invoking guix import): Remove bit about "guix import nix". * etc/completion/fish/guix.fish: Likewise. Ludovic Courtès 2021-04-23build: Add a check for Guile-Lib....* configure.ac: Check if the Guile-Lib module is present and recent enough and warn in case it isn't. Maxim Cournoyer 2021-03-17maint: Check whether Guile-zlib is recent enough....This is a followup to a04aef2430645357d7796969d4b6453478ff8a3f. * m4/guix.m4 (GUIX_CHECK_GUILE_ZLIB): New macro. * configure.ac: Use it when checking for Guile-zlib. Ludovic Courtès 2021-02-04build: Add '--with-channel-commit' and related configure flags....Partially fixes <https://bugs.gnu.org/45896>. * m4/guix.m4 (GUIX_CHANNEL_METADATA): New macro. * configure.ac: Use it. * guix/config.scm.in (%channel-metadata): Adjust accordingly. Ludovic Courtès 2020-12-27maint: Remove unused '--with-nix-prefix' configure option....* configure.ac: Remove '--with-nix-prefix' and 'NIX_PREFIX' variable. * Makefile.am (AM_DISTCHECK_CONFIGURE_FLAGS): Remove '--with-nix-prefix'. Ludovic Courtès 2020-12-19maint: Require Guile >= 2.2.6....* configure.ac: For Guile 2.2, require 2.2.6 or later. * guix/gexp.scm (define-syntax-parameter-once): Remove. Use 'define-syntax-parameter' instead. * guix/mnoads.scm: Likewise. * guix/inferior.scm (proxy)[select*]: Remove. * guix/scripts/publish.scm <top level>: Remove replacement for (@@ (web http) read-header-line). * guix/store/deduplication.scm (counting-wrapper-port): Remove. (nar-sha256): Call 'port-position' on PORT to compute SIZE. Ludovic Courtès 2020-12-11maint: Avoid macros obsolete in Autoconf 2.70....* configure.ac: Require Autoconf 2.69. Use 'AS_HELP_STRING' instead of 'AC_HELP_STRING'. * m4/guix.m4: Likewise. * config-daemon.ac: Use 'AC_CONFIG_HEADERS' instead of the singular variant. Ludovic Courtès 2020-11-29Make "guile-avahi" dependency optional....* configure.ac (HAVE_GUILE_AVAHI): New conditional. * Makefile.am (MODULES): Add "guix/avahi.scm" and "guix/scripts/discover.scm" if HAVE_GUILE_AVAHI is set. * guix/scripts/publish.scm: Autoload (guix avahi). * guix/scripts/substitute.scm: Autoload (guix scripts discovery). Mathieu Othacehe 2020-11-29Add Avahi support....* guix/avahi.scm: New file. * Makefile.am (MODULES): Add it. * configure.ac: Add Guile-Avahi dependency. * doc/guix.texi (Requirements): Document it. * gnu/packages/package-management.scm (guix)[native-inputs]: Add "guile-avahi", [propagated-inputs]: ditto. * guix/self.scm (specification->package): Add guile-avahi. (compiled-guix): Ditto. Mathieu Othacehe