aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019-2021, 2024 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
;;; 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 (test-swh)
  #:use-module (guix swh)
  #:use-module (guix base32)
  #:use-module (guix tests http)
  #:use-module (web response)
  #:use-module (srfi srfi-19)
  #:use-module (srfi srfi-64)
  #:use-module (ice-9 match))

;; Test the JSON mapping machinery used in (guix swh).

(define %origin
  "{ \"origin_visits_url\": \"/visits/42\",
     \"type\": \"git\",
     \"url\": \"http://example.org/guix.git\" }")

(define %visits
  ;; A single visit where 'snapshot_url' is null.
  ;; See <https://bugs.gnu.org/45615>.
  "[ {
    \"origin\": \"https://github.com/Genivia/ugrep\",
    \"visit\": 1,
    \"date\": \"2020-05-17T21:43:45.422977+00:00\",
    \"status\": \"ongoing\",
    \"snapshot\": null,
    \"metadata\": {},
    \"type\": \"git\",
    \"origin_visit_url\": \"https://archive.softwareheritage.org/api/1/origin/https://github.com/Genivia/ugrep/visit/1/\",
    \"snapshot_url\": null
  } ]")

(define %directory-entries
  "[ { \"name\": \"one\",
       \"type\": \"regular\",
       \"length\": 123,
       \"dir_id\": 1 },
     { \"name\": \"two\",
       \"type\": \"regular\",
       \"length\": 456,
       \"dir_id\": 2 } ]")

(define %external-id
  "{ \"extid_type\": \"nar-sha256\",
     \"extid\":
\"0b56ba94c2b83b8f74e3772887c1109135802eb3e8962b628377987fe97e1e63\",
     \"version\": 0,
     \"target\": \"swh:1:dir:84a8b34591712c0a90bab0af604188bcd1fe3153\",
     \"target_url\":
\"https://archive.softwareheritage.org/swh:1:dir:84a8b34591712c0a90bab0af604188bcd1fe3153\"
   }")

(define-syntax-rule (with-json-result str exp ...)
  (with-http-server `((200 ,str))
    (parameterize ((%swh-base-url (%local-url)))
      exp ...)))

(test-begin "swh")

(test-equal "lookup-origin"
  (list "git" "http://example.org/guix.git")
  (with-json-result %origin
    (let ((origin (lookup-origin "http://example.org/guix.git")))
      (list (origin-type origin)
            (origin-url origin)))))

(test-equal "lookup-origin, not found"
  #f
  (with-http-server `((404 "Nope."))
    (parameterize ((%swh-base-url (%local-url)))
      (lookup-origin "http://example.org/whatever"))))

(test-equal "origin-visit, no snapshots"
  '("https://github.com/Genivia/ugrep"
    "2020-05-17T21:43:45Z"
    #f)                                      ;see <https://bugs.gnu.org/45615>
  (with-http-server `((200 ,%origin)
                      (200 ,%visits))
    (parameterize ((%swh-base-url (%local-url)))
      (let ((origin (lookup-origin "http://example.org/whatever")))
        (match (origin-visits origin)
          ((visit)
           (list (visit-origin visit)
                 (date->string (visit-date visit) "~4")
                 (visit-snapshot-url visit))))))))

(test-equal "lookup-directory"
  '(("one" 123) ("two" 456))
  (with-json-result %directory-entries
    (map (lambda (entry)
           (list (directory-entry-name entry)
                 (directory-entry-length entry)))
         (lookup-directory "123"))))

(test-equal "lookup-origin-revision"
  '("cd86c72084993d9ef26fc9e24b73cea612b8c97b"
    "d173c707ee88e3c89401ad77fafa65fcd9e9f5be")
  (let ()
    ;; Make sure that 'lookup-origin-revision' does the job, and in particular
    ;; that it doesn't stop until it has found an actual revision:
    ;; 'git-checkout visits point to directories instead of revisions.
    ;; See <https://issues.guix.gnu.org/69070>.
    (define visits
      ;; Two visits of differing types: the first visit (type 'git-checkout')
      ;; points to a directory, the second one (type 'git') points to a
      ;; revision.
      "[ {
    \"origin\": \"https://example.org/repo.git\",
    \"visit\": 1,
    \"type\": \"git-checkout\",
    \"date\": \"2020-05-17T21:43:45.422977+00:00\",
    \"status\": \"full\",
    \"metadata\": {},
    \"type\": \"git-checkout\",
    \"origin_visit_url\": \"/visit/42\",
    \"snapshot_url\": \"/snapshot/1\"
  }, {
    \"origin\": \"https://example.org/repo.git\",
    \"visit\": 2,
    \"type\": \"git\",
    \"date\": \"2020-05-17T21:43:49.422977+00:00\",
    \"status\": \"full\",
    \"metadata\": {},
    \"type\": \"git\",
    \"origin_visit_url\": \"/visit/41\",
    \"snapshot_url\": \"/snapshot/2\"
  } ]")
    (define snapshot-for-git-checkout
      "{ \"id\": 42,
         \"branches\": { \"1.3.2\": {
           \"target\": \"e4a4be18fae8d9c6528abff3bc9088feb19a76c7\",
           \"target_type\": \"directory\",
           \"target_url\": \"/directory/e4a4be18fae8d9c6528abff3bc9088feb19a76c7\"
         }}
       }")
    (define snapshot-for-git
      "{ \"id\": 42,
         \"branches\": { \"1.3.2\": {
           \"target\": \"e4a4be18fae8d9c6528abff3bc9088feb19a76c7\",
           \"target_type\": \"revision\",
           \"target_url\": \"/revision/e4a4be18fae8d9c6528abff3bc9088feb19a76c7\"
         }}
       }")
    (define revision
      "{ \"author\": {},
         \"committer\": {},
         \"committer_date\": \"2018-05-17T21:43:49.422977+00:00\",
         \"date\": \"2018-05-17T21:43:49.422977+00:00\",
         \"directory\": \"d173c707ee88e3c89401ad77fafa65fcd9e9f5be\",
         \"directory_url\": \"/directory/d173c707ee88e3c89401ad77fafa65fcd9e9f5be\",
         \"id\": \"cd86c72084993d9ef26fc9e24b73cea612b8c97b\",
         \"merge\": false,
         \"message\": \"Fix.\",
         \"parents\": [],
         \"type\": \"what type?\"
       }")

    (with-http-server `((200 ,%origin)
                        (200 ,visits)
                        (200 ,snapshot-for-git-checkout)
                        (200 ,snapshot-for-git)
                        (200 ,revision))
      (parameterize ((%swh-base-url (%local-url)))
        (let ((revision (lookup-origin-revision "https://example.org/repo.git"
                                                "1.3.2")))
          (list (revision-id revision)
                (revision-directory revision)))))))

(test-equal "lookup-directory-by-nar-hash"
  "swh:1:dir:84a8b34591712c0a90bab0af604188bcd1fe3153"
  (with-json-result %external-id
    (lookup-directory-by-nar-hash
     (nix-base32-string->bytevector
      "0qqygvlpz63phdi2p5p8ncp80dci230qfa3pwds8yfxqqaablmhb")
     'sha256)))

(test-equal "rate limit reached"
  3000000000
  (let ((too-many (build-response
                   #:code 429
                   #:reason-phrase "Too many requests"

                   ;; Pretend we've reached the limit and it'll be reset in
                   ;; June 2065.
                   #:headers '((x-ratelimit-remaining . "0")
                               (x-ratelimit-reset . "3000000000")))))
    (with-http-server `((,too-many "Too bad."))
      (parameterize ((%swh-base-url (%local-url)))
        (catch 'swh-error
          (lambda ()
            (lookup-origin "http://example.org/guix.git"))
          (lambda (key url method response)
            ;; Ensure the reset time was recorded.
            (@@ (guix swh) %general-rate-limit-reset-time)))))))

(test-assert "%allow-request? and request-rate-limit-reached?"
  ;; Here we test two things: that the rate limit set above is in effect and
  ;; that %ALLOW-REQUEST? is called, and that 'request-rate-limit-reached?'
  ;; returns true.
  (let* ((key (gensym "skip-request"))
         (skip-if-limit-reached
          (lambda (url method)
            (or (not (request-rate-limit-reached? url method))
                (throw key #t)))))
    (parameterize ((%allow-request? skip-if-limit-reached))
      (catch key
        (lambda ()
          (lookup-origin "http://example.org/guix.git")
          #f)
        (const #t)))))

(test-end "swh")

;; Local Variables:
;; eval: (put 'with-json-result 'scheme-indent-function 1)
;; eval: (put 'with-http-server 'scheme-indent-function 1)
;; End:

uix build-system go) #:use-module (guix build-system meson) #:use-module (guix build-system pyproject) #:use-module (guix build-system python) #:use-module (guix build-system qt) #:use-module (guix build-system trivial) #:use-module (guix build-system linux-module) #:use-module (guix download) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix gexp) #:use-module (guix store) #:use-module (guix monads) #:use-module (guix utils) #:use-module (guix deprecation) ;for libcap/next #:use-module (srfi srfi-1) #:use-module (srfi srfi-2) #:use-module (srfi srfi-26) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:export (customize-linux make-defconfig)) ;;; ;;; Linux kernel customization functions. ;;; (define* (customize-linux #:key name (linux linux-libre) source defconfig (configs "") extra-version) "Make a customized Linux package NAME derived from the LINUX package. If NAME is not given, then it defaults to the same name as the LINUX package. Unless SOURCE is given the source of LINUX is used. A DEFCONFIG file to be used can be given as an origin, as a file-like object (file-append, local-file etc.), or as a string with the name of a defconfig file available in the Linux sources. If DEFCONFIG is not given, then a defconfig file will be saved from the LINUX package configuration. Additional CONFIGS will be used to modify the given or saved defconfig, which will finally be used to build Linux. CONFIGS can be a list of strings, with one configuration per line. The usual defconfig syntax has to be used, but there is a special extension to ease the removal of configurations. Comment lines are supported as well. Here is an example: '(;; This string defines the version tail in 'uname -r'. \"CONFIG_LOCALVERSION=\\\"-handcrafted\\\" ;; This '# CONFIG_... is not set' syntax has to match exactly! \"# CONFIG_BOOT_CONFIG is not set\" \"CONFIG_NFS_SWAP=y\" ;; This is a multiline configuration: \"CONFIG_E1000=y # This is a comment, below follows an extension to unset a configuration: CONFIG_CMDLINE_EXTEND\") A string of configurations instead of a list of configuration strings is also possible. EXTRA-VERSION can be a string overwriting the EXTRAVERSION setting of the LINUX package, after being prepended by a hyphen. It will be visible in the output of 'uname -r' behind the Linux version numbers." (package (inherit linux) (name (or name (package-name linux))) (source (or source (package-source linux))) (arguments (substitute-keyword-arguments (package-arguments linux) ((#:imported-modules imported-modules %default-gnu-imported-modules) `((guix build kconfig) ,@imported-modules)) ((#:modules modules) `((guix build kconfig) ,@modules)) ((#:phases phases) #~(modify-phases #$phases (replace 'configure (lambda* (#:key inputs #:allow-other-keys #:rest arguments) (setenv "EXTRAVERSION" #$(and extra-version (not (string-null? extra-version)) (string-append "-" extra-version))) (let* ((configs (string-append "arch/" #$(linux-srcarch) "/configs/")) (guix_defconfig (string-append configs "guix_defconfig"))) #$(cond ((not defconfig) #~(begin ;; Call the original 'configure phase. (apply (assoc-ref #$phases 'configure) arguments) ;; Save a defconfig file. (invoke "make" "savedefconfig") ;; Move the saved defconfig to the proper location. (rename-file "defconfig" guix_defconfig))) ((string? defconfig) ;; Use another existing defconfig from the Linux sources. #~(rename-file (string-append configs #$defconfig) guix_defconfig)) (else ;; Copy the defconfig input to the proper location. #~(copy-file #$defconfig guix_defconfig))) (chmod guix_defconfig #o644) (modify-defconfig guix_defconfig '#$configs) (invoke "make" "guix_defconfig") (verify-config ".config" guix_defconfig)))))))))) (define (make-defconfig uri sha256-as-base32) (origin (method url-fetch) (uri uri) (sha256 (base32 sha256-as-base32)))) (define (linux-srcarch) "Return the linux SRCARCH name, which is set in the toplevel Makefile of Linux and denotes the architecture-specific directory name below arch/ in its source code. Some few architectures share a common folder. It resembles the definition of SRCARCH based on ARCH in the Makefile and may be used to place a defconfig file in the proper path." (let ((linux-arch (platform-linux-architecture (lookup-platform-by-target-or-system (or (%current-target-system) (%current-system)))))) (match linux-arch ("i386" "x86") ("x86_64" "x86") ("sparc32" "sparc") ("sparc64" "sparc") ("sh64" "sh") (_ linux-arch)))) (define-public (system->defconfig system) "Some systems (notably powerpc-linux) require a special target for kernel defconfig. Return the appropriate Make target if applicable, otherwise return \"defconfig\"." (cond ((string-prefix? "powerpc-" system) "pmac32_defconfig") ((string-prefix? "powerpc64-" system) "ppc64_defconfig") ((string-prefix? "powerpc64le-" system) "ppc64_defconfig") (else "defconfig"))) ;;; ;;; Kernel source code deblobbing. ;;; (define (linux-libre-deblob-scripts version gnu-revision deblob-hash deblob-check-hash) (list (version-major+minor version) (origin (method url-fetch) (uri (string-append "https://linux-libre.fsfla.org" "/pub/linux-libre/releases/" version "-" gnu-revision "/" "deblob-" (version-major+minor version))) (file-name (string-append "linux-libre-deblob-" version "-" gnu-revision)) (sha256 deblob-hash)) (origin (method url-fetch) (uri (string-append "https://linux-libre.fsfla.org" "/pub/linux-libre/releases/" version "-" gnu-revision "/" "deblob-check")) (file-name (string-append "linux-libre-deblob-check-" version "-" gnu-revision)) (sha256 deblob-check-hash)))) ;; XXXX: Workaround 'snippet' limitations (define computed-origin-method (@@ (guix packages) computed-origin-method)) (define (make-linux-libre-source version upstream-source deblob-scripts) "Return a 'computed' origin that generates a Linux-libre tarball from the corresponding UPSTREAM-SOURCE (an origin), using the given DEBLOB-SCRIPTS." (match deblob-scripts ((deblob-version (? origin? deblob) (? origin? deblob-check)) (unless (string=? deblob-version (version-major+minor version)) ;; The deblob script cannot be expected to work properly on a ;; different version (major+minor) of Linux, even if no errors ;; are signaled during execution. (error "deblob major+minor version mismatch")) (origin (method computed-origin-method) (file-name (string-append "linux-libre-" version "-guix.tar.xz")) (sha256 #f) (uri (delay (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils) (srfi srfi-1) (ice-9 match) (ice-9 ftw)) (setvbuf (current-output-port) 'line) (let ((dir (string-append "linux-" #$version))) (mkdir "/tmp/bin") (set-path-environment-variable "PATH" '("bin") (list "/tmp" #+(canonical-package bash) #+(canonical-package coreutils) #+(canonical-package diffutils) #+(canonical-package findutils) #+(canonical-package patch) #+(canonical-package xz) #+(canonical-package sed) #+(canonical-package grep) #+(canonical-package bzip2) #+(canonical-package gzip) #+(canonical-package tar) #+(canonical-package gawk) #+python-wrapper)) (with-directory-excursion "/tmp/bin" (copy-file #+deblob "deblob") (chmod "deblob" #o755) (substitute* "deblob" (("/bin/sh") (which "sh"))) (copy-file #+deblob-check "deblob-check") (chmod "deblob-check" #o755) (substitute* "deblob-check" (("/bin/sh") (which "sh")) (("/bin/sed") (which "sed")) (("/usr/bin/python") (which "python")))) (if (file-is-directory? #+upstream-source) (begin (format #t "Copying upstream linux source...~%") (invoke "cp" "--archive" #+upstream-source dir) (invoke "chmod" "--recursive" "u+w" dir)) (begin (format #t "Unpacking upstream linux tarball...~%") (invoke "tar" "xf" #$upstream-source) (match (scandir "." (lambda (name) (and (not (member name '("." ".."))) (file-is-directory? name)))) ((unpacked-dir) (unless (string=? dir unpacked-dir) (rename-file unpacked-dir dir))) (dirs (error "multiple directories found" dirs))))) (with-directory-excursion dir (format #t "Running deblob script...~%") (invoke "/tmp/bin/deblob")) (format #t "~%Packing new Linux-libre tarball...~%") (invoke "tar" "cvfa" #$output ;; Avoid non-determinism in the archive. "--mtime=@0" "--owner=root:0" "--group=root:0" "--sort=name" "--hard-dereference" dir) (format #t "~%Scanning the generated tarball for blobs...~%") (invoke "/tmp/bin/deblob-check" "--use-awk" "--list-blobs" #$output)))))))))) ;;; ;;; Kernel sources. ;;; (define (linux-libre-urls version gnu-revision) "Return a list of URLs for Linux-Libre VERSION." (list (string-append "https://linux-libre.fsfla.org/pub/linux-libre/releases/" version "-" gnu-revision "/linux-libre-" version "-" gnu-revision ".tar.xz") ;; XXX: Work around <http://bugs.gnu.org/14851>. (string-append "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-" version "-" gnu-revision ".tar.xz") ;; Maybe this URL will become valid eventually. (string-append "mirror://gnu/linux-libre/" version "-" gnu-revision "/linux-libre-" version "-" gnu-revision ".tar.xz"))) (define (%upstream-linux-source version hash) (origin (method url-fetch) (uri (string-append "mirror://kernel.org" "/linux/kernel/v" (version-major version) ".x/" "linux-" version ".tar.xz")) (sha256 hash))) ;; The current "stable" kernels. That is, the most recently released major ;; versions that are still supported upstream. (define-public linux-libre-6.10-version "6.10.7") (define-public linux-libre-6.10-gnu-revision "gnu") (define deblob-scripts-6.10 (linux-libre-deblob-scripts linux-libre-6.10-version linux-libre-6.10-gnu-revision (base32 "1j43v1z4g1f681wvna2dh9vxaz0pgni0wchbh1xhyhhfcqbm1f47") (base32 "1zmgsgzrcsjzjzhgb12drc0f42ag8xak6z7zzx324f0wrf4i67zf"))) (define-public linux-libre-6.10-pristine-source (let ((version linux-libre-6.10-version) (hash (base32 "1adkbn6dqbpzlr3x87a18mhnygphmvx3ffscwa67090qy1zmc3ch"))) (make-linux-libre-source version (%upstream-linux-source version hash) deblob-scripts-6.10))) ;; The "longterm" kernels — the older releases with long-term upstream support. ;; Here are the support timelines: ;; <https://www.kernel.org/category/releases.html> (define-public linux-libre-6.6-version "6.6.48") (define-public linux-libre-6.6-gnu-revision "gnu") (define deblob-scripts-6.6 (linux-libre-deblob-scripts linux-libre-6.6-version linux-libre-6.6-gnu-revision (base32 "1a28pdl645bj4d8gac71dmwmll6a2kgd3k7gkpfvi94yqkzd9r2z") (base32 "0kpkmdmrw9bnypdd0z489smh8bbwgg1ii301g1ynqfdkzd2ca1iq"))) (define-public linux-libre-6.6-pristine-source (let ((version linux-libre-6.6-version) (hash (base32 "0a90fx0r25nkcr5b16dn1j7vwyndnshaxn6ziyviccds59xxy5kb"))) (make-linux-libre-source version (%upstream-linux-source version hash) deblob-scripts-6.6))) (define-public linux-libre-6.1-version "6.1.107") (define-public linux-libre-6.1-gnu-revision "gnu") (define deblob-scripts-6.1 (linux-libre-deblob-scripts linux-libre-6.1-version linux-libre-6.1-gnu-revision (base32 "1sf80f2i4vf888xjcn84ymn4w5ynn30ib9033zwmv7f09yvfhapy") (base32 "11jbnj0d3262grf9vkn0668kvfxifxw98ccvn81wkaykll01k5nx"))) (define-public linux-libre-6.1-pristine-source (let ((version linux-libre-6.1-version) (hash (base32 "1s5h51r41l0d3k1h9i4mya7nz53jd6i200s06w5gl49hsz8jjcpl"))) (make-linux-libre-source version (%upstream-linux-source version hash) deblob-scripts-6.1))) (define-public linux-libre-5.15-version "5.15.165") (define-public linux-libre-5.15-gnu-revision "gnu") (define deblob-scripts-5.15 (linux-libre-deblob-scripts linux-libre-5.15-version linux-libre-5.15-gnu-revision (base32 "18ac30kxg2mf2f6gk3p935hzhz2qs110jy4xwk21kblnnkskbxj8") (base32 "1l8dhfby3qx8vs8fq6yybixzrghbh03wflzwly4rq08wabcr87z8"))) (define-public linux-libre-5.15-pristine-source (let ((version linux-libre-5.15-version) (hash (base32 "1zn627gid0dik3r5k61r9ff4sz7md1jnbwiixpyllqzb5kld6vd3"))) (make-linux-libre-source version (%upstream-linux-source version hash) deblob-scripts-5.15))) (define-public linux-libre-5.10-version "5.10.224") (define-public linux-libre-5.10-gnu-revision "gnu1") (define deblob-scripts-5.10 (linux-libre-deblob-scripts linux-libre-5.10-version linux-libre-5.10-gnu-revision (base32 "1b33rkn32b923025iiz4xzxiy8y5ii9j5qk4021mg575890rl4ch") (base32 "1isiih0laz4wbivsg0pcvlgrflq3lv10fakv9lvg2b4s0yd9ybdn"))) (define-public linux-libre-5.10-pristine-source (let ((version linux-libre-5.10-version) (hash (base32 "06nivms93yjbddv3gl88m7bdrr0676nm3p12iqvsdfr4fg39kc0r"))) (make-linux-libre-source version (%upstream-linux-source version hash) deblob-scripts-5.10))) (define-public linux-libre-5.4-version "5.4.282") (define-public linux-libre-5.4-gnu-revision "gnu1") (define deblob-scripts-5.4 (linux-libre-deblob-scripts linux-libre-5.4-version linux-libre-5.4-gnu-revision (base32 "0xg5cz82k2cb0ikxvwv1hp5c3h377jkb5sd6aszvsk7hnabhk62v") (base32 "0x0xg0fcykpd117x3q0gim8jilhx922ashhckjvafxv2gk2zzjhj"))) (define-public linux-libre-5.4-pristine-source (let ((version linux-libre-5.4-version) (hash (base32 "1q3xvl4c5dlql6jh0g8kn01aljgl946gmq4ljjzvffykfq4pg0jm"))) (make-linux-libre-source version (%upstream-linux-source version hash) deblob-scripts-5.4))) (define-public linux-libre-4.19-version "4.19.320") (define-public linux-libre-4.19-gnu-revision "gnu1") (define deblob-scripts-4.19 (linux-libre-deblob-scripts linux-libre-4.19-version linux-libre-4.19-gnu-revision (base32 "0pjal2cc2f99cvw8r4icb4l24j41k48jkj6bqk7pcahzcgx33ycb") (base32 "0fgkp3v7qgqpn7l1987xcwwlrmwsbscqnxfv06p8nkavrhymrv3c"))) (define-public linux-libre-4.19-pristine-source (let ((version linux-libre-4.19-version) (hash (base32 "18a723djyq3y2jhjazwgiwqslh1yz954wb82cg7bf083n091lrwx"))) (make-linux-libre-source version (%upstream-linux-source version hash) deblob-scripts-4.19))) (define %boot-logo-patch ;; Linux-Libre boot logo featuring Freedo and a gnu. (origin (method url-fetch) (uri (string-append "http://www.fsfla.org/svn/fsfla/software/linux-libre/" "lemote/gnewsense/branches/3.16/100gnu+freedo.patch")) (sha256 (base32 "1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06")))) (define %linux-libre-arm-export-__sync_icache_dcache-patch (origin (method url-fetch) (uri (string-append "https://salsa.debian.org/kernel-team/linux" "/raw/34a7d9011fcfcfa38b68282fd2b1a8797e6834f0" "/debian/patches/bugfix/arm/" "arm-mm-export-__sync_icache_dcache-for-xen-privcmd.patch")) (file-name "linux-libre-arm-export-__sync_icache_dcache.patch") (sha256 (base32 "1ifnfhpakzffn4b8n7x7w5cps9mzjxlkcfz9zqak2vaw8nzvl39f")))) (define (source-with-patches source patches) (origin (inherit source) (patches (append (origin-patches source) patches)))) (define-public linux-libre-6.10-source (source-with-patches linux-libre-6.10-pristine-source (list %boot-logo-patch %linux-libre-arm-export-__sync_icache_dcache-patch))) (define-public linux-libre-6.6-source (source-with-patches linux-libre-6.6-pristine-source (list %boot-logo-patch %linux-libre-arm-export-__sync_icache_dcache-patch))) (define-public linux-libre-6.1-source (source-with-patches linux-libre-6.1-pristine-source (append (list %boot-logo-patch %linux-libre-arm-export-__sync_icache_dcache-patch) (search-patches "linux-libre-infodocs-target.patch")))) (define-public linux-libre-5.15-source (source-with-patches linux-libre-5.15-pristine-source (list %boot-logo-patch %linux-libre-arm-export-__sync_icache_dcache-patch))) (define-public linux-libre-5.10-source (source-with-patches linux-libre-5.10-pristine-source (list %boot-logo-patch %linux-libre-arm-export-__sync_icache_dcache-patch))) (define-public linux-libre-5.4-source (source-with-patches linux-libre-5.4-pristine-source (list %boot-logo-patch %linux-libre-arm-export-__sync_icache_dcache-patch ;; Pinebook Pro patch from linux-next, ;; can be dropped for linux-libre 5.7 (search-patch "linux-libre-support-for-Pinebook-Pro.patch")))) (define-public linux-libre-4.19-source (source-with-patches linux-libre-4.19-pristine-source (list %boot-logo-patch %linux-libre-arm-export-__sync_icache_dcache-patch))) ;;; ;;; Kernel headers. ;;; (define (make-linux-libre-headers version gnu-revision hash-string) (make-linux-libre-headers* version gnu-revision (origin (method url-fetch) (uri (linux-libre-urls version gnu-revision)) (sha256 (base32 hash-string))))) (define (make-linux-libre-headers* version gnu-revision source) (package (name "linux-libre-headers") (version version) (source source) (build-system gnu-build-system) (native-inputs `(("perl" ,perl) ,@(if (version>=? version "4.16") `(("flex" ,flex) ("bison" ,bison)) '()))) (arguments `(#:modules ((guix build gnu-build-system) (guix build utils) (srfi srfi-1) (ice-9 match)) #:phases (modify-phases %standard-phases (delete 'configure) (replace 'build (lambda _ (let ((arch ,(platform-linux-architecture (lookup-platform-by-target-or-system (or (%current-target-system) (%current-system))))) (defconfig ,(system->defconfig (or (%current-target-system) (%current-system)))) (make-target ,(if (version>=? version "5.3") "headers" "headers_check"))) (setenv "ARCH" arch) (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")) (invoke "make" defconfig) (invoke "make" "mrproper" make-target)))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) ;; Mimic the quiet_cmd_headers_install target to avoid a ;; dependency on rsync. (for-each (lambda (file) (let ((destination (string-append out "/include/" ;; Drop the 'usr/include' prefix. (match (string-split file #\/) ((_ _ path ...) (string-join path "/")))))) (format #t "`~a' -> `~a'~%" file destination) (install-file file (dirname destination)))) (find-files "usr/include" "\\.h$")) (mkdir (string-append out "/include/config")) (call-with-output-file (string-append out "/include/config/kernel.release") (lambda (p) (format p "~a-default~%" ,version))))))) #:allowed-references () #:tests? #f)) (supported-systems (delete "i586-gnu" %supported-systems)) (home-page "https://www.gnu.org/software/linux-libre/") (synopsis "GNU Linux-Libre kernel headers") (description "Headers of the Linux-Libre kernel.") (license license:gpl2))) (define-public linux-libre-headers-6.10 (make-linux-libre-headers* linux-libre-6.10-version linux-libre-6.10-gnu-revision linux-libre-6.10-source)) (define-public linux-libre-headers-6.6 (make-linux-libre-headers* linux-libre-6.6-version linux-libre-6.6-gnu-revision linux-libre-6.6-source)) (define-public linux-libre-headers-6.1 (make-linux-libre-headers* linux-libre-6.1-version linux-libre-6.1-gnu-revision linux-libre-6.1-source)) (define-public linux-libre-headers-5.15 (make-linux-libre-headers* linux-libre-5.15-version linux-libre-5.15-gnu-revision linux-libre-5.15-source)) (define-public linux-libre-headers-5.10 (make-linux-libre-headers* linux-libre-5.10-version linux-libre-5.10-gnu-revision linux-libre-5.10-source)) (define-public linux-libre-headers-5.4 (make-linux-libre-headers* linux-libre-5.4-version linux-libre-5.4-gnu-revision linux-libre-5.4-source)) (define-public linux-libre-headers-4.19 (make-linux-libre-headers* linux-libre-4.19-version linux-libre-4.19-gnu-revision linux-libre-4.19-source)) ;; The following package is used in the early bootstrap, and thus must be kept ;; stable and with minimal build requirements. (define-public linux-libre-headers-5.15.49 (make-linux-libre-headers "5.15.49" "gnu" "13zqdcm4664vh7g57sxbfrlpsxm7zrma72mxdfdz7d9yndy2gfv8")) (define-public linux-libre-headers linux-libre-headers-5.15.49) ;; linux-libre-headers-latest points to the latest headers package ;; and should be used as a dependency for packages that depend on ;; the headers. (define-public linux-libre-headers-latest linux-libre-headers-6.10) ;;; ;;; Kernel configurations. ;;; (define* (kernel-config arch #:key variant) "Return a file-like object of the Linux-Libre build configuration file for ARCH and optionally VARIANT, or #f if there is no such configuration." (let* ((name (string-append (if variant (string-append variant "-") "") (if (string=? "i386" arch) "i686" arch) ".conf")) (file (string-append "linux-libre/" name)) (config (search-auxiliary-file file))) (and config (local-file config)))) (define (default-extra-linux-options version) `(;; Make the kernel config available at /proc/config.gz ("CONFIG_IKCONFIG" . #t) ("CONFIG_IKCONFIG_PROC" . #t) ;; Debugging options. ("CONFIG_DEBUG_INFO" . #t) ;required by BTF ,@(if (version>=? version "5.1") '(("CONFIG_DEBUG_INFO_BTF" . #t)) '()) ,@(if (version>=? version "5.12") '(("CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT" . #t)) '()) ("CONFIG_DEBUG_INFO_REDUCED" . #f) ;incompatible with BTF ;; Tracing and related options. ,@(if (version>=? version "5.1") '(("CONFIG_BPF_JIT" . #t) ("CONFIG_BPF_JIT_ALWAYS_ON" . #t) ("CONFIG_BPF_SYSCALL" . #t)) '()) ,@(if (version>=? version "5.13") '(("BPF_UNPRIV_DEFAULT_OFF" . #t)) '()) ("CONFIG_NET_CLS_BPF" . m) ;classify packets based on BPF filters ("CONFIG_NET_ACT_BPF" . m) ;to execute BPF code on packets ;; Compress kernel modules via Zstd. ,(if (version>=? version "5.13") '("CONFIG_MODULE_COMPRESS_ZSTD" . #t) '("CONFIG_MODULE_COMPRESS_GZIP" . #t)) ;; Some very mild hardening. ("CONFIG_SECURITY_DMESG_RESTRICT" . #t) ;; All kernels should have NAMESPACES options enabled ("CONFIG_NAMESPACES" . #t) ("CONFIG_UTS_NS" . #t) ("CONFIG_IPC_NS" . #t) ("CONFIG_USER_NS" . #t) ("CONFIG_PID_NS" . #t) ("CONFIG_NET_NS" . #t) ;; Various options needed for elogind service: ;; https://issues.guix.gnu.org/43078 ("CONFIG_CGROUP_FREEZER" . #t) ("CONFIG_BLK_CGROUP" . #t) ("CONFIG_CGROUP_WRITEBACK" . #t) ("CONFIG_CGROUP_SCHED" . #t) ("CONFIG_CGROUP_PIDS" . #t) ("CONFIG_CGROUP_FREEZER" . #t) ("CONFIG_CGROUP_DEVICE" . #t) ("CONFIG_CGROUP_CPUACCT" . #t) ("CONFIG_CGROUP_PERF" . #t) ("CONFIG_SOCK_CGROUP_DATA" . #t) ("CONFIG_BLK_CGROUP_IOCOST" . #t) ("CONFIG_CGROUP_NET_PRIO" . #t) ("CONFIG_CGROUP_NET_CLASSID" . #t) ("CONFIG_MEMCG" . #t) ("CONFIG_MEMCG_SWAP" . #t) ("CONFIG_MEMCG_KMEM" . #t) ("CONFIG_CPUSETS" . #t) ("CONFIG_PROC_PID_CPUSET" . #t) ;; Allow disk encryption by default ("CONFIG_DM_CRYPT" . m) ;; Support zram on all kernel configs ("CONFIG_ZSWAP" . #t) ("CONFIG_ZSMALLOC" . #t) ("CONFIG_ZRAM" . m) ;; Accessibility support. ("CONFIG_ACCESSIBILITY" . #t) ("CONFIG_A11Y_BRAILLE_CONSOLE" . #t) ("CONFIG_SPEAKUP" . m) ("CONFIG_SPEAKUP_SYNTH_SOFT" . m) ;; Modules required for initrd: ("CONFIG_NET_9P" . m) ("CONFIG_NET_9P_VIRTIO" . m) ("CONFIG_VIRTIO_BLK" . m) ("CONFIG_VIRTIO_NET" . m) ("CONFIG_VIRTIO_PCI" . m) ("CONFIG_VIRTIO_BALLOON" . m) ("CONFIG_VIRTIO_MMIO" . m) ("CONFIG_FUSE_FS" . m) ("CONFIG_CIFS" . m) ("CONFIG_9P_FS" . m))) (define (config->string options) (string-join (map (match-lambda ((option . 'm) (string-append option "=m")) ((option . #t) (string-append option "=y")) ((option . #f) (string-append option "=n")) ((option . string) (string-append option "=\"" string "\""))) options) "\n")) ;;; ;;; Kernel package utilities. ;;; (define (apply-infodoc-patch? version) ;; Versions older than 5.10 have different enough build scripts that the ;; infodocs patch doesn't apply. (and (version>=? version "5.10") (not (version>=? version "6.2")))) ;patch applied upstream (define* (make-linux-libre version gnu-revision hash-string supported-systems #:key (extra-version #f) ;; A function that takes an arch and a variant, and ;; return a file-like object. See kernel-config ;; for an example. (configuration-file #f) (defconfig "defconfig") (extra-options (default-extra-linux-options version)) (patches `(,%boot-logo-patch ,@(if (apply-infodoc-patch? version) (list (search-patch "linux-libre-infodocs-target.patch")) '())))) (make-linux-libre* version gnu-revision (origin (method url-fetch) (uri (linux-libre-urls version gnu-revision)) (sha256 (base32 hash-string)) (patches patches)) supported-systems #:extra-version extra-version #:configuration-file configuration-file #:defconfig defconfig #:extra-options extra-options)) (define* (make-linux-libre* version gnu-revision source supported-systems #:key (extra-version #f) ;; A function that takes an arch and a variant. ;; See kernel-config for an example. (configuration-file #f) (defconfig "defconfig") (extra-options (default-extra-linux-options version))) (package (name (if extra-version (string-append "linux-libre-" extra-version) "linux-libre")) (version version) (source source) (supported-systems supported-systems) (build-system gnu-build-system) (arguments (list #:modules '((guix build gnu-build-system) (guix build utils) (srfi srfi-1) (srfi srfi-26) (ice-9 ftw) (ice-9 match)) #:tests? #f #:phases #~(modify-phases %standard-phases (add-after 'unpack 'patch-/bin/pwd (lambda _ (substitute* (find-files "." "^Makefile(\\.include)?$") (("/bin/pwd") "pwd")))) (add-before 'configure 'set-environment (lambda* (#:key target #:allow-other-keys) ;; Avoid introducing timestamps. (setenv "KCONFIG_NOTIMESTAMP" "1") (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH")) ;; Other variables useful for reproducibility. (setenv "KBUILD_BUILD_VERSION" "1") (setenv "KBUILD_BUILD_USER" "guix") (setenv "KBUILD_BUILD_HOST" "guix") ;; Set ARCH and CROSS_COMPILE. (let ((arch #$(platform-linux-architecture (lookup-platform-by-target-or-system (or (%current-target-system) (%current-system)))))) (setenv "ARCH" arch) (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")) (when target (setenv "CROSS_COMPILE" (string-append target "-")) (format #t "`CROSS_COMPILE' set to `~a'~%" (getenv "CROSS_COMPILE")))) ;; Allow EXTRAVERSION to be set via the environment. (substitute* "Makefile" (("^ *EXTRAVERSION[[:blank:]]*=") "EXTRAVERSION ?=")) (setenv "EXTRAVERSION" #$(and extra-version (string-append "-" extra-version))) ;; Use the maximum compression available for Zstd-compressed ;; modules. (setenv "ZSTD_CLEVEL" "19"))) (replace 'configure (lambda _ (let ((config #$(match (let ((arch (platform-linux-architecture (lookup-platform-by-target-or-system (or (%current-target-system) (%current-system)))))) (and configuration-file arch (configuration-file arch #:variant (version-major+minor version)))) (#f ;no config for this platform #f) ((? file-like? config) config)))) ;; Use a custom kernel configuration file or a default ;; configuration file. (if config (begin (copy-file config ".config") (chmod ".config" #o666)) (invoke "make" #$defconfig)) ;; Appending works even when the option wasn't in the file. ;; The last one prevails if duplicated. (let ((port (open-file ".config" "a")) (extra-configuration #$(config->string extra-options))) (display extra-configuration port) (close-port port)) (invoke "make" "oldconfig")))) (replace 'install (lambda* (#:key make-flags parallel-build? #:allow-other-keys) (let ((moddir (string-append #$output "/lib/modules")) (dtbdir (string-append #$output "/lib/dtbs")) (make-flags (append make-flags (list "-j" (if parallel-build? (number->string (parallel-job-count)) "1"))))) ;; Install kernel image, kernel configuration and link map. (for-each (lambda (file) (install-file file #$output)) (find-files "." "^(\\.config|bzImage|zImage|Image\ |vmlinuz|System\\.map|Module\\.symvers)$")) ;; Install device tree files (unless (null? (find-files "." "\\.dtb$")) (mkdir-p dtbdir) (apply invoke "make" (string-append "INSTALL_DTBS_PATH=" dtbdir) "dtbs_install" make-flags)) ;; Install kernel modules (mkdir-p moddir) (apply invoke "make" ;; Disable depmod because the Guix system's module ;; directory is an union of potentially multiple ;; packages. It is not possible to use depmod to ;; usefully calculate a dependency graph while building ;; only one of them. "DEPMOD=true" (string-append "MODULE_DIR=" moddir) (string-append "INSTALL_PATH=" #$output) (string-append "INSTALL_MOD_PATH=" #$output) "INSTALL_MOD_STRIP=1" "modules_install" make-flags) (let* ((versions (filter (lambda (name) (not (string-prefix? "." name))) (scandir moddir))) (version (match versions ((x) x)))) ;; There are symlinks to the build and source directory. ;; Both will point to target /tmp/guix-build* and thus not ;; be useful in a profile. Delete the symlinks. (false-if-file-not-found (delete-file (string-append moddir "/" version "/build"))) (false-if-file-not-found (delete-file (string-append moddir "/" version "/source")))))))))) (native-inputs (list perl bc openssl elfutils ;needed to enable CONFIG_STACK_VALIDATION flex bison util-linux ;needed for hexdump ;; These are needed to compile the GCC plugins. gmp mpfr mpc ;; These are needed when building with the CONFIG_DEBUG_INFO_BTF ;; support. dwarves ;for pahole python-wrapper zlib ;; For Zstd compression of kernel modules. zstd)) (home-page "https://www.gnu.org/software/linux-libre/") (synopsis "100% free redistribution of a cleaned Linux kernel") (description "GNU Linux-Libre is a free (as in freedom) variant of the Linux kernel. It has been modified to remove all non-free binary blobs.") (license license:gpl2) (properties '((max-silent-time . 10800))))) ;don't timeout on blob scan ;;; ;;; Generic kernel packages. ;;; (define-public linux-libre-6.10 (make-linux-libre* linux-libre-6.10-version linux-libre-6.10-gnu-revision linux-libre-6.10-source '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "powerpc64le-linux" "riscv64-linux") #:configuration-file kernel-config)) (define-public linux-libre-version linux-libre-6.10-version) (define-public linux-libre-gnu-revision linux-libre-6.10-gnu-revision) (define-public linux-libre-pristine-source linux-libre-6.10-pristine-source) (define-public linux-libre-source linux-libre-6.10-source) (define-public linux-libre linux-libre-6.10) (define-public linux-libre-6.6 (make-linux-libre* linux-libre-6.6-version linux-libre-6.6-gnu-revision linux-libre-6.6-source '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "powerpc64le-linux" "riscv64-linux") #:configuration-file kernel-config)) (define-public linux-libre-6.1 (make-linux-libre* linux-libre-6.1-version linux-libre-6.1-gnu-revision linux-libre-6.1-source '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "powerpc64le-linux" "riscv64-linux") #:configuration-file kernel-config)) (define-public linux-libre-5.15 (make-linux-libre* linux-libre-5.15-version linux-libre-5.15-gnu-revision linux-libre-5.15-source '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "powerpc64le-linux" "riscv64-linux") #:configuration-file kernel-config)) (define-public linux-libre-5.10 (make-linux-libre* linux-libre-5.10-version linux-libre-5.10-gnu-revision linux-libre-5.10-source '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "powerpc64le-linux" "riscv64-linux") #:configuration-file kernel-config)) (define-public linux-libre-5.4 (make-linux-libre* linux-libre-5.4-version linux-libre-5.4-gnu-revision linux-libre-5.4-source '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "powerpc64le-linux" "riscv64-linux") #:configuration-file kernel-config)) (define-public linux-libre-4.19 (make-linux-libre* linux-libre-4.19-version linux-libre-4.19-gnu-revision linux-libre-4.19-source '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "powerpc64le-linux") #:configuration-file kernel-config)) ;; Linux-Libre-LTS points to the *newest* released long-term support version of ;; Linux-Libre. ;; Reference: <https://www.kernel.org/category/releases.html> (define-public linux-libre-lts-version linux-libre-6.6-version) (define-public linux-libre-lts-gnu-revision linux-libre-6.6-gnu-revision) (define-public linux-libre-lts-pristine-source linux-libre-6.6-pristine-source) (define-public linux-libre-lts-source linux-libre-6.6-source) (define-public linux-libre-lts linux-libre-6.6) ;;; ;;; Specialized kernel variants. ;;; (define-public linux-libre-arm-generic (make-linux-libre* linux-libre-version linux-libre-gnu-revision linux-libre-source '("armhf-linux") #:defconfig "multi_v7_defconfig" #:extra-version "arm-generic" #:extra-options (append `(;; needed to fix the RTC on rockchip platforms ("CONFIG_RTC_DRV_RK808" . #t)) (default-extra-linux-options linux-libre-version)))) (define-public linux-libre-arm-generic-5.10 (make-linux-libre* linux-libre-5.10-version linux-libre-5.10-gnu-revision linux-libre-5.10-source '("armhf-linux") #:defconfig "multi_v7_defconfig" #:extra-version "arm-generic" #:extra-options (append `(;; needed to fix the RTC on rockchip platforms ("CONFIG_RTC_DRV_RK808" . #t)) (default-extra-linux-options linux-libre-5.10-version)))) (define-public linux-libre-arm-generic-5.4 (make-linux-libre* linux-libre-5.4-version linux-libre-5.4-gnu-revision linux-libre-5.4-source '("armhf-linux") #:defconfig "multi_v7_defconfig" #:extra-version "arm-generic" #:extra-options (append `(;; needed to fix the RTC on rockchip platforms ("CONFIG_RTC_DRV_RK808" . #t)) (default-extra-linux-options linux-libre-5.4-version)))) (define-public linux-libre-arm-generic-4.19 (make-linux-libre* linux-libre-4.19-version linux-libre-4.19-gnu-revision linux-libre-4.19-source '("armhf-linux") #:defconfig "multi_v7_defconfig" #:extra-version "arm-generic")) (define-public linux-libre-arm-omap2plus (make-linux-libre* linux-libre-version linux-libre-gnu-revision linux-libre-source '("armhf-linux") #:defconfig "omap2plus_defconfig" #:extra-version "arm-omap2plus")) (define-public linux-libre-arm-omap2plus-4.19 (make-linux-libre* linux-libre-4.19-version linux-libre-4.19-gnu-revision linux-libre-4.19-source '("armhf-linux") #:defconfig "omap2plus_defconfig" #:extra-version "arm-omap2plus")) (define-public linux-libre-arm64-generic (make-linux-libre* linux-libre-version linux-libre-gnu-revision linux-libre-source '("aarch64-linux") #:defconfig "defconfig" #:extra-version "arm64-generic" #:extra-options (append `(;; Provide support for ath9k wireless ("CONFIG_ATH9K_HTC" . m) ;; needed to fix the RTC on rockchip platforms ("CONFIG_RTC_DRV_RK808" . #t) ;; Pinebook display, battery, charger and usb ("CONFIG_DRM_ANALOGIX_ANX6345" . m) ("CONFIG_CHARGER_AXP20X" . m) ("CONFIG_INPUT_AXP20X_PEK" . m) ("CONFIG_CHARGER_AXP20X" . m) ("CONFIG_BATTERY_AXP20X" . m) ("CONFIG_PINCTRL_AXP209" . m) ("CONFIG_AXP20X_POWER" . m) ("CONFIG_AXP20X_ADC" . m) ;; Pinebook PRO battery and sound support ("CONFIG_BATTERY_CW2015" . m) ("CONFIG_CHARGER_GPIO" . m) ("CONFIG_SND_SOC_ES8316" . m)) (default-extra-linux-options linux-libre-version)))) (define-public linux-libre-lts-arm64-generic (make-linux-libre* linux-libre-lts-version linux-libre-lts-gnu-revision linux-libre-lts-source '("aarch64-linux") #:defconfig "defconfig" #:extra-version "arm64-generic" #:extra-options (append `(;; Provide support for ath9k wireless ("CONFIG_ATH9K_HTC" . m) ;; needed to fix the RTC on rockchip platforms ("CONFIG_RTC_DRV_RK808" . #t) ;; Pinebook display, battery, charger and usb ("CONFIG_DRM_ANALOGIX_ANX6345" . m) ("CONFIG_CHARGER_AXP20X" . m) ("CONFIG_INPUT_AXP20X_PEK" . m) ("CONFIG_CHARGER_AXP20X" . m) ("CONFIG_BATTERY_AXP20X" . m) ("CONFIG_PINCTRL_AXP209" . m) ("CONFIG_AXP20X_POWER" . m) ("CONFIG_AXP20X_ADC" . m) ;; Pinebook PRO battery and sound support ("CONFIG_BATTERY_CW2015" . m) ("CONFIG_CHARGER_GPIO" . m) ("CONFIG_SND_SOC_ES8316" . m)) (default-extra-linux-options linux-libre-lts-version)))) (define-public linux-libre-arm64-generic-5.10 (make-linux-libre* linux-libre-5.10-version linux-libre-5.10-gnu-revision linux-libre-5.10-source '("aarch64-linux") #:defconfig "defconfig" #:extra-version "arm64-generic" #:extra-options (append `(;; needed to fix the RTC on rockchip platforms ("CONFIG_RTC_DRV_RK808" . #t) ;; Pinebook display, battery, charger and usb ("CONFIG_DRM_ANALOGIX_ANX6345" . m) ("CONFIG_CHARGER_AXP20X" . m) ("CONFIG_INPUT_AXP20X_PEK" . m) ("CONFIG_CHARGER_AXP20X" . m) ("CONFIG_BATTERY_AXP20X" . m) ("CONFIG_PINCTRL_AXP209" . m) ("CONFIG_AXP20X_POWER" . m) ("CONFIG_AXP20X_ADC" . m) ;; Pinebook PRO battery and sound support ("CONFIG_BATTERY_CW2015" . m) ("CONFIG_CHARGER_GPIO" . m) ("CONFIG_SND_SOC_ES8316" . m)) (default-extra-linux-options linux-libre-5.10-version)))) (define-public linux-libre-arm64-generic-5.4 (make-linux-libre* linux-libre-5.4-version linux-libre-5.4-gnu-revision linux-libre-5.4-source '("aarch64-linux") #:defconfig "defconfig" #:extra-version "arm64-generic" #:extra-options (append `(;; needed to fix the RTC on rockchip platforms ("CONFIG_RTC_DRV_RK808" . #t)) (default-extra-linux-options linux-libre-5.4-version)))) (define-public linux-libre-riscv64-generic (make-linux-libre* linux-libre-version linux-libre-gnu-revision linux-libre-source '("riscv64-linux") #:extra-version "riscv64-generic" #:extra-options (append ;; required `guix system vm' `(("CONFIG_USB_HID" . m) ("CONFIG_HID_GEMBIRD" . m) ("CONFIG_AHCI_DWC" . m) ("CONFIG_SATA_AHCI" . m) ("CONFIG_CRYPTO_SERPENT" . m) ("CONFIG_CRYPTO_WP512" . m) ("CONFIG_USB_UAS" . m) ("CONFIG_USB_STORAGE" . m) ("CONFIG_HID_GENERIC" . m) ("CONFIG_DRM_CIRRUS_QEMU" . m) ("CONFIG_HW_RANDOM_VIRTIO" . m) ("CONFIG_VIRTIO_CONSOLE" . m) ("CONFIG_CRYPTO_XTS" . m)) (default-extra-linux-options linux-libre-version)))) (define-public linux-libre-mips64el-fuloong2e (make-linux-libre* linux-libre-version linux-libre-gnu-revision linux-libre-source '("mips64el-linux") #:defconfig "fuloong2e_defconfig" #:extra-version "mips64el-fuloong2e" #:extra-options (append `(("CONFIG_OVERLAY_FS" . m)) (default-extra-linux-options linux-libre-version)))) (define-public linux-libre-with-bpf (deprecated-package "linux-libre-with-bpf" linux-libre)) ;;; ;;; Linux kernel modules. ;;; (define-public acpi-call-linux-module (package (name "acpi-call-linux-module") (version "1.2.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/nix-community/acpi_call") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "09ljx0jl987753r2kjqj5kxms95bijw0xn14kf82ryn38ck5c8cf")))) (build-system linux-module-build-system) (arguments (list #:tests? #f ; no tests #:phases #~(modify-phases %standard-phases (add-before 'install 'patch-shebangs-harder ;; The (only) shebangs in examples/ don't justify a reference. ;; However, do substitute a slightly more portable one. (lambda _ (substitute* (find-files "examples" ".") (("^(#! *)/[^ ]*/" _ shebang) (string-append shebang "/usr/bin/env "))))) (add-after 'install 'install-documentation (lambda _ (let* ((doc (string-append #$output "/share/doc/" #$name "-" #$version))) (for-each (lambda (file) (let ((target (string-append doc "/" file))) (mkdir-p (dirname target)) (copy-recursively file target))) (list "README.md" "examples")))))))) (home-page "https://github.com/nix-community/acpi_call") (synopsis "Linux kernel module to perform ACPI method calls") (description "This simple Linux kernel module allows calls from user space to any @acronym{ACPI, Advanced Configuration and Power Interface} method provided by your computer's firmware, by writing to @file{/proc/acpi/call}. You can pass any number of parameters of types @code{ACPI_INTEGER}, @code{ACPI_STRING}, and @code{ACPI_BUFFER}. It grants direct and undocumented access to your hardware that may cause damage and should be used with caution, especially on untested models.") (license license:gpl3+))) ; see README.md (no licence headers) (define-public corefreq (package (name "corefreq") (version "1.96.5") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/cyring/CoreFreq") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "15wi9v7zcd62ab03zji43l33f1mc70lsdvqylv33kfpaf3k72lm4")))) (build-system linux-module-build-system) (outputs (list "out" "linux-module")) (arguments (list #:imported-modules `((guix build gnu-build-system) ,@%linux-module-build-system-modules) #:modules `((guix build linux-module-build-system) ((guix build gnu-build-system) #:prefix gnu:) (guix build utils)) #:make-flags #~(list (string-append "CC=" #$(cc-for-target)) "OPTIM_LVL=3" (string-append "PREFIX=" #$output)) #:tests? #f ; no test suite #:phases #~(modify-phases %standard-phases (add-after 'unpack 'untangle-module-targets ;; Having to build everything in one pass would complicate the ;; definition. Let each build system handle what it's good at. (lambda _ (substitute* "Makefile" ((".*MAKE.*KERNELDIR.*") "")))) (add-after 'build 'gnu:build (assoc-ref gnu:%standard-phases 'build)) (add-after 'install 'gnu:install (assoc-ref gnu:%standard-phases 'install)) (add-after 'install 'separate-module (lambda* (#:key outputs #:allow-other-keys) ;; Adding INSTALL_MOD_PATH= to #:make-flags would still create an ;; empty <out>/lib/modules directory, so just do it all by hand. (let* ((out (assoc-ref outputs "out")) (module (assoc-ref outputs "linux-module"))) (mkdir-p (string-append module "/lib")) (rename-file (string-append out "/lib/modules") (string-append module "/lib/modules"))))) (add-after 'install 'install-README ;; There is no proper documentation. Provide something. (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (doc (string-append out "/share/doc/" #$name "-" #$version))) (install-file "README.md" doc))))))) (home-page "https://github.com/cyring/CoreFreq") (synopsis "Measure performance data & tweak low-level settings on x86-64 CPUs") (description "CoreFreq is a CPU monitor that reports low-level processor settings and performance data with notably high precision by using a loadable Linux kernel module. Unlike most similar tools, it can be used to modify some settings if supported by the hardware and at your own risk. It's designed for 64-bit x86 Intel processors (Atom, Core2, Nehalem, SandyBridge, and newer) and compatible architectures like AMD@tie{}Zen and Hygon@tie{}Dhyana. Supported processor features include: @enumerate @item time spent in C-states, including C1/C3 Auto- and UnDemotion; @item core temperatures, voltage, and tweaking thermal limits; @item core frequencies, ratios, and base clock rate; @item enabling, disabling, and testing SpeedStep (EIST), Turbo Boost, and Hyper-Threading or SMT; @item enabling or disabling data cache prefetching; @item kernel assembly code to keep as near as possible readings of performance counters such as the @acronym{TSC, Time Stamp Counter}, @acronym{UCC, Unhalted Core Cycles}, and @acronym{URC, Unhalted Reference Cycles}; @item the number of instructions per cycle or second (IPS, IPC, and CPI); @item memory controller geometry and RAM timings; @item running processes' CPU affinity. @end enumerate This package provides the @command{corefreqd} data collection daemon, the @command{corefreq-cli} client to visualise and control it in real time, and the @code{corefreqk} kernel module in its own separate output. Read the included @file{README.md} before loading it.") (supported-systems (list "x86_64-linux")) (license license:gpl2))) (define-public librem-ec-acpi-linux-module (package (name "librem-ec-acpi-linux-module") (version "0.9.2") (source (origin (method git-fetch) (uri (git-reference (url "https://source.puri.sm/nicole.faerber/librem-ec-acpi-dkms") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0m8hamf0550083jnk5q4hv20l8lfiardnkxbib4hhvqghpzzbxl0")))) (build-system linux-module-build-system) (arguments (list #:tests? #f)) ; no test suite (home-page "https://source.puri.sm/nicole.faerber/librem-ec-acpi-dkms") (synopsis "Linux kernel module to control the Librem Embedded Controller") (description "This is the Linux kernel @acronym{ACPI, Advanced Configuration and Power Interface} platform driver for the @acronym{EC, Embedded Controller} firmware on Purism Librem laptop computers. It allows user-space control over the battery charging thresholds, keyboard backlight, fans and thermal monitors, and the notification, WiFi, and Bluetooth LED.") (license license:gpl2))) (define-public tuxedo-keyboard (package (name "tuxedo-keyboard") (version "4.6.1") (source (origin (method git-fetch) (uri (git-reference (url "https://gitlab.com/tuxedocomputers/development/packages/tuxedo-drivers.git") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0hbqk28qi3yxw0g3j8yarsplyigpd8kgliri7c48d3yhliiiz7l5")))) (build-system linux-module-build-system) (arguments (list #:tests? #f)) ; no test suite (home-page "https://gitlab.com/tuxedocomputers/development/packages/tuxedo-drivers") (synopsis "Linux kernel modules to control keyboard on most Tuxedo computers") (description "This package provides the @code{tuxedo_keyboard}, @code{tuxedo_io}, @code{clevo_wmi} @acronym{WMI, Windows Management Engine} and the @code{clevo_acpi} @acronym{ACPI, Advanced Configuration and Power Interface} kernel modules to control the keyboard on most Tuxedo computers. Only white backlight only models are currently not supported. The @code{tuxedo_io} module is also needed for the @code{tuxedo-control-center} (short tcc) package.") (license license:gpl3+))) (define-public evdi (package (name "evdi") (version "1.14.4") ;inherited by libevdi (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/DisplayLink/evdi") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1r9gd4ffr8sh9y3ic8fxwgp4gjls2yd6bgsgvcf0vy571s2aqggr")))) (build-system linux-module-build-system) (arguments (list #:tests? #f ;no test suite #:phases #~(modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ (chdir "module")))))) (home-page "https://github.com/DisplayLink/evdi") (synopsis "@acronym{EVDI, Extensible Virtual Display Interface} Linux kernel module") (description "The @acronym{EVDI, Extensible Virtual Display Interface} is a Linux kernel module that enables management of multiple screens, allowing user-space programs to take control over what happens with the image. It is essentially a virtual display for which applications using the @code{libevdi} library can add, remove, and receive screen updates. The EVDI driver uses the standard Linux @acronym{DRM, Direct Rendering Manager}. Its displays can be controlled by standard tools such as @command{xrandr} and display settings applets in graphical environments") (license license:gpl2))) (define-public libevdi (package (inherit evdi) (name "libevdi") (build-system gnu-build-system) (arguments (list #:tests? #f ;no test suite #:make-flags #~(list (string-append "CC=" #$(cc-for-target))) #:phases #~(modify-phases %standard-phases (delete 'configure) (add-after 'unpack 'chdir (lambda _ (chdir "library"))) (replace 'install (lambda* _ (let* ((lib (string-append #$output "/lib"))) (mkdir-p lib) (install-file "libevdi.so" lib))))))) (inputs (list libdrm)) (native-inputs (list pkg-config)) (synopsis "@acronym{EVDI, Extensible Virtual Display Interface} user-space library") (description "Libevdi is a library that gives applications easy access to @acronym{EVDI, Extensible Virtual Display Interface} devices provided by the @code{evdi} driver package. ") (license license:lgpl2.1))) (define-public ec (package (name "ec") (version (package-version linux-libre)) (source (package-source linux-libre)) (build-system gnu-build-system) (arguments (list #:make-flags #~(list (string-append "sbindir=" #$output "/sbin") "INSTALL=install" "STRIPCMD=true") #:phases #~(modify-phases %standard-phases (add-after 'unpack 'enter-subdirectory (lambda _ (chdir "tools/power/acpi/tools/ec"))) (delete 'configure)) ;no configure script #:tests? #f)) ;no tests (home-page (package-home-page linux-libre)) (synopsis "Utility for reading or writing @acronym{EC, Embedded Controller} registers") (description "This utility can read or write specific registers or all the available registers of the @acronym{EC, Embedded Controller} supported by the @code{ec_sys} Linux driver.") (license license:gpl2))) (define-public lkrg (package (name "lkrg") (version "0.9.7") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/lkrg-org/lkrg") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0k0z9caj48nqjwk3bapgfcdzi1lkizxcjj4r1dvkvwsk38mbk1c4")))) (build-system linux-module-build-system) (arguments (list #:linux linux-libre #:tests? #f #:make-flags #~(list (string-append "CC=" #$(cc-for-target)) (string-append "SYSSRC=" (assoc-ref %build-inputs "linux-module-builder") "/lib/modules/build")))) (inputs (list bash-minimal)) (home-page "https://lkrg.org/") (synopsis "Linux Kernel Runtime Guard") (description "This package performs runtime integrity checking of the Linux kernel and detection of security vulnerability exploits against the kernel.") (license license:gpl2))) (define-public vhba-module (package (name "vhba-module") (version "20211218") (source (origin (method url-fetch) (uri (string-append "http://downloads.sourceforge.net/cdemu/vhba-module/vhba-module-" version ".tar.xz")) (sha256 (base32 "1dkprnnya0i8121p7ip4g8cww99drk7fzbwcxx65x02jqk0siibj")))) (build-system linux-module-build-system) (arguments (list #:tests? #f)) ; no test suite (home-page "https://cdemu.sourceforge.io/") (synopsis "Linux kernel module that emulates SCSI devices") (description "The @acronym{VHBA, Virtual SCSI Host Bus Adapter} module is the link between the CDemu user-space daemon and the kernel Linux. It acts as a low-level SCSI driver that emulates a virtual SCSI adapter which can have multiple virtual devices attached to it. Its typical use with CDEmu is to emulate optical devices such as DVD and CD-ROM drives.") (license license:gpl2+))) (define-public bbswitch-module ;; Use "develop" branch since stable release does not build on Linux >= 5.6. ;; See https://github.com/Bumblebee-Project/bbswitch/issues/205. (let ((commit "19f60204596a6463b162fc7ca11f4946f5c20cea")) (package (name "bbswitch-module") (version (git-version "0.8" "2" commit)) (source (origin (method git-fetch) (uri (git-reference ;; Use fork until ;; https://github.com/Bumblebee-Project/bbswitch/pull/219 ;; is merged. (url "https://github.com/madchic/bbswitch") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "1pv41y02c9xg9k1bg4i4ll3w7hxxzdr651i08f092b9q5hr57mqn")))) (build-system linux-module-build-system) (arguments (list #:tests? #f)) ; no test suite (home-page "https://github.com/Bumblebee-Project/bbswitch") (synopsis "Kernel module that disables discrete Nvidia graphics cards") (description "The bbswitch module provides a way to toggle the Nvidia graphics card on Optimus laptops.") (license license:gpl2)))) (define-public ddcci-driver-linux (package (name "ddcci-driver-linux") (version "0.4.5") (source (origin (method git-fetch) (uri (git-reference (url "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux.git") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0j2bgzadrbcyf3k4zplv7p5yqb9pw2ca6wzkqjhhidaah2722vlf")))) (build-system linux-module-build-system) (arguments (list #:tests? #f ; no tests #:phases #~(modify-phases %standard-phases (replace 'build (lambda args (for-each (lambda (module) (with-directory-excursion module (apply (assoc-ref %standard-phases 'build) args))) '("ddcci" "ddcci-backlight")))) (replace 'install (lambda args (for-each (lambda (module) (with-directory-excursion module (apply (assoc-ref %standard-phases 'install) args))) '("ddcci" "ddcci-backlight"))))))) (home-page "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux") (synopsis "Pair of Linux kernel drivers for DDC/CI monitors") (description "This package provides two Linux kernel drivers, ddcci and ddcci-backlight, that allows the control of DDC/CI monitors through the sysfs interface. The ddcci module creates a character device for each DDC/CI monitors in @file{/dev/bus/ddcci/[I²C busnumber]}. While the ddcci-backlight module allows the control of the backlight level or luminance property when supported under @file{/sys/class/backlight/}.") (license license:gpl2+))) (define-public v4l2loopback-linux-module (package (name "v4l2loopback-linux-module") (version "0.13.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/umlaeute/v4l2loopback") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0580pzac0bfb98phmsm5rxmarx22wiprca13n8bk23sdgkzwb706")))) (build-system linux-module-build-system) (arguments (list #:tests? #f)) ; no test suite (home-page "https://github.com/umlaeute/v4l2loopback") (synopsis "Linux kernel module to create virtual V4L2 video devices") (description "This Linux module creates virtual video devices. @acronym{V4L2, Video for Linux 2} applications will treat these as ordinary video devices but read video data generated by another application, instead of a hardware device such as a capture card. This lets you apply nifty effects to your Jitsi video, for example, but also allows some more serious things like adding streaming capabilities to an application by hooking GStreamer into the loopback device.") (license license:gpl2+))) (define-public xpadneo (package (name "xpadneo") (version "0.9.5") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/atar-axis/xpadneo") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1pq7p9sxlw1v9rnny9070b39rpwfq6rip0z92mwlw4qzinmqqgdd")))) (build-system linux-module-build-system) (arguments (list #:tests? #f ; no `check' target #:source-directory "hid-xpadneo/src" #:phases #~(modify-phases %standard-phases (add-after 'install 'post-install (lambda _ (copy-recursively "hid-xpadneo/etc-modprobe.d" (string-append #$output "/etc/modprobe.d")) ;; udev-service-type takes its rules from /lib rather than ;; /etc, so copy it there instead (copy-recursively "hid-xpadneo/etc-udev-rules.d" (string-append #$output "/lib/udev/rules.d"))))))) (home-page "https://atar-axis.github.io/xpadneo/") (synopsis "Xbox One Wireless Controller driver for the kernel Linux") (description "This package provides a driver for the XBox One S Wireless controller and some newer models when connected via Bluetooth. In addition to the included Linux kernel module, it also contains a modprobe configuration and udev rules, which need to be installed separately.") (license license:gpl3+))) (define-public vendor-reset-linux-module (let ((commit "4b466e92a2d9f76ce1082cde982c7be0be91e248") (revision "0")) (package (name "vendor-reset-linux-module") (version (git-version "0.1.0" revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/gnif/vendor-reset") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "1gaf4j20grng689c9fylcqri3j9ycnhr2bsva2z6qcdqvzl6yxbi")))) (build-system linux-module-build-system) (arguments (list #:tests? #f)) ;no test suite (home-page "https://github.com/gnif/vendor-reset") (synopsis "Kernel module that resets GPUs that are affected by the reset bug") (description "This package provides a kernel module that is capable of resetting hardware devices into a state where they can be re-initialized or passed through into a virtual machine (VFIO). While it would be great to have these in the kernel as PCI quirks, some of the reset procedures are very complex and would never be accepted as a quirk (ie AMD Vega 10).") (license license:gpl2)))) ;;; ;;; Pluggable authentication modules (PAM). ;;; (define-public linux-pam (package (name "linux-pam") (version "1.5.2") (source (origin (method url-fetch) (uri (string-append "https://github.com/linux-pam/linux-pam/releases/download/v" version "/Linux-PAM-" version ".tar.xz")) (sha256 (base32 "0kgrsj2scv5mx6w925h9hxf11jnqqs9z8s22aw94b90xm4qp3v74")) (patches (search-patches "linux-pam-unix_chkpwd.patch" "linux-pam-no-setfsuid.patch")))) (build-system gnu-build-system) (inputs (list libxcrypt)) (native-inputs (list flex ;; TODO: optional dependencies ;; ("cracklib" ,cracklib) )) (arguments (list ;; Most users, such as `shadow', expect the headers to be under ;; `security'. #:configure-flags #~(list (string-append "--includedir=" (assoc-ref %outputs "out") "/include/security") ;; explicit libdir for pkgconfig files ;; drop with 1.5.3, which fixes ;; https://github.com/linux-pam/linux-pam/issues/466 (string-append "--libdir=" (assoc-ref %outputs "out") "/lib") ;; XXX: <rpc/rpc.h> is missing from glibc when ;; cross-compiling, so we have to disable NIS ;; support altogether. #$@(if (%current-target-system) #~("--disable-nis") #~())) #:phases (if (target-hurd?) #~(modify-phases %standard-phases (add-after 'unpack 'skip-pam-limits (lambda _ ;; 'pam_limits.c' uses <sys/prctl.h>, which is ;; Linux-specific. Skip it on GNU/Hurd. (substitute* "modules/Makefile.in" (("pam_limits") ""))))) #~%standard-phases) ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d ;; isn't available. #:tests? #f)) (home-page "http://www.linux-pam.org/") (synopsis "Pluggable authentication modules for Linux") (description "A *Free* project to implement OSF's RFC 86.0. Pluggable authentication modules are small shared object files that can be used through the PAM API to perform tasks, like authenticating a user at login. Local and dynamic reconfiguration are its key features.") (license license:bsd-3))) (define-public python-pamela (package (name "python-pamela") (version "1.0.0") (source (origin ;; Tests not distributed in pypi release. (method git-fetch) (uri (git-reference (url "https://github.com/minrk/pamela") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "0cg3w6np1fbjpvzhv54xg567hpf38szwp2d4gvzb9r736nxbv0vr")))) (build-system python-build-system) (arguments '(#:tests? #f ; Test suite isn't designed to be run inside a container. #:phases (modify-phases %standard-phases (add-after 'unpack 'hardcode-pam.so (lambda* (#:key inputs #:allow-other-keys) (let ((pam (assoc-ref inputs "linux-pam"))) (substitute* "pamela.py" (("find_library\\(\"pam\")") (string-append "'" pam "/lib/libpam.so'"))) #t))) (replace 'check (lambda* (#:key tests? #:allow-other-keys) (if tests? (if (file-exists? "test_pamela.py") (invoke "py.test" "--assert=plain" "test_pamela.py") (invoke "python" "-m" "pamela" "-a" "`whoami`")) #t)))))) (inputs (list linux-pam)) (native-inputs (list python-pytest)) (home-page "https://github.com/minrk/pamela") (synopsis "PAM interface using ctypes") (description "This package provides a PAM interface using @code{ctypes}.") (license license:expat))) (define-public pam-gnupg (package (name "pam-gnupg") (version "0.3") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/cruegge/pam-gnupg") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1bf91gi6zmfzzmczxm7pajxdlgnikasvg5xsd3j0a368rcr7lf9l")))) (build-system gnu-build-system) (inputs (list gnupg linux-pam)) (native-inputs (list autoconf automake libtool)) (arguments `(#:tests? #f ;no tests suite #:configure-flags (list (string-append "--with-moduledir=" (assoc-ref %outputs "out") "/lib/security")))) (home-page "https://github.com/cruegge/pam-gnupg") (synopsis "Unlock GnuPG keys on login") (description "This package provides a PAM module that hands over your login password to @code{gpg-agent}. This can be useful if you are using a GnuPG-based password manager like @code{pass}.") (license license:gpl3+))) ;;; ;;; Kernel documentation ;;; (define-public linux-libre-documentation (package (inherit linux-libre) (name "linux-libre-documentation") (arguments (list #:tests? #f #:phases #~(modify-phases %standard-phases (delete 'configure) (replace 'build (lambda* (#:key parallel-build? #:allow-other-keys) (substitute* "Documentation/Makefile" ;; Remove problematic environment check script. ((".*scripts/sphinx-pre-install.*") "")) (invoke "make" "infodocs" "-j" (if parallel-build? (number->string (parallel-job-count)) "1")))) (replace 'install (lambda _ (let* ((info-dir (string-append #$output "/share/info")) (info (string-append info-dir "/TheLinuxKernel.info.gz"))) (with-directory-excursion "Documentation/output" (invoke "make" "-C" "texinfo" "install-info" (string-append "infodir=" info-dir))) ;; Create a symlink, for convenience. (symlink info (string-append info-dir "/linux.info.gz")))))))) (native-inputs (list graphviz perl python python-sphinx python-pyyaml texinfo which)) (synopsis "Documentation for the kernel Linux-Libre") (description "This package provides the documentation for the kernel Linux-Libre, as an Info manual. To consult it, run @samp{info linux}."))) ;;; ;;; Miscellaneous. ;;; (define-public powercap (package (name "powercap") (version "0.5.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/powercap/powercap") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1vs84fmhdc3w1541vp0f5ydvdsbg0amjdv2g2f8xdvaw01nakxsn")))) (build-system cmake-build-system) (arguments (list #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON"))) (home-page "https://github.com/powercap/powercap") (synopsis "Utilities for accessing the powercap Linux kernel feature") (description "This package contains utilities for accessing the powercap Linux kernel feature through sysfs. It includes an implementation for working with Intel @acronym{RAPL, Running Average Power Limit}. It provides the commands @code{powercap-info} and @code{powercap-set}.") (license license:bsd-3))) (define-public powerstat (package (name "powerstat") (version "0.02.28") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/ColinIanKing/powerstat") (commit (string-append "V" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1wydjxmb6qf7rqarpl8rblg4biq3r2kfcx7p3pzvsr0w1xwdiisd")))) (build-system gnu-build-system) (arguments `(#:make-flags (list (string-append "CC=" ,(cc-for-target)) (string-append "prefix=" (assoc-ref %outputs "out"))) #:tests? #f ; no test suite #:phases (modify-phases %standard-phases (delete 'configure)))) ; no configure script (home-page "https://kernel.ubuntu.com/~cking/powerstat/") (synopsis "Measure system power consumption") (description "Powerstat measures and reports your computer's power consumption in real time. On mobile PCs, it uses ACPI battery information to measure the power drain of the entire system. Powerstat can also report @acronym{RAPL, Running Average Power Limit} power domain measurements. These are available only on some hardware such as Intel Sandybridge and newer, and cover only part of the machine's components such as CPU, DRAM, and graphics. However, they provide accurate and immediate readings and don't require a battery at all. The output is like @command{vmstat} but also shows power consumption statistics: at the end of a run, @command{powerstat} will calculate the average, standard deviation, and minimum and maximum values. It can show a nice histogram too.") (license license:gpl2))) (define-public psmisc (package (name "psmisc") (version "23.7") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-" version ".tar.xz")) (sha256 (base32 "09y30ywh1d4s4f0wgvki115kgpliq48rarmfmmjl0iq22jf5viaq")))) (build-system gnu-build-system) (arguments (list #:configure-flags (if (%current-target-system) #~(list "ac_cv_func_malloc_0_nonnull=yes" "ac_cv_func_realloc_0_nonnull=yes") #~'()))) (inputs (list ncurses)) (home-page "https://gitlab.com/psmisc/psmisc") (synopsis "Small utilities that use the proc file system") (description "psmisc is a set of small utilities that use the proc file system. @itemize @bullet @item @command{fuser} identifies processes using files or sockets; @item @command{killall} kills processes by name; @item @command{prtstat} prints statistics of a process; @item @command{pslog} prints the log file(s) of a process; @item @command{pstree} shows the currently running processes as a tree; @item @command{peekfd} shows the data travelling over a file descriptor. @end itemize") (license license:gpl2+))) (define-public util-linux (package (name "util-linux") (version "2.37.4") (source (origin (method url-fetch) (uri (string-append "mirror://kernel.org/linux/utils/" "util-linux/v" (version-major+minor version) "/" "util-linux-" version ".tar.xz")) (sha256 (base32 "10svcnsqmrsd660bzcm7k6dm8sa7hkknhr3bag1nccwimlb6jkk3")) (patches (search-patches "util-linux-tests.patch")) (modules '((guix build utils))) (snippet ;; We take 'nologin' from Shadow, the 'logger' program from ;; GNU Inetutils and 'kill' from GNU Coreutils. '(begin (substitute* "configure" (("build_nologin=yes") "build_nologin=no") (("build_logger=yes") "build_logger=no") (("build_kill=yes") "build_kill=no")) #t)))) (build-system gnu-build-system) (outputs '("out" ;6.4 MiB executables and documentation "lib" ;8.8 MiB shared libraries, headers and locales "static")) ;2.9 MiB static .a libraries (arguments (list #:configure-flags #~(list "--disable-use-tty-group" (string-append "--enable-fs-paths-default=" "/run/setuid-programs" ":/run/current-system/profile/sbin") ;; Don't try to chown root:root mount and umount "--disable-makeinstall-chown" "--localstatedir=/var" (string-append "--localedir=" #$output:lib "/share/locale") ;; Install completions where our bash-completion package ;; expects them. (string-append "--with-bashcompletiondir=" #$output "/etc/bash_completion.d")) ;; FIXME: For now we cannot reliably run tests on GNU/Hurd: ;; <https://bugs.gnu.org/47791>. #:tests? (and (not (%current-target-system)) (not (string-suffix? "-gnu" (%current-system)))) #:phases #~(modify-phases %standard-phases (add-before 'configure 'patch-build-scripts (lambda _ (substitute* "configure" ;; The build system assumes that we want to install ;; libraries below $exec_prefix when $libdir does not ;; match any of the "usual" locations. Fix that. (("usrlib_execdir='\\$\\{exec_prefix\\}'\\$libdir") "usrlib_execdir=$libdir")))) (add-before 'build 'set-umount-file-name (lambda _ ;; Tell 'eject' the right file name of 'umount'. (substitute* "sys-utils/eject.c" (("\"/bin/umount\"") (string-append "\"" #$output "/bin/umount\""))))) (add-before 'check 'pre-check (lambda* (#:key native-inputs inputs #:allow-other-keys) (let ((services (search-input-file (or native-inputs inputs) "etc/services"))) ;; Change the test to refer to the right file. (substitute* "tests/ts/misc/mcookie" (("/etc/services") services))))) (add-before 'check 'disable-setarch-test (lambda _ ;; The setarch tests are unreliable in QEMU's user-mode ;; emulation, which is our primary method of building ;; ARMv7 packages. See ;; <https://github.com/karelzak/util-linux/issues/601>. (substitute* "tests/ts/misc/setarch" (("ts_init_subtest.*" all) (string-append all "\n" "ts_skip \"setarch tests are unreliable under QEMU\""))))) (add-before 'check 'disable-lsns-test (lambda _ ;; The lsns tests can fail due to ioctl(_, NS_GET_USERNS) ;; returning ENOTTY, indicating this kernel does not ;; support user namespaces. Curiously, this test can fail ;; on i686 even if the same test passes on x86_64 on the ;; same machine. See <https://issues.guix.gnu.org/49933>. (delete-file "tests/ts/lsns/ioctl_ns"))) (add-after 'install 'move-static-libraries (lambda _ (let ((lib #$output:lib) (static #$output:static)) ;; Move static libraries to the "static" output. (mkdir-p (string-append static "/lib")) (with-directory-excursion lib (for-each (lambda (file) (rename-file file (string-append static "/" file))) (find-files "lib" "\\.a$")) ;; Remove references to the static library from the '.la' ;; files so that Libtool does the right thing when both ;; the shared and static library is available. (substitute* (find-files "lib" "\\.la$") (("old_library=.*") "old_library=''\n")))))) (add-after 'install 'adjust-pkg-config-files (lambda _ ;; Drop the unused "prefix=" and "exec_prefix=" variables from ;; the pkg-config files to avoid a cyclic reference on "out". (substitute* (find-files (string-append #$output:lib "/lib/pkgconfig") "\\.pc$") (("^(exec_)?prefix=.*") ""))))))) (inputs (list file ;for libmagic ncurses zlib)) (native-inputs (list net-base ;for tests perl)) (home-page "https://www.kernel.org/pub/linux/utils/util-linux/") (synopsis "Collection of utilities for the Linux kernel") (description "Util-linux is a diverse collection of Linux kernel utilities. It provides dmesg and includes tools for working with file systems, block devices, UUIDs, TTYs, and many other tools.") (properties '((upstream-name . "util-linux"))) ;; Note that util-linux doesn't use the same license for all the ;; code. GPLv2+ is the default license for a code without an ;; explicitly defined license. (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+ license:bsd-4 license:public-domain)))) ;; util-linux optionally supports udev, which allows lsblk to read file system ;; metadata without special privileges. Add it as a separate package to avoid ;; a circular dependency, and to keep the size small. (define-public util-linux+udev (package/inherit util-linux (name "util-linux-with-udev") (inputs (modify-inputs (package-inputs util-linux) (prepend eudev))))) (define-public ddate (package (name "ddate") (version "0.2.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/bo0ts/ddate") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1qchxnxvghbma6gp1g78wnjxsri0b72ha9axyk31cplssl7yn73f")))) (build-system cmake-build-system) (arguments '(#:tests? #f)) (home-page "https://github.com/bo0ts/ddate") (synopsis "PERPETUAL DATE CONVERTER FROM GREGORIAN TO POEE CALENDAR") (description "ddate displays the Discordian date and holidays of a given date. The Discordian calendar was made popular by the \"Illuminatus!\" trilogy by Robert Shea and Robert Anton Wilson.") (license license:public-domain))) (define-public dislocker (package (name "dislocker") (version "0.7.3") (home-page "https://github.com/Aorimn/dislocker") (source (origin (method git-fetch) (uri (git-reference (url home-page) (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1ak68s1v5dwh8y2dy5zjybmrh0pnqralmyqzis67y21m87g47h2k")))) (build-system cmake-build-system) (arguments '(#:tests? #f)) ;no test suite (inputs (list fuse-2 mbedtls-lts)) (synopsis "FUSE driver to read/write Windows BitLocker drives") (description "This package provides means to to read BitLocker encrypted partitions. Write functionality is also provided but check the README.") (license license:gpl2+))) (define-public dwarves (package (name "dwarves") (version "1.27") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/acmel/dwarves") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0qwc3772az1h3c78pyswawyvyq9spj5s1prj7ckfij9nazp3a007")) (patches (search-patches "dwarves-threading-reproducibility.patch")))) (build-system cmake-build-system) (arguments (list #:configure-flags #~(list "-D__LIB=lib" "-DLIBBPF_EMBEDDED=OFF") #:tests? #f)) ;no test suite (native-inputs (list pkg-config)) (inputs (list libbpf)) (home-page "https://github.com/acmel/dwarves") (synopsis "Debugging information processing library and utilities") (description "Dwarves is a set of tools that use the debugging information inserted in ELF binaries by compilers such as GCC, used by well known debuggers such as GDB. Utilities in the Dwarves suite include @command{pahole}, that can be used to find alignment holes in structures and classes in languages such as C, C++, but not limited to these. These tools can also be used to encode and read the BTF type information format used with the kernel Linux @code{bpf} syscall. The @command{codiff} command can be used to compare the effects changes in source code generate on the resulting binaries. The @command{pfunct} command can be used to find all sorts of information about functions, inlines, decisions made by the compiler about inlining, etc. The @command{pahole} command can be used to use all this type information to pretty print raw data according to command line directions. Headers can have its data format described from debugging info and offsets from it can be used to further format a number of records. Finally, the @command{btfdiff} command can be used to compare the output of pahole from BTF and DWARF, to make sure they produce the same results. ") (license license:gpl2+))) (define-public fbset (package (name "fbset") (version "2.1") (source (origin (method url-fetch) (uri (string-append "http://users.telenet.be/geertu/Linux/fbdev/fbset-" version ".tar.gz")) (sha256 (base32 "080wnisi0jq7dp0jcwdp83rq8q8s3kw41vc712516xbv4jq4mzs0")))) (build-system gnu-build-system) (arguments '(#:modules ((guix build gnu-build-system) (guix build utils) (srfi srfi-26)) #:phases (modify-phases %standard-phases (delete 'configure) ; no configure script (add-before 'install 'pre-install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (substitute* "Makefile" (("mknod ") "true ") ;; The Makefile doesn't honour PREFIX or similar. (("/usr") out)) (mkdir out) (with-directory-excursion out (for-each mkdir-p (list "sbin" "man/man5" "man/man8"))) #t))) (add-after 'install 'install-fb.modes (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (etc (string-append out "/etc"))) (for-each (cut install-file <> etc) (find-files "etc" "^fb\\.modes")) (symlink "fb.modes.ATI" (string-append etc "/fb.modes")) #t)))) ;; Parallel building races to create modes.tab.c. #:parallel-build? #f #:tests? #f)) ; no test suite (native-inputs (list bison flex)) (home-page "http://users.telenet.be/geertu/Linux/fbdev/") (synopsis "Show and modify Linux frame buffer settings") (description "The kernel Linux's @dfn{frame buffers} provide a simple interface to different kinds of graphic displays. The @command{fbset} utility can query and change various device settings such as depth, virtual resolution, and timing parameters.") (license license:gpl2))) (define-public procps (package (name "procps") (version "4.0.3") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/procps-ng/Production/" "procps-ng-" version ".tar.xz")) (sha256 (base32 "14ms9mkqr1mgl3h5yl6w8m57cf39k382nv7qms78vqbaz728wg1h")) (patches (search-patches "procps-strtod-test.patch")))) (build-system gnu-build-system) (arguments (list #:modules '((guix build utils) (guix build gnu-build-system) (srfi srfi-1) (srfi srfi-26)) #:configure-flags (if (%current-target-system) #~'("ac_cv_func_malloc_0_nonnull=yes" "ac_cv_func_realloc_0_nonnull=yes") #~'()) #:phases #~(modify-phases %standard-phases (add-after 'install 'post-install ;; Remove commands and man pages redudant with ;; Coreutils. (lambda* (#:key outputs #:allow-other-keys) (let* ((out #$output) (dup (append-map (cut find-files out <>) '("^kill" "^uptime")))) (for-each delete-file dup)))) #$@(if (system-hurd?) #~((add-after 'unpack 'skip-tests (lambda _ (substitute* "library/tests/test_version.c" (("^int main\\(.*" all) (string-append all "{\n exit (77);//")))))) #~())))) (inputs (list ncurses)) (native-inputs (list pkg-config)) (home-page "https://gitlab.com/procps-ng/procps/") (synopsis "Utilities that give information about processes") (description "Procps is the package that has a bunch of small useful utilities that give information about processes using the Linux /proc file system. The package includes the programs free, pgrep, pidof, pkill, pmap, ps, pwdx, slabtop, tload, top, vmstat, w, watch and sysctl.") (properties '((upstream-name . "procps-ng"))) (license license:gpl2))) (define-public usbutils (package (name "usbutils") (version "017") (source (origin (method url-fetch) (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/" "usbutils-" version ".tar.xz")) (sha256 (base32 "0nz008kshcajc9asxr4j5dh4wgq72z52lws4ga6y60wirzymz8m6")))) (build-system gnu-build-system) (outputs (list "out" "python")) (arguments (list #:phases #~(modify-phases %standard-phases (add-before 'bootstrap 'patch-bootstrap-scripts (lambda _ (substitute* "usbhid-dump/bootstrap" (("/bin/sh") (which "sh"))))) (add-after 'install 'separate-python-output ;; Separating one Python script shaves more than 106 MiB from :out. (lambda _ (for-each (lambda (file) (let ((old (string-append #$output "/" file)) (new (string-append #$output:python "/" file))) (mkdir-p (dirname new)) (rename-file old new))) (list "bin/lsusb.py"))))))) (inputs (list eudev libusb python)) (native-inputs (list autoconf automake libtool pkg-config)) (home-page "http://www.linux-usb.org/") (synopsis "Tools for working with USB devices") (description "Collection of tools to query what type of USB devices are connected to the system, including @command{lsusb}.") (license license:gpl2+))) (define-public usbip-utils (package (name "usbip-utils") (version (package-version linux-libre)) (source (package-source linux-libre)) (build-system gnu-build-system) (arguments '(#:configure-flags '("--disable-static") #:phases (modify-phases %standard-phases (add-after 'unpack 'enter-subdirectory (lambda _ (chdir "tools/usb/usbip") #t))))) (native-inputs `(("automake" ,automake) ("autoreconf" ,autoconf) ("libtool" ,libtool))) (inputs (list eudev)) (home-page (package-home-page linux-libre)) (synopsis "Utilities for sharing USB devices over IP networks") (description "The USB/IP protocol enables to pass USB device from a server to a client over the network. The server is a machine which shares an USB device and the client is a machine which uses USB device provided by a server over the network. The USB device may be either physical device connected to a server or software entity created on a server using USB gadget subsystem. The usbip-utils are userspace tools to used to handle connection and management on both side. The client needs the @file{vhci-hcd} Linux kernel module and the server needs the @file{usbip_host} Linux kernel module.") (license license:gpl2))) (define-public e2fsprogs (package (name "e2fsprogs") (version "1.47.0") (source (origin (method url-fetch) (uri (string-append "mirror://kernel.org/linux/kernel/people/tytso/" "e2fsprogs/v" version "/" "e2fsprogs-" version ".tar.xz")) (sha256 (base32 "1nymjw801lmlr5y6bg1zv9jsip5dkyxqislbdzpir4mx5czzajhl")))) (build-system gnu-build-system) (inputs (list `(,util-linux "lib"))) (native-inputs (list pkg-config texinfo ;for the libext2fs Info manual ;; For tests. perl procps)) (arguments `(;; util-linux is the preferred source for some of the libraries and ;; commands, so disable them (see, e.g., ;; <http://git.buildroot.net/buildroot/commit/?id=e1ffc2f791b33633>.) #:configure-flags (list "--disable-libblkid" "--disable-libuuid" "--disable-uuidd" "--disable-fsck" ;; Use symlinks instead of hard links for ;; 'fsck.extN' etc. This makes the resulting nar ;; smaller and is preserved across copies. "--enable-symlink-install" (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib") ;; Install libext2fs et al. "--enable-elf-shlibs") #:phases (modify-phases %standard-phases (add-before 'configure 'patch-shells (lambda _ (substitute* "configure" (("/bin/sh (.*)parse-types.sh" _ dir) (string-append (which "sh") " " dir "parse-types.sh"))) (substitute* "MCONFIG.in" (("INSTALL_SYMLINK = /bin/sh") "INSTALL_SYMLINK = sh")) (substitute* (find-files "." "^Makefile.in$") (("#!/bin/sh") (string-append "#!" (which "sh")))))) (add-after 'install 'install-libs (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (lib (string-append out "/lib"))) (invoke "make" "install-libs") ;; Make the .a writable so that 'strip' works. ;; Failing to do that, due to debug symbols, we ;; retain a reference to the final ;; linux-libre-headers, which refer to the ;; bootstrap binaries. (let ((archives (find-files lib "\\.a$"))) (for-each (lambda (file) (chmod file #o666)) archives))))) ,@(if (system-hurd?) '((add-after 'unpack 'set-PATH_MAX (lambda _ ;; Shamelessly introduce an arbitrary limit. (substitute* "misc/tune2fs.c" (("PATH_MAX") "4096")))) (add-after 'unpack 'skip-tests (lambda _ (with-directory-excursion "tests" (for-each (lambda (directory) (delete-file-recursively directory)) '("d_bad_ostype" "f_detect_junk" "f_extent_oobounds" "j_ext_long_revoke_trans" "j_ext_long_trans" "j_long_revoke_trans" "j_long_revoke_trans_mcsum_32bit" "j_long_revoke_trans_mcsum_64bit" "j_long_trans" "j_long_trans_mcsum_32bit" "j_long_trans_mcsum_64bit" "j_short_revoke_trans" "j_short_revoke_trans_mcsum_64bit" "j_short_trans_64bit" "j_short_trans" "j_short_trans_mcsum_64bit" "j_short_trans_old_csum" "j_short_trans_open_recover" "j_short_trans_recover" "j_short_trans_recover_mcsum_64bit" "j_short_uncommitted_trans" "j_short_uncommitted_trans_mcsum_64bit" "m_error_behavior" "m_minrootdir" "m_rootdir" "r_32to64bit_expand_full" "r_expand_full" "r_fixup_lastbg_big" "t_change_uuid" "t_change_uuid_mcsum" "t_change_uuid_mcsum_mounted" "t_change_uuid_mcsum_seed_mounted" "t_change_uuid_mounted" "t_disable_changed_csum_seed" "t_disable_changed_csum_seed_mounted" "t_disable_csum_seed" "t_disable_meta_csum_and_seed" "t_enable_csum_seed" "t_format_csum_seed" "t_replay_and_set" "u_compound_rollback" "u_corrupt_blk_csum" "u_corrupt_blk_csum_force" "u_corrupt_key_csum" "u_debugfs_opt" "u_dryrun" "u_e2fsck_opt" "u_errorout" "u_force" "u_force_dryrun" "u_incomplete" "u_mke2fs_opt" "u_mke2fs_opt_oddsize" "u_offset" "u_onefile_bad" "u_resize2fs_opt" "u_revert_64bitmcsum_onefile" "u_revert_all_onefile" "u_revert_upgrade_to_64bitmcsum" "u_tune2fs_opt" "u_undo_undo" "u_wrong_fs")))))) '())))) (home-page "https://e2fsprogs.sourceforge.net/") (synopsis "Creating and checking ext2/ext3/ext4 file systems") (description "This package provides tools for manipulating ext2/ext3/ext4 file systems.") (license (list license:gpl2 ;programs license:lgpl2.0 ;libext2fs license:x11)))) ;libuuid (define e2fsprogs/static (static-package (package (inherit e2fsprogs) (arguments ;; Do not build shared libraries. (substitute-keyword-arguments (package-arguments e2fsprogs) ((#:configure-flags _) '(list "--disable-blkid")) ((#:make-flags _) '(list))))))) (define-public e2fsck/static (package (name "e2fsck-static") (version (package-version e2fsprogs)) (build-system trivial-build-system) (source #f) (inputs (list e2fsprogs/static)) (arguments `(#:modules ((guix build utils)) #:builder (begin (use-modules (guix build utils) (ice-9 ftw) (srfi srfi-26)) (let ((e2fsck (search-input-file %build-inputs "/sbin/e2fsck")) (bin (string-append (assoc-ref %outputs "out") "/sbin"))) (mkdir-p bin) (with-directory-excursion bin (copy-file e2fsck "e2fsck") (remove-store-references "e2fsck") (chmod "e2fsck" #o555)) #t)))) (home-page (package-home-page e2fsprogs)) (synopsis "Statically-linked e2fsck command from e2fsprogs") (description "This package provides statically-linked e2fsck command taken from the e2fsprogs package. It is meant to be used in initrds.") (license (package-license e2fsprogs)))) (define-public extundelete (package (name "extundelete") (version "0.2.4") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/extundelete/" "extundelete/" version "/extundelete-" version ".tar.bz2")) (sha256 (base32 "1x0r7ylxlp9lbj3d7sqf6j2a222dwy2nfpff05jd6mkh4ihxvyd1")) (patches (search-patches "extundelete-e2fsprogs-1.44.patch")))) (build-system gnu-build-system) (inputs (list e2fsprogs)) (home-page "https://extundelete.sourceforge.net/") (synopsis "Recover deleted files from ext2/3/4 partitions") (description "Extundelete is a set of tools that can recover deleted files from an ext3 or ext4 partition.") (license license:gpl2))) (define-public zerofree (package (name "zerofree") (version "1.1.1") (home-page "https://frippery.org/uml/") (source (origin (method url-fetch) (uri (string-append home-page name "-" version ".tgz")) (sha256 (base32 "0rrqfa5z103ws89vi8kfvbks1cfs74ix6n1wb6vs582vnmhwhswm")))) (build-system gnu-build-system) (arguments '(#:phases (modify-phases %standard-phases (delete 'configure) ; no configure script (replace 'install ;; The Makefile lacks an ‘install’ target. (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin"))) (chmod "zerofree" #o555) (install-file "zerofree" bin) #t)))) #:tests? #f)) ; no tests (inputs `(("libext2fs" ,e2fsprogs))) (synopsis "Zero non-allocated regions in ext2/ext3/ext4 file systems") (description "Zerofree finds the unallocated blocks with non-zero value content in an ext2, ext3, or ext4 file system and fills them with zeroes (or another value). This is a simple way to make disk images more compressible. Zerofree requires the file system to be unmounted or mounted read-only.") (license license:gpl2))) (define-public strace (package (name "strace") (version "6.4") (home-page "https://strace.io") (source (origin (method url-fetch) (uri (string-append home-page "/files/" version "/strace-" version ".tar.xz")) (sha256 (base32 "0f4jxgsdr76mf51kv2kwhv39ap7kilrchkfvqrhd5pvzqnx7v617")) (patches (search-patches "strace-readlink-tests.patch")))) (build-system gnu-build-system) (arguments '(#:phases (modify-phases %standard-phases (add-after 'unpack 'patch-/bin/sh (lambda _ (substitute* "src/strace.c" (("/bin/sh") (which "sh"))))) (add-after 'unpack 'disable-failing-tests (lambda _ (substitute* "tests/Makefile.in" ;; XXX: These hang forever even if the test time-out is ;; extended. (("^\tstrace-DD?D?\\.test \\\\.*") "") (("^\tpidns-cache.test \\\\.*") "") (("^\t.*--pidns-translation.test \\\\.*") "") ;; This one fails with an encoding error. (("^\t.*net-yy-unix.test \\\\.*") ""))))) ;; Don't fail if the architecture doesn't support different ;; personalities. #:configure-flags '("--enable-mpers=check") ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32459>. #:parallel-tests? #f)) ; undeterministic failures (native-inputs (list perl)) (synopsis "System call tracer for Linux") (description "strace is a system call tracer, i.e. a debugging tool which prints out a trace of all the system calls made by a another process/program.") (properties '((release-monitoring-url . "https://github.com/strace/strace/releases"))) (license license:lgpl2.1+))) (define-public ltrace (package (name "ltrace") (version "0.7.3") (source (origin (method url-fetch) (uri (string-append "http://www.ltrace.org/ltrace_" version ".orig.tar.bz2")) (sha256 (base32 "00wmbdghqbz6x95m1mcdd3wd46l6hgcr4wggdp049dbifh3qqvqf")))) (build-system gnu-build-system) (inputs `(("libelf" ,elfutils))) (arguments ;; Compilation uses -Werror by default, but it fails. '(#:configure-flags '("--disable-werror"))) (home-page "https://www.ltrace.org/") (synopsis "Library call tracer for Linux") (description "ltrace intercepts and records dynamic library calls which are called by an executed process and the signals received by that process. It can also intercept and print the system calls executed by the program.") (license license:gpl2+))) (define-public alsa-ucm-conf (package (name "alsa-ucm-conf") (version "1.2.11") (source (origin (method url-fetch) (uri (string-append "ftp://ftp.alsa-project.org/pub/lib/" name "-" version ".tar.bz2")) (sha256 (base32 "10dfzvrmpp9swflw47nxf35an6gj3ilb4wlggdnng8g2637h2z1q")))) (build-system copy-build-system) (arguments '(#:install-plan '(("ucm" "share/alsa/ucm") ("ucm2" "share/alsa/ucm2")))) (home-page "https://www.alsa-project.org/wiki/Main_Page") (synopsis "The Advanced Linux Sound Architecture Use Case Manager") (description "This package contains Advanced Linux Sound Architecture Use Case Manager configuration of audio input/output names and routing for specific audio hardware.") (license license:bsd-3))) (define-public alsa-topology-conf (package (name "alsa-topology-conf") (version "1.2.4") (source (origin (method url-fetch) (uri (string-append "ftp://ftp.alsa-project.org/pub/lib/" name "-" version ".tar.bz2")) (sha256 (base32 "01zdg6q4s6d01k39z96wi4vbhrfw1i2g4yi5dijwfk6a5vjfdq2m")))) (build-system copy-build-system) (arguments '(#:install-plan '(("topology" "share/alsa/topology")))) (home-page "https://www.alsa-project.org/wiki/Main_Page") (synopsis "The Advanced Linux Sound Architecture libraries") (description "This package contains Advanced Linux Sound Architecture topology configuration files that can be used for specific audio hardware.") (license license:bsd-3))) (define-public alsa-lib (package (name "alsa-lib") (version "1.2.11") (source (origin (method url-fetch) (uri (string-append "https://www.alsa-project.org/files/pub/lib/" name "-" version ".tar.bz2")) (sha256 (base32 "0kdvjlknc50fwfdkxj0z12xbz21skb3gnwlh6lvsvycmp5ljygwz")))) (build-system gnu-build-system) (arguments '(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib")) #:phases (modify-phases %standard-phases (add-before 'install 'pre-install (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((ucm (string-append (assoc-ref inputs "alsa-ucm-conf"))) (topology (string-append (assoc-ref inputs "alsa-topology-conf"))) (alsa (string-append (assoc-ref outputs "out") "/share/alsa")) (ucm-share (string-append ucm "/share/alsa/ucm")) (ucm2-share (string-append ucm "/share/alsa/ucm2")) (topology-share (string-append topology "/share/alsa/topology"))) (mkdir-p alsa) (symlink ucm-share (string-append alsa "/ucm")) (symlink ucm2-share (string-append alsa "/ucm2")) (symlink topology-share (string-append alsa "/topology"))) #t))))) (inputs (list alsa-ucm-conf alsa-topology-conf)) (home-page "https://www.alsa-project.org/wiki/Main_Page") (synopsis "The Advanced Linux Sound Architecture libraries") (description "The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI functionality to the Linux-based operating system.") (license license:lgpl2.1+))) (define-public alsa-utils (package (name "alsa-utils") (version "1.2.11") (source (origin (method url-fetch) (uri (string-append "https://www.alsa-project.org/files/pub/utils/" name "-" version ".tar.bz2")) (sha256 (base32 "19r8qi6b7sd2p1mhxfqrp18wrgjw5s6rp5ygimb1w59zi0xcmils")))) (build-system gnu-build-system) (arguments (list #:configure-flags #~(list ;; The udev rule is responsible for restoring the volume. (string-append "--with-udev-rules-dir=" #$output "/lib/udev/rules.d")) #:phases #~(modify-phases %standard-phases (add-before 'install 'pre-install (lambda _ ;; Don't try to mkdir /var/lib/alsa. (substitute* "Makefile" (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*") "true\n"))))))) (native-inputs (list docbook-xml-4.2 docbook-xsl xmlto gettext-minimal)) (inputs (list libsamplerate ncurses alsa-lib)) (home-page "http://www.alsa-project.org/") (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)") (description "The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI functionality to the Linux-based operating system.") ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are ;; GPLv2-only. (license license:gpl2))) (define-public alsa-plugins (package (name "alsa-plugins") (version "1.2.2") (source (origin (method url-fetch) (uri (string-append "ftp://ftp.alsa-project.org/pub/plugins/" name "-" version ".tar.bz2")) (sha256 (base32 "0z9k3ssbfk2ky2w13avgyf202j1drsz9sv3834bp33cj1i2hc3qw")))) (build-system gnu-build-system) ;; TODO: Split libavcodec and speex if possible. It looks like they can not ;; be split, there are references to both in files. ;; TODO: Remove OSS related plugins, they add support to run native ;; ALSA applications on OSS however we do not offer OSS and OSS is ;; obsolete. (outputs '("out" "pulseaudio" "jack")) (native-search-paths (list (search-path-specification (variable "ALSA_PLUGIN_DIR") (files '("lib/alsa-lib")) (separator #f)))) (arguments `(#:configure-flags '(;; Do not install a "local" configuration targeted ;; for /etc/alsa. On Guix System plugins are loaded from ;; the ALSA service, and other distributions likely ;; won't use these files. "--with-alsalconfdir=/tmp/noop") #:phases (modify-phases %standard-phases (add-after 'install 'split (lambda* (#:key inputs outputs #:allow-other-keys) ;; Distribute the binaries to the various outputs. (let* ((out (assoc-ref outputs "out")) (jack (assoc-ref outputs "jack")) (jacklib (string-append jack "/lib/alsa-lib")) (pua (assoc-ref outputs "pulseaudio")) (pualib (string-append pua "/lib/alsa-lib"))) ;; For jack. (mkdir-p jacklib) (for-each (lambda (file) (rename-file file (string-append jacklib "/" (basename file)))) (find-files out ".*jack\\.(la|so)")) ;; For pulseaudio. (mkdir-p pualib) (for-each (lambda (file) (rename-file file (string-append pualib "/" (basename file)))) (find-files out ".*pulse\\.(la|so)")) #t)))))) (inputs (list alsa-lib jack-1 speex ; libspeexdsp resampling plugin libsamplerate ; libsamplerate resampling plugin ffmpeg ; libavcodec resampling plugin, a52 plugin pulseaudio)) ; PulseAudio plugin (native-inputs (list pkg-config)) (home-page "http://www.alsa-project.org/") (synopsis "Plugins for the Advanced Linux Sound Architecture (ALSA)") (description "The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI functionality to the Linux-based operating system. This package enhances ALSA by providing additional plugins which include: upmixing, downmixing, jackd and pulseaudio support for native alsa applications, format conversion (s16 to a52), and external rate conversion.") (license (list license:gpl2+ ;; `rate/rate_samplerate.c': LGPL v2.1 or later. license:lgpl2.1+)))) (define-public iptables (package (name "iptables") (version "1.8.8") (source (origin (method url-fetch) (uri (list (string-append "mirror://netfilter.org/iptables/iptables-" version ".tar.bz2"))) (sha256 (base32 "17w5a4znq8rdj5djcldmy6mbnxq1v88ibssk2mipc1kivj4miivi")))) (build-system gnu-build-system) (native-inputs (list pkg-config flex bison)) (inputs (list libmnl libnftnl/pinned)) (arguments (list #:tests? #f ; no test suite #:configure-flags ; add $libdir to the RUNPATH of executables #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")))) (home-page "https://www.netfilter.org/projects/iptables/index.html") (synopsis "Programs to configure Linux IP packet filtering rules") (description "@command{iptables} is the user-space command line program used to configure the Linux 2.4.x and later IPv4 packet filtering ruleset (@dfn{firewall}), including @dfn{NAT} (Network Address Translation). This package also includes @command{ip6tables}, which is used to configure the IPv6 packet filter. Both commands are targeted at system administrators.") (properties '((release-monitoring-url . "https://www.netfilter.org/pub/iptables/"))) (license license:gpl2+))) (define-public iptables-nft (package (inherit iptables) (name "iptables-nft") (source #f) (build-system copy-build-system) (arguments (list #:phases #~(modify-phases %standard-phases (delete 'unpack) (replace 'install (lambda* (#:key inputs #:allow-other-keys) (for-each (lambda (command-path) (let ((link-path (string-append #$output command-path))) (mkdir-p (dirname link-path)) (symlink (search-input-file inputs "sbin/xtables-nft-multi") link-path))) (apply append '("/bin/iptables-xml") (map (lambda (xtables) (list (string-append "/sbin/" xtables) (string-append "/sbin/" xtables "-restore") (string-append "/sbin/" xtables "-save"))) '("arptables" "ebtables" "iptables" "ip6tables"))))))))) (inputs (list iptables)) (native-inputs '()) (synopsis "Programs to configure Linux IP packet filtering rules (nftables API)"))) (define-public bolt (package (name "bolt") (version "0.9.5") (source (origin (method git-fetch) (uri (git-reference (url "https://gitlab.freedesktop.org/bolt/bolt") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "1b9z0sfrz6bj0mddng9s0dx59g9239zmrl03hxx2x88mb7r0wmcg")))) (build-system meson-build-system) (arguments (list #:configure-flags '(list "--localstatedir=/var") #:glib-or-gtk? #t ;To wrap binaries and/or compile schemas #:phases #~(modify-phases %standard-phases (add-after 'unpack 'replace-directories (lambda* (#:key outputs #:allow-other-keys) (substitute* "meson.build" (("udev.get_pkgconfig_variable..udevdir..") (string-append "'" #$output "/lib/udev'"))) (substitute* "scripts/meson-install.sh" (("mkdir.*") "")))) (add-before 'install 'no-polkit-magic (lambda* (#:key outputs #:allow-other-keys) (setenv "PKEXEC_UID" "something")))))) (native-inputs (list pkg-config `(,glib "bin") python asciidoc umockdev)) (inputs (list eudev dbus polkit)) (synopsis "Thunderbolt 3 device manager") (description "This package provides @command{boltd}, a userspace daemon for Thunderbolt devices, and @command{boltctl}, a command-line utility for managing those devices. The daemon @command{boltd} exposes devices via D-Bus to clients. It also stores a database of previously authorized devices and will, depending on the policy set for the individual devices, automatically authorize newly connected devices without user interaction. The command-line utility @command{boltctl} manages Thunderbolt devices via @command{boltd}. It can list devices, monitor changes, and initiate authorization of devices.") (home-page "https://gitlab.freedesktop.org/bolt/bolt") (license license:gpl2+))) (define-public jitterentropy-rngd (package (name "jitterentropy-rngd") (version "1.2.8") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/smuellerDD/jitterentropy-rngd") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "13br8s6gqnfc844ps38ya5nny3pndsmskszv3dsp1cxcgvmscg1c")))) (build-system gnu-build-system) (arguments (list #:tests? #f ; no test suite #:make-flags #~(list (string-append "CC=" #$(cc-for-target)) (string-append "PREFIX=" #$output) "UNITDIR=$(PREFIX)/lib/systemd/system") #:phases #~(modify-phases %standard-phases (delete 'configure)))) ; no ./configure script (home-page "https://www.chronox.de/jent.html") (synopsis "CPU jitter random number generator daemon") (description "This simple daemon feeds entropy from the CPU Jitter @acronym{RNG, random number generator} core to the kernel Linux's entropy estimator. This prevents the @file{/dev/random} device from blocking and should benefit users of the preferred @file{/dev/urandom} and @code{getrandom()} interfaces too. The CPU Jitter RNG itself is part of the kernel and claims to provide good entropy by collecting and magnifying differences in CPU execution time as measured by the high-resolution timer built into modern CPUs. It requires no additional hardware or external entropy source. The random bit stream generated by @command{jitterentropy-rngd} is not processed by a cryptographically secure whitening function. Nonetheless, its authors believe it to be a suitable source of cryptographically secure key material or other cryptographically sensitive data. If you agree with them, start this daemon as early as possible to provide properly seeded random numbers to services like SSH or those using TLS during early boot when entropy may be low, especially in virtualised environments.") (license (list license:bsd-3 ; or license:gpl2+)))) (define-public ebtables (package (name "ebtables") (version "2.0.11") (source (origin (method url-fetch) (uri (string-append "mirror://netfilter.org/ebtables/ebtables-" version ".tar.gz")) (sha256 (base32 "0apxgmkhsk3vxn9q3libxn3dgrdljrxyy4mli2gk49m7hi3na7xp")))) (build-system gnu-build-system) (inputs (list perl iptables)) (synopsis "Ethernet bridge frame table administration") (home-page "https://ebtables.netfilter.org/") (description "ebtables is an application program used to set up and maintain the tables of rules (inside the Linux kernel) that inspect Ethernet frames. It is analogous to the iptables application, but less complicated, due to the fact that the Ethernet protocol is much simpler than the IP protocol.") (license license:gpl2+))) (define-public iproute (package (name "iproute2") (version "6.4.0") (source (origin (method url-fetch) (uri (string-append "mirror://kernel.org/linux/utils/net/iproute2/iproute2-" version ".tar.xz")) (sha256 (base32 "0wm2g70vfhnf8wb6py3zmzwxp4zv1icny1pvkwaxmr67rggbhlac")))) (build-system gnu-build-system) (arguments (list ;; There is a test suite, but it wants network namespaces and sudo. #:tests? #f #:make-flags #~(let ((out #$output)) (list (string-append "CC=" #$(cc-for-target)) "HOSTCC=gcc" (string-append "BASH_COMPDIR=" out "/etc/bash_completion.d") (string-append "LIBDIR=" out "/lib") (string-append "HDRDIR=" out "/include") (string-append "SBINDIR=" out "/sbin") (string-append "CONFDIR=" out "/etc") (string-append "MANDIR=" out "/share/man"))) #:phases #~(modify-phases %standard-phases (replace 'configure (lambda* (#:key (configure-flags #~'()) #:allow-other-keys) ;; The configure script does not understand some of the ;; default options of gnu-build-system. (setenv "PKG_CONFIG" #$(pkg-config-for-target)) (apply invoke "./configure" "--prefix" #$output configure-flags))) (add-before 'install 'pre-install (lambda _ ;; Don't attempt to create /var/lib/arpd. (substitute* "Makefile" (("^.*ARPDDIR.*$") ""))))))) (inputs (list bdb iptables libmnl)) (native-inputs (list bison flex pkg-config)) ;; For tests. ;; ("libmnl" ,libmnl) ;; ("util-linux" ,util-linux) (home-page "https://wiki.linuxfoundation.org/networking/iproute2") (synopsis "Utilities for controlling TCP/IP networking and traffic in Linux") (description "Iproute2 is a collection of utilities for controlling TCP/IP networking and traffic with the Linux kernel. The most important of these are @command{ip}, which configures IPv4 and IPv6, and @command{tc} for traffic control. Most network configuration manuals still refer to ifconfig and route as the primary network configuration tools, but ifconfig is known to behave inadequately in modern network environments, and both should be deprecated.") (license license:gpl2+))) (define-public net-tools ;; XXX: This package is basically unmaintained, but it provides a few ;; commands not yet provided by Inetutils, such as 'route', so we have to ;; live with it. (let ((commit "479bb4a7e11a4084e2935c0a576388f92469225b") (revision "0")) (package (name "net-tools") (version (string-append "1.60-" revision "." (string-take commit 7))) (source (origin (method url-fetch) (uri (string-append "https://sourceforge.net/code-snapshots/git/" "n/ne/net-tools/code.git/net-tools-code-" commit ".zip")) (file-name (string-append name "-" version ".zip")) (sha256 (base32 "0hz9fda9d78spp774b6rr5xaxav7cm4h0qcpxf70rvdbrf6qx7vy")))) (home-page "https://net-tools.sourceforge.net/") (build-system gnu-build-system) (arguments `(#:modules ((guix build gnu-build-system) (guix build utils) (srfi srfi-1) (srfi srfi-26)) #:phases (modify-phases %standard-phases (replace 'configure (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (mkdir-p (string-append out "/bin")) (mkdir-p (string-append out "/sbin")) ;; Pretend we have everything... (system "yes | make config") ;; ... except for the things we don't have. ;; HAVE_AFDECnet requires libdnet, which we don't have. ;; HAVE_HWSTRIP and HAVE_HWTR require kernel headers ;; that have been removed. ;; XXX SELINUX and AFBLUETOOTH are removed for now, but we should ;; think about adding them later. (substitute* '("config.make" "config.h") (("^.*HAVE_(AFDECnet|HWSTRIP|HWTR|SELINUX|AFBLUETOOTH)[ =]1.*$") "")) #t))) (add-after 'install 'remove-redundant-commands (lambda* (#:key outputs #:allow-other-keys) ;; Remove commands and man pages redundant with Inetutils. (let* ((out (assoc-ref outputs "out")) (dup (append-map (cut find-files out <>) '("^hostname" "^(yp|nis|dns)?domainname")))) (for-each delete-file dup) #t)))) ;; Binaries that depend on libnet-tools.a don't declare that ;; dependency, making it parallel-unsafe. #:parallel-build? #f #:tests? #f ; no test suite #:make-flags (let ((out (assoc-ref %outputs "out"))) (list ,(string-append "CC=" (cc-for-target)) (string-append "BASEDIR=" out) (string-append "INSTALLNLSDIR=" out "/share/locale") (string-append "mandir=/share/man"))))) (native-inputs `(("gettext" ,gettext-minimal) ("unzip" ,unzip))) (supported-systems (delete "i586-gnu" %supported-systems)) (synopsis "Tools for controlling the network subsystem in Linux") (description "This package includes the important tools for controlling the network subsystem of the Linux kernel. This includes arp, ifconfig, netstat, rarp and route. Additionally, this package contains utilities relating to particular network hardware types (plipconfig, slattach) and advanced aspects of IP configuration (iptunnel, ipmaddr).") (license license:gpl2+)))) (define-public libcap (package (name "libcap") (version "2.64") (source (origin (method url-fetch) (uri (string-append "mirror://kernel.org/linux/libs/security/linux-privs/" "libcap2/libcap-" version ".tar.xz")) (sha256 (base32 "04qy0z6yhlljb29xxcb2srbdnymcrhsi28wrc705z3861cgmwin8")))) (build-system gnu-build-system) (arguments (list #:phases #~(modify-phases %standard-phases (delete 'configure)) #:test-target "test" #:make-flags #~(list "lib=lib" (string-append "prefix=" #$output) (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib") "RAISE_SETFCAP=no" ;; Tell the makefile to use TARGET-gcc and friends ;; when cross-compiling. #$@(if (%current-target-system) `((string-append "CROSS_COMPILE=" ,(%current-target-system) "-") "BUILD_CC=gcc") '())))) (native-inputs (list perl)) (supported-systems (delete "i586-gnu" %supported-systems)) (home-page "https://sites.google.com/site/fullycapable/") (synopsis "Library for working with POSIX capabilities") (description "Libcap2 provides a programming interface to POSIX capabilities on Linux-based operating systems.") ;; License is BSD-3 or GPLv2, at the user's choice. (license (list license:bsd-3 license:gpl2)))) (define-public bridge-utils (package (name "bridge-utils") (version "1.7.1") (source (origin (method url-fetch) (uri (string-append "mirror://kernel.org/linux/utils/net/" "bridge-utils/bridge-utils-" version ".tar.xz")) (sha256 (base32 "03p6cmhm6cqhnfsfa1wv7frhb361y12daf7gr1h5qh51y7j8n7d6")))) (build-system gnu-build-system) ;; The tarball lacks all the generated files. (native-inputs (list autoconf automake)) (arguments '(#:tests? #f)) ; no 'check' target (home-page "https://wiki.linuxfoundation.org/networking/bridge") (synopsis "Manipulate Ethernet bridges") (description "Utilities for Linux's Ethernet bridging facilities. A bridge is a way to connect two Ethernet segments together in a protocol independent way. Packets are forwarded based on Ethernet address, rather than IP address (like a router). Since forwarding is done at Layer 2, all protocols can go transparently through a bridge.") (license license:gpl2+))) (define-public libnl (package (name "libnl") (version "3.5.0") (source (origin (method url-fetch) (uri (string-append "https://github.com/thom311/libnl/releases/download/" "libnl" (string-join (string-split version #\.) "_") "/libnl-" version ".tar.gz")) (sha256 (base32 "1yh5bqmkivd78x378x34gzb28lvykn6b9k3hgvvpdnj5jpn3689m")))) (build-system gnu-build-system) (native-inputs `(("bison" ,bison) ("flex" ,flex) ("pkg-config" ,pkg-config) ("swig" ,swig) ("libnl3-doc" ,(origin (method url-fetch) (uri (string-append "https://github.com/thom311/libnl/releases/download/libnl" (string-join (string-split version #\.) "_") "/libnl-doc-" version ".tar.gz")) (sha256 (base32 "19p5y8q3cm5wqvamqc4s5syxnnkvzxy3gw8ivxk6fv9ybn8jm35h")))))) (outputs `("out" "doc")) (arguments `(#:phases (modify-phases %standard-phases (add-after 'install 'install-doc (lambda* (#:key inputs native-inputs outputs #:allow-other-keys) (let ((dest (string-append (assoc-ref outputs "doc") "/share/doc/libnl"))) (mkdir-p dest) (invoke "tar" "xf" (assoc-ref (or native-inputs inputs) "libnl3-doc") "--strip-components=1" "-C" dest))))))) (home-page "https://www.infradead.org/~tgr/libnl/") (synopsis "NetLink protocol library suite") (description "The libnl suite is a collection of libraries providing APIs to netlink protocol based Linux kernel interfaces. Netlink is an IPC mechanism primarily between the kernel and user space processes. It was designed to be a more flexible successor to ioctl to provide mainly networking related kernel configuration and monitoring interfaces.") ;; Most files are LGPLv2.1-only, but some are GPLv2-only (like ;; 'nl-addr-add.c'), so the result is GPLv2-only. (license license:gpl2))) ;; libnl python extensions used to be outputs of libnl. However, as ;; cross-compiling python extensions is currently broken, create separate ;; packages for libnl python extensions. (define (libnl-python-package python) (let ((name (string-append "libnl-" python))) (package (inherit libnl) (name name) (inputs `(,@(cond ((string=? python "python2") `(("python-2" ,python-2))) ((string=? python "python3") `(("python-3" ,python-3)))) ("libxcrypt" ,libxcrypt))) ;required by Python.h (propagated-inputs (list libnl)) (outputs '("out")) (arguments `(#:modules ((guix build gnu-build-system) (guix build utils) (srfi srfi-1)) #:phases (modify-phases %standard-phases (replace 'install (lambda* (#:key inputs outputs #:allow-other-keys) (define (python-inst python) (invoke python "setup.py" "build") (invoke python "setup.py" "install" (string-append "--prefix=" (assoc-ref %outputs "out"))) (invoke python "setup.py" "clean")) (setenv "LDFLAGS" (format #f "-Wl,-rpath=~a/lib" (assoc-ref inputs "libnl"))) (with-directory-excursion "./python" (python-inst ,python)) #t)))))))) (define-public libnl-python2 (libnl-python-package "python2")) (define-public libnl-python3 (libnl-python-package "python3")) (define-public iw (package (name "iw") (version "5.19") (source (origin (method url-fetch) (uri (string-append "mirror://kernel.org/software/network/iw/iw-" version ".tar.xz")) (sha256 (base32 "0kjdrihc7ibnjdpjqkq8sv0kmmvavgsww78cpjgbnlyx8zlvnrzi")))) (build-system gnu-build-system) (native-inputs (list pkg-config)) (inputs (list libnl)) (arguments (list #:make-flags #~(list (string-append "CC=" #$(cc-for-target)) (string-append "PKG_CONFIG=" #$(pkg-config-for-target)) (string-append "PREFIX=" (assoc-ref %outputs "out"))) #:phases #~(modify-phases %standard-phases (delete 'configure)))) ; no configure script (home-page "https://wireless.wiki.kernel.org/") (synopsis "Tool for configuring wireless devices") (description "iw is a new nl80211 based CLI configuration utility for wireless devices. It replaces @code{iwconfig}, which is deprecated.") (license license:isc))) (define-public powertop (package (name "powertop") (version "2.15") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/fenrus75/powertop") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "10vbk4vplmzp3p1mhwnhj81g6i5xvam9pdvmiy6cmd0xvnmdyy77")))) (build-system gnu-build-system) (arguments '(#:configure-flags (list "LDFLAGS=-pthread") #:phases (modify-phases %standard-phases ;; TODO: Patch some hardcoded "wlan0" in calibrate/calibrate.cpp to ;; allow calibrating the network interface in Guix System. (add-after 'unpack 'patch-absolute-file-names (lambda* (#:key inputs #:allow-other-keys) (let ((kmod (assoc-ref inputs "kmod"))) (substitute* (find-files "src" "\\.cpp$") ;; Give the right 'modprobe' file name so that essential ;; modules such as msr.ko can be loaded. (("/sbin/modprobe") (string-append kmod "/bin/modprobe")) ;; These programs are only needed to calibrate, so using ;; relative file names avoids adding extra inputs. When they ;; are missing powertop gracefully handles it. (("/usr/s?bin/(hciconfig|hcitool|xset)" _ command) command)))))))) (native-inputs (list autoconf autoconf-archive automake gettext-minimal libtool pkg-config)) (inputs (list kmod libnl ncurses pciutils zlib)) (home-page "https://01.org/powertop/") (synopsis "Analyze power consumption on x86-based laptops") (description "PowerTOP is a Linux tool to diagnose issues with power consumption and power management. In addition to being a diagnostic tool, PowerTOP also has an interactive mode where the user can experiment various power management settings for cases where the operating system has not enabled these settings.") (license license:gpl2))) (define-public aumix (package (name "aumix") (version "2.9.1") (source (origin (method url-fetch) (uri (string-append "https://web.archive.org/web/20211201184543/" "http://www.jpj.net/~trevor/aumix/releases/aumix-" version ".tar.bz2")) (sha256 (base32 "0a8fwyxnc5qdxff8sl2sfsbnvgh6pkij4yafiln0fxgg6bal7knj")))) (build-system gnu-build-system) (arguments ;; Allow compilation with GCC 10. '(#:configure-flags '("CFLAGS=-O2 -g -fcommon"))) (inputs (list ncurses)) (home-page (string-append "https://web.archive.org/web/20211201184543/" "http://jpj.net/~trevor/aumix.html")) (synopsis "Audio mixer for X and the console") (description "Aumix adjusts an audio mixer from X, the console, a terminal, the command line or a script.") (license license:gpl2+))) (define-public iotop-python ;; The last release is from 2013 and gives a misleading CONFIG_TASK_DELAY_ACCT ;; error on ‘newer’ kernels. (let ((revision "0") (commit "a14256a3ff74eeee59493ac088561f1bafab85a7")) (package (name "iotop-python") (version (git-version "0.6" revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://repo.or.cz/iotop.git") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "00h5p8fk1zi237q8mqds8apqbis9iw0yih1hl0pr63dsnyzmmrpw")))) (build-system python-build-system) (arguments '(#:phases (modify-phases %standard-phases (add-after 'unpack 'fix-build-with-python3 (lambda _ (substitute* "setup.py" (("itervalues") "values"))))) ;; There are currently no checks in the package. #:tests? #f)) (native-inputs (list python)) (home-page "http://guichaz.free.fr/iotop/") (synopsis "Displays the IO activity of running processes") (description "Iotop is a Python program with a top like user interface to show the processes currently causing I/O.") (license license:gpl2+)))) (define-public iotop (package (name "iotop") (version "1.26") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/Tomas-M/iotop") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0raac1sp46mls6p0a4yzzc8iqxkw0da4zq54cwjdg4wcy8g43glv")))) (build-system gnu-build-system) (arguments (list #:make-flags #~(list (string-append "CC=" #$(cc-for-target)) (string-append "PREFIX=" #$output)) #:tests? #f ; no tests #:phases #~(modify-phases %standard-phases (delete 'configure)))) ; no configure script (native-inputs (list pkg-config)) (inputs (list ncurses)) (home-page "https://github.com/Tomas-M/iotop") (synopsis "Interactive @command{top}-like input/output activity monitor") (description "iotop identifies which processes and threads are most responsible for @acronym{I/O, input/output} activity such as disc reads and writes. It sorts them in a live, interactive table overview similar to that of the well-known @command{top}. This information makes it much easier for an administrator to see which tasks are blocking others and adjust their priority (using @command{ionice}) or stop or kill them altogether.") (license license:gpl2+))) (define-public fuse (package (name "fuse") (version "3.10.5") (source (origin (method url-fetch) (uri (string-append "https://github.com/libfuse/libfuse/releases/" "download/fuse-" version "/fuse-" version ".tar.xz")) (sha256 (base32 "0rlnnsiw614qcmgy8xz67044gqc1pbvvf2yxjv44lh27bm487qmj")))) (build-system meson-build-system) (inputs (list bash-minimal util-linux)) (arguments `(#:configure-flags ,#~(list (string-append "-Dudevrulesdir=" #$output "/udev/rules.d") "-Duseroot=false") #:tests? #f #:phases ,#~(modify-phases %standard-phases (add-after 'unpack 'set-file-names (lambda* (#:key inputs #:allow-other-keys) ;; libfuse calls out to mount(8) and umount(8). Make sure ;; it refers to the right ones. (substitute* '("lib/mount_util.c") (("/bin/(u?)mount" _ maybe-u) (search-input-file inputs (string-append "bin/" maybe-u "mount")))) (substitute* '("util/mount.fuse.c") (("/bin/sh") (search-input-file inputs "/bin/sh"))) ;; This hack leads libfuse to search for 'fusermount' in ;; $PATH, where it may find a setuid-root binary, instead of ;; trying solely $out/sbin/fusermount and failing because ;; it's not setuid. (substitute* "lib/meson.build" (("-DFUSERMOUNT_DIR=[[:graph:]]+") "-DFUSERMOUNT_DIR=\"/var/empty\"'")))) (add-after 'unpack 'fix-install (lambda* (#:key inputs #:allow-other-keys) (substitute* '("util/meson.build") (("install_helper.sh") "true")) (substitute* '("util/meson.build") (("fuseconf_path = .*") "fuseconf_path = '/etc/fuse.conf'")))) (add-before 'configure 'set-paths (lambda* (#:key inputs outputs #:allow-other-keys) (let ((dummy-init.d (string-append (getcwd) "/etc/init.d"))) (setenv "MOUNT_FUSE_PATH" (string-append #$output "/sbin")) (setenv "UDEV_RULES_PATH" (string-append #$output "/lib/udev/rules.d")))))))) (supported-systems (delete "i586-gnu" %supported-systems)) (home-page "https://github.com/libfuse/libfuse") (synopsis "Support file systems implemented in user space") (description "As a consequence of its monolithic design, file system code for Linux normally goes into the kernel itself---which is not only a robustness issue, but also an impediment to system extensibility. FUSE, for \"file systems in user space\", is a kernel module and user-space library that tries to address part of this problem by allowing users to run file system implementations as user-space processes.") (license (list license:lgpl2.1 ; library license:gpl2+)))) ; command-line utilities (define-public fuse-2 (package (inherit fuse) (name "fuse") (version "2.9.9") (source (origin (method url-fetch) (uri (string-append "https://github.com/libfuse/libfuse/releases/" "download/fuse-" version "/fuse-" version ".tar.gz")) (sha256 (base32 "1ddlq6kzxilccgbvxjfx80jx6kamgw4sv49phks2zhlcc1frvrnh")) (patches (search-patches "fuse-overlapping-headers.patch" "fuse-glibc-2.34.patch")))) (build-system gnu-build-system) (native-inputs (list autoconf automake gettext-minimal libtool)) (arguments '(#:tests? #t #:configure-flags (list (string-append "MOUNT_FUSE_PATH=" (assoc-ref %outputs "out") "/sbin") (string-append "INIT_D_PATH=" (assoc-ref %outputs "out") "/etc/init.d") ;; The rule makes /dev/fuse 666. (string-append "UDEV_RULES_PATH=" (assoc-ref %outputs "out") "/lib/udev/rules.d")) #:phases (modify-phases %standard-phases (add-before 'bootstrap 'force-bootstrap (lambda _ ;; Force a bootstrap to make the patch changes effective. (delete-file "configure"))) (add-before 'build 'set-file-names (lambda* (#:key inputs #:allow-other-keys) ;; libfuse calls out to mount(8) and umount(8). Make sure ;; it refers to the right ones. (substitute* '("lib/mount_util.c" "util/mount_util.c") (("/bin/(u?)mount" _ maybe-u) (search-input-file inputs (string-append "bin/" maybe-u "mount")))) (substitute* '("util/mount.fuse.c") (("/bin/sh") (search-input-file inputs "/bin/sh"))) ;; This hack leads libfuse to search for 'fusermount' in ;; $PATH, where it may find a setuid-root binary, instead of ;; trying solely $out/sbin/fusermount and failing because ;; it's not setuid. (substitute* "lib/Makefile" (("-DFUSERMOUNT_DIR=[[:graph:]]+") "-DFUSERMOUNT_DIR=\\\"/var/empty\\\""))))))))) (define-public unionfs-fuse (package (name "unionfs-fuse") (version "3.3") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/rpodgorny/unionfs-fuse") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1wl5m5qnwf3s1792xphr35pb80sx8ybaqi3n3ddi5vvk3qjc4iws")))) (build-system cmake-build-system) (arguments (list #:phases #~(modify-phases %standard-phases (replace 'check ;; The epitome of ‘I tried’: run the 2 trivial tests that don't rely ;; on the fuse kernel module being loaded. All others would fail. (lambda* (#:key tests? #:allow-other-keys) (when tests? (invoke "pytest" "../source/test_all.py" "-k" "test_help"))))))) (native-inputs (list pkg-config ;; Only for the test ‘suite’. python python-pytest)) (inputs (list fuse)) (home-page "https://github.com/rpodgorny/unionfs-fuse") (synopsis "User-space union file system") (description "UnionFS-FUSE is a flexible union file system implementation in user space, using the FUSE library. Mounting a union file system allows you to \"aggregate\" the contents of several directories into a single mount point. UnionFS-FUSE additionally supports copy-on-write.") (license license:bsd-3))) (define fuse-static (package (inherit fuse) (name "fuse-static") (source (origin (inherit (package-source fuse)) (modules '((guix build utils))) (snippet #~(begin ;; Normally libfuse invokes mount(8) so that /etc/mtab is updated. ;; Change calls to 'mtab_needs_update' to 0 so that it doesn't do ;; that, allowing us to remove the dependency on util-linux ;; (something that is useful in initrds.) (substitute* "lib/mount_util.c" (("mtab_needs_update[[:blank:]]*\\([a-z_]+\\)") "0") (("/bin/") "")))))) (arguments (substitute-keyword-arguments (package-arguments fuse) ((#:configure-flags flags '()) #~(cons "-Ddefault_library=static" #$flags)))))) (define-public unionfs-fuse/static (package (inherit unionfs-fuse) (synopsis "User-space union file system (statically linked)") (name (string-append (package-name unionfs-fuse) "-static")) (source (origin (inherit (package-source unionfs-fuse)) (modules '((guix build utils))) (snippet #~(begin ;; Add -ldl to the libraries, because libfuse.a needs that. (substitute* "src/CMakeLists.txt" (("target_link_libraries(.*)\\)" _ libs) (string-append "target_link_libraries" libs " dl)"))))))) (arguments (substitute-keyword-arguments (package-arguments unionfs-fuse) ((#:configure-flags flags #~'()) #~(cons "-DCMAKE_EXE_LINKER_FLAGS=-static" #$flags)) ((#:phases phases #~%standard-phases) #~(modify-phases #$phases (add-after 'install 'post-install (lambda _ ;; By default, 'unionfs' keeps references to ;; $glibc/share/locale and similar stuff. Remove them. (remove-store-references (string-append #$output "/bin/unionfs")) ;; 'unionfsctl' has references to glibc as well. Since ;; we don't need it, remove it. (delete-file (string-append #$output "/bin/unionfsctl")))))))) (inputs (list fuse-static)))) (define-public sshfs (package (name "sshfs") (version "3.7.3") (source (origin (method url-fetch) (uri (string-append "https://github.com/libfuse/sshfs/releases/" "download/sshfs-" version "/sshfs-" version ".tar.xz")) (sha256 (base32 "169fkilv060afgp9h7hvsbkg02bd1y77kmx06x0s7q1cvmxww62j")))) (build-system meson-build-system) (arguments ;; XXX: tests are skipped: FUSE kernel module does not seem to be loaded '(#:tests? #f)) (inputs (list fuse glib)) (native-inputs (list pkg-config ;; man page python-docutils)) (home-page "https://github.com/libfuse/sshfs") (synopsis "Mount remote file systems over SSH") (description "This is a file system client based on the SSH File Transfer Protocol. Since most SSH servers already support this protocol it is very easy to set up: on the server side there's nothing to do; on the client side mounting the file system is as easy as logging into the server with an SSH client.") (license license:gpl2+))) (define-public sshfs-fuse (package (inherit sshfs) (name "sshfs-fuse") (properties `((superseded . ,sshfs))))) (define-public archivemount (package (name "archivemount") (version "0.9.1") (source (origin (method url-fetch) (uri (string-append "https://www.cybernoia.de/software/archivemount/" "archivemount-" version ".tar.gz")) (sha256 (base32 "1cy5b6qril9c3ry6fv7ir87s8iyy5vxxmbyx90dm86fbra0vjaf5")))) (build-system gnu-build-system) (inputs (list fuse-2 libarchive)) (native-inputs (list pkg-config)) (home-page "https://www.cybernoia.de/software/archivemount.html") (synopsis "Tool for mounting archive files with FUSE") (description "archivemount is a FUSE-based file system for Unix variants, including Linux. Its purpose is to mount archives (i.e. tar, tar.gz, etc.) to a mount point where it can be read from or written to as with any other file system. This makes accessing the contents of the archive, which may be compressed, transparent to other programs, without decompressing them.") (license license:lgpl2.0+))) (define-public numactl (package (name "numactl") (version "2.0.16") (source (origin (method url-fetch) (uri (string-append "https://github.com/numactl/numactl/releases/download/v" version "/numactl-" version ".tar.gz")) (sha256 (base32 "1j67wx3383fwqbvhg4nwqf72vpdgimmrvkpn3b9s2xzr7a4jy90v")))) (build-system gnu-build-system) (arguments `(,@(if (target-riscv64?) `(#:make-flags (list "LDFLAGS=-latomic")) '()) ;; There's a 'test' target, but it requires NUMA support in the kernel ;; to run, which we can't assume to have. #:tests? #f)) (home-page "https://github.com/numactl/numactl") (synopsis "Tools for non-uniform memory access (NUMA) machines") (description "NUMA stands for Non-Uniform Memory Access, in other words a system whose memory is not all in one place. The @command{numactl} program allows you to run your application program on specific CPUs and memory nodes. It does this by supplying a NUMA memory policy to the operating system before running your program. The package contains other commands, such as @command{numastat}, @command{memhog}, and @command{numademo} which provides a quick overview of NUMA performance on your system.") (license (list license:gpl2 ;programs license:lgpl2.1)))) ;library (define-public kbd-neo (package (name "kbd-neo") (version "2486") (source (origin (method url-fetch) (uri (string-append "https://svn.neo-layout.org/!svn/bc/" version "/linux/console/neo.map")) (file-name (string-append name "-" version ".map")) (sha256 (base32 "19mfrd31vzpsjiwc7pshxm0b0sz5dd17xrz6k079cy4im1vf0r4g")))) (build-system trivial-build-system) (arguments `(#:modules ((guix build utils)) #:builder (begin (use-modules (guix build utils)) (let ((out (string-append %output "/share/keymaps")) (source (assoc-ref %build-inputs "source"))) (mkdir-p out) (copy-file source (string-append out "/neo.map")) #t)))) (home-page "https://neo-layout.org") (synopsis "Neo2 console layout") (description "Kbd-neo provides the Neo2 keyboard layout for use with @command{loadkeys(1)} from @code{kbd(4)}.") ;; The file is located in an svn directory, the entire content of ;; the directory is licensed as GPL3. (license license:gpl3+))) (define-public kbd (package (name "kbd") (version "2.5.1") (source (origin (method url-fetch) (uri (string-append "mirror://kernel.org/linux/utils/kbd/kbd-" version ".tar.xz")) (sha256 (base32 "10s608i4blprgy9nynlid0hglfdrrgln6wwjs9rhjf56hwilbpyc")) (modules '((guix build utils))) (snippet '(begin (substitute* '("src/unicode_start" "src/unicode_stop") ;; Assume the Coreutils are in $PATH. (("/usr/bin/tty") "tty")))))) (build-system gnu-build-system) (arguments '(#:phases (modify-phases %standard-phases (add-before 'build 'pre-build (lambda* (#:key inputs #:allow-other-keys) (let ((bzip2 (assoc-ref inputs "bzip2")) (gzip (assoc-ref inputs "gzip")) (xz (assoc-ref inputs "xz")) (zstd (assoc-ref inputs "zstd"))) (substitute* "src/libkbdfile/kbdfile.c" (("bzip2") (string-append bzip2 "/bin/bzip2")) (("gzip") (string-append gzip "/bin/gzip")) (("xz -d") (string-append xz "/bin/xz -d")) (("zstd") (string-append zstd "/bin/zstd")))))) (add-after 'install 'post-install (lambda* (#:key outputs #:allow-other-keys) ;; Make sure these programs find their comrades. (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin"))) (for-each (lambda (prog) (wrap-program (string-append bin "/" prog) `("PATH" ":" prefix (,bin)))) '("unicode_start" "unicode_stop")))))))) (native-inputs (list autoconf pkg-config)) (inputs `(("bash" ,bash-minimal) ; for wrap-program ("bzip2" ,bzip2) ("gzip" ,gzip) ("pam" ,linux-pam) ("xz" ,xz) ("zstd" ,zstd))) (native-search-paths (list (search-path-specification (variable "LOADKEYS_KEYMAP_PATH") ;; Append ‘/**’ to recursively search all directories. One can then ;; run (for example) ‘loadkeys en-latin9’ instead of having to find ;; and type ‘i386/colemak/en-latin9’ on a mislabelled keyboard. (files (list "share/keymaps/**"))))) (home-page "https://kbd-project.org/") (synopsis "Linux keyboard utilities and keyboard maps") (description "This package contains keytable files and keyboard utilities compatible for systems using the Linux kernel. This includes commands such as @code{loadkeys}, @code{setfont}, @code{kbdinfo}, and @code{chvt}.") (license license:gpl2+))) (define-public loadkeys-static (package (inherit kbd) (name "loadkeys-static") (arguments (substitute-keyword-arguments (package-arguments kbd) ((#:configure-flags flags ''()) `(append '("LDFLAGS=-static" "--disable-shared" "--disable-nls" "--disable-vlock" ;so we don't need libpam "--disable-libkeymap") ,flags)) ((#:make-flags flags ''()) `(cons "LDFLAGS=-all-static -lrt -lpthread" ,flags)) ((#:phases phases '%standard-phases) `(modify-phases ,phases (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) ;; The binary keeps references to gzip, among other things, ;; which we don't need in the initrd, so strip references. (remove-store-references "src/loadkeys") (install-file "src/loadkeys" (string-append out "/bin"))))) (delete 'post-install))) ((#:strip-flags _ '()) ''("--strip-all")) ((#:allowed-references _ '()) '()))) (synopsis "Statically-linked @command{loadkeys} program") ;; This package is meant to be used internally in the initrd so don't ;; expose it. (properties '((hidden? . #t))))) (define-public inotify-tools (package (name "inotify-tools") (version "3.22.6.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/rvoicilas/inotify-tools") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "1j9j8k5zjp8m4cl53zjncnll9z4dnvzr4ygmfcjk0ci81i59b18i")))) (build-system gnu-build-system) (native-inputs (list autoconf automake libtool)) (arguments `(#:configure-flags (list "--disable-static"))) (home-page "https://github.com/rvoicilas/inotify-tools/wiki") (synopsis "Monitor file accesses") (description "The inotify-tools packages provides a C library and command-line tools to use Linux' inotify mechanism, which allows file accesses to be monitored.") (license license:gpl2+))) (define-public kmod (package (name "kmod") (version "29") (source (origin (method url-fetch) (uri (string-append "mirror://kernel.org/linux/utils/kernel/kmod/" "kmod-" version ".tar.xz")) (sha256 (base32 "0am54mi5rk72g5q7k6l6f36gw3r9vwgjmyna43ywcjhqmakyx00b")) (patches (search-patches "kmod-module-directory.patch")))) (build-system gnu-build-system) (arguments (list #:configure-flags #~(list "--with-xz" "--with-zlib" "--with-zstd" "--disable-test-modules") #:phases #~(modify-phases %standard-phases (add-after 'unpack 'disable-tests (lambda _ ;; XXX: These tests need '--sysconfdir=/etc' to pass. (substitute* "Makefile.in" (("testsuite/test-modprobe") "") (("testsuite/test-depmod") "") (("testsuite/test-blacklist") "")))) (add-after 'install 'install-modprobe&co (lambda _ (for-each (lambda (tool) (symlink "kmod" (string-append #$output "/bin/" tool))) '("insmod" "rmmod" "lsmod" "modprobe" "modinfo" "depmod"))))))) (native-inputs (list pkg-config zstd)) ;zstd needed for tests (inputs (list xz zlib `(,zstd "lib"))) (supported-systems (delete "i586-gnu" %supported-systems)) (home-page "https://www.kernel.org/") (synopsis "Kernel module tools") (description "Kmod is a set of tools to handle common tasks with Linux kernel modules like insert, remove, list, check properties, resolve dependencies and aliases. These tools are designed on top of libkmod, a library that is shipped with kmod. The aim is to be compatible with tools, configurations and indices from the module-init-tools project.") (license license:gpl2+))) ; library under lgpl2.1+ (define-public earlyoom (package (name "earlyoom") (version "1.7") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/rfjakob/earlyoom") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1xqrs6wz59ks76hdgfd4vaj010kbvllilgam2xxyn0g56kai71zi")))) (build-system gnu-build-system) (arguments (list #:phases #~(modify-phases %standard-phases (delete 'configure) ; no configure script (add-before 'check 'set-go-HOME (lambda _ (setenv "HOME" (getcwd)))) (add-before 'check 'disable-failing-test (lambda _ ;; This test relies on writing to /proc/%d/oom_score_adj. (substitute* "testsuite_cli_test.go" (("TestI" match) (string-append "skipped" match)))))) #:make-flags #~(list (string-append "CC=" #$(cc-for-target)) (string-append "VERSION=v" #$version) (string-append "PREFIX=" #$output) (string-append "SYSCONFDIR=" #$output "/etc") "GO111MODULE=off") #:test-target "test")) (native-inputs (append ;; To generate the manpage. (if (or (target-x86-64?) (target-x86-32?)) (list pandoc) '()) (list ;; For the test suite. cppcheck go))) (home-page "https://github.com/rfjakob/earlyoom") (synopsis "Simple out of memory (OOM) daemon for the Linux kernel") (description "Early OOM is a minimalist out of memory (OOM) daemon that runs in user space and provides a more responsive and configurable alternative to the in-kernel OOM killer.") (license license:expat))) (define-public eudev (package (name "eudev") (version "3.2.14") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/gentoo/eudev") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1f6lz57igi7iw2ls3fpzgw42bfznam4nf9368h7x8yf1mb737yxz")) (patches (search-patches "eudev-rules-directory.patch")) (modules '((guix build utils))))) (build-system gnu-build-system) (arguments (list #:phases #~(modify-phases %standard-phases (add-before 'bootstrap 'patch-file-names (lambda* (#:key inputs native-inputs #:allow-other-keys) (substitute* "man/make.sh" (("/usr/bin/xsltproc") (search-input-file (or native-inputs inputs) "/bin/xsltproc"))))) (add-before 'bootstrap 'install-in-lib (lambda _ ;; When the udev-service-type instantiates /etc, it collects ;; hardware files from the <package>/lib/udev/hwdb.d directories ;; of different packages. Since we set sysconfdir to /etc, the ;; only package-dependent location we can install hwdb files is ;; in <package>/lib/udev/hwdb.d. Eudev is configured to install ;; these files in sysconfdir, but they should be placed into ;; udevlibexecdir. (copy-file "hwdb/Makefile.am" "hwdb/files.am") (call-with-output-file "hwdb/Makefile.am" (lambda (port) (format port "hardwarelibdir = $(udevlibexecdir)/hwdb.d\n") (format port "include ./files.am"))) (substitute* "hwdb/files.am" (("dist_udevhwdb_DATA =") "dist_hardwarelib_DATA =")) ;; Do not install the empty udev.conf template. (substitute* "src/udev/Makefile.am" (("dist_udevconf_DATA =") "dist_noinst_DATA =")) ;; Do not ensure that /etc/udev/rules.d exists. (substitute* "rules/Makefile.am" (("\\$\\(MKDIR_P\\) \\$\\(DESTDIR\\)\\$\\(udevconfdir\\)/rules\\.d") "true")))) (add-after 'install 'move-static-library (lambda _ (let ((source (string-append #$output "/lib/libudev.a")) (target (string-append #$output:static "/lib/libudev.a"))) (mkdir-p (dirname target)) (link source target) (delete-file source) ;; Remove reference to the static library from the .la file ;; such that Libtool looks for it in the usual places. (substitute* (string-append #$output "/lib/libudev.la") (("old_library=.*") "old_library=''\n")))))) #:configure-flags #~(list "--enable-manpages" ;; By default, autoconf uses $prefix/etc. The udev-service-type ;; makes sure /etc is set up with rules and hardware file ;; descriptions. "--sysconfdir=/etc"))) (native-search-paths (list (search-path-specification (variable "UDEV_HWDB_PATH") (files '("lib/udev/hwdb.d"))))) (native-inputs (list autoconf automake gperf libtool pkg-config ;; For tests. perl python-wrapper