You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

6434 lines
264 KiB

<
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
;;; Copyright © 2015, 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
;;; Copyright © 2016, 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2016, 2017 Alex Kost <alezost@gmail.com>
;;; Copyright © 2016 Raymond Nicholson <rain1@openmailbox.org>
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2016, 2018, 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2016 John Darrington <jmd@gnu.org>
;;; Copyright © 2016, 2017, 2018, 2019, 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2016, 2018 Rene Saavedra <pacoon@protonmail.com>
;;; Copyright © 2016 Carlos Sánchez de La Lama <csanchezdll@gmail.com>
;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
;;; Copyright © 2017, 2018 Leo Famulari <leo@famulari.name>
;;; Copyright © 2017 José Miguel Sánchez García <jmi2k@openmailbox.com>
;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
;;; Copyright © 2017 nee <nee-git@hidamari.blue>
;;; Copyright © 2017 Dave Love <fx@gnu.org>
;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
;;; Copyright © 2018 Brendan Tildesley <mail@brendan.scot>
;;; Copyright © 2018 Manuel Graf <graf@init.at>
;;; Copyright © 2018 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2018 Vasile Dumitrascu <va511e@yahoo.com>
;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
;;; Copyright © 2019, 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2019 Stefan Stefanović <stefanx2ovic@gmail.com>
;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2019 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
;;; Copyright © 2020 Chris Marusich <cmmarusich@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages linux)
#:use-module (gnu packages)
#:use-module (gnu packages acl)
#:use-module (gnu packages admin)
#:use-module (gnu packages algebra)
#:use-module (gnu packages attr)
#:use-module (gnu packages audio)
#:use-module (gnu packages autotools)
#:use-module (gnu packages backup)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages bison)
#:use-module (gnu packages calendar)
#:use-module (gnu packages check)
#:use-module (gnu packages crypto)
#:use-module (gnu packages cryptsetup)
#:use-module (gnu packages compression)
#:use-module (gnu packages dbm)
#:use-module (gnu packages datastructures)
#:use-module (gnu packages docbook)
#:use-module (gnu packages documentation)
#:use-module (gnu packages elf)
#:use-module (gnu packages flex)
#:use-module (gnu packages file)
#:use-module (gnu packages freedesktop)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gettext)
#:use-module (gnu packages glib)
#:use-module (gnu packages golang)
#:use-module (gnu packages gperf)
#:use-module (gnu packages gstreamer)
#:use-module (gnu packages gtk)
#:use-module (gnu packages haskell-apps)
#:use-module (gnu packages haskell-xyz)
#:use-module (gnu packages libunwind)
#:use-module (gnu packages libusb)
#:use-module (gnu packages man)
#:use-module (gnu packages maths)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages netpbm)
#:use-module (gnu packages networking)
#:use-module (gnu packages ninja)
#:use-module (gnu packages nss)
#:use-module (gnu packages perl)
#:use-module (gnu packages pciutils)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages popt)
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages readline)
#:use-module (gnu packages rrdtool)
#:use-module (gnu packages samba)
#:use-module (gnu packages sdl)
#:use-module (gnu packages serialization)
#:use-module (gnu packages slang)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages tls)
#:use-module (gnu packages valgrind)
#:use-module (gnu packages video)
#:use-module (gnu packages web)
#:use-module (gnu packages xiph)
#:use-module (gnu packages xml)
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages xorg)
#:use-module (gnu packages groff)
#:use-module (gnu packages rsync)
#:use-module (gnu packages selinux)
#:use-module (gnu packages swig)
#:use-module (guix build-system cmake)
#:use-module (guix build-system gnu)
#:use-module (guix build-system go)
#:use-module (guix build-system meson)
#:use-module (guix build-system python)
#: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 (srfi srfi-1)
#:use-module (srfi srfi-2)
#:use-module (srfi srfi-26)
#:use-module (ice-9 match))
(define-public (system->linux-architecture arch)
"Return the Linux architecture name for ARCH, a Guix system name such as
\"x86_64-linux\" or a target triplet such as \"arm-linux-gnueabihf\"."
(let ((arch (car (string-split arch #\-))))
(cond ((string=? arch "i686") "i386")
((string-prefix? "mips" arch) "mips")
((string-prefix? "arm" arch) "arm")
((string-prefix? "aarch64" arch) "arm64")
((string-prefix? "alpha" arch) "alpha")
((string-prefix? "powerpc" arch) "powerpc") ;including "powerpc64le"
((string-prefix? "s390" arch) "s390")
((string-prefix? "riscv" arch) "riscv")
(else 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? "powerpc64le-" system) "ppc64_defconfig")
(else "defconfig")))
;;;
;;; Kernel source code deblobbing.
;;;
(define (linux-libre-deblob-scripts version
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/"
"deblob-" (version-major+minor version)))
(sha256 deblob-hash))
(origin
(method url-fetch)
(uri (string-append "https://linux-libre.fsfla.org"
"/pub/linux-libre/releases/" version "-gnu/"
"deblob-check"))
(sha256 deblob-check-hash))))
(define deblob-scripts-5.4
(linux-libre-deblob-scripts
"5.4.19"
(base32 "0ckxn7k5zgcqk30dq943bnamr6a6zjbw2aqjl3x30f4kvh5f6k25")
(base32 "1ajzwyy6vgmihxpz3sbshzfzd0w8yzj0fihv0d5rjpr4z3gm48bk")))
(define deblob-scripts-4.19
(linux-libre-deblob-scripts
"4.19.103"
(base32 "02zs405awaxydbapka4nz8h6lmnc0dahgczqsrs5s2bmzjyyqkcy")
(base32 "1w2wgxblpq09i33qmqgw5v3r5rm9vkkygr6m0sgv4zgczk9s29wr")))
(define deblob-scripts-4.14
(linux-libre-deblob-scripts
"4.14.170"
(base32 "091jk9jkn9jf39bxpc7395bhcb7p96nkg3a8047380ki06lnfxh6")
(base32 "1qij18inijj6c3ma8hv98yjagnzxdxyn134da9fd23ky8q6hbvky")))
(define deblob-scripts-4.9
(linux-libre-deblob-scripts
"4.9.213"
(base32 "1wvldzlv7q2xdbadas87dh593nxr4a8p5n0f8zpm72lja6w18hmg")
(base32 "0fxajshb75siq39lj5h8xvhdj8lcmddkslwlyj65rhlwk6g2r4b2")))
(define deblob-scripts-4.4
(linux-libre-deblob-scripts
"4.4.213"
(base32 "0x2j1i88am54ih2mk7gyl79g25l9zz4r08xhl482l3fvjj2irwbw")
(base32 "0hhin1jpfkd6nwrb6xqxjzl3hdxy4pn8a15hy2d3d83yw6pflbsf")))
(define* (computed-origin-method gexp-promise hash-algo hash
#:optional (name "source")
#:key (system (%current-system))
(guile (default-guile)))
"Return a derivation that executes the G-expression that results
from forcing GEXP-PROMISE."
(mlet %store-monad ((guile (package->derivation guile system)))
(gexp->derivation (or name "computed-origin")
(force gexp-promise)
#:graft? #f ;nothing to graft
#:system system
#:guile-for-build guile)))
(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))
(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)
;; The comments in the 'deblob-check' script
;; claim that it supports Python 2 and 3, but
;; in fact it fails when run in Python 3 as
;; of version 5.1.3.
#+python-2))
(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...~%")
(force-output)
(invoke "cp" "--archive" #+upstream-source dir)
(invoke "chmod" "--recursive" "u+w" dir))
(begin
(format #t "Unpacking upstream linux tarball...~%")
(force-output)
(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
(setenv "PYTHON" (which "python"))
(format #t "Running deblob script...~%")
(force-output)
(invoke "/tmp/bin/deblob"))
(format #t "~%Packing new Linux-libre tarball...~%")
(force-output)
(invoke "tar" "cvfa" #$output
;; Avoid non-determinism in the archive.
"--mtime=@0"
"--owner=root:0"
"--group=root:0"
"--sort=name"
"--hard-dereference"
dir))))))))))
;;;
;;; Kernel sources.
;;;
(define (linux-libre-urls version)
"Return a list of URLs for Linux-Libre VERSION."
(list (string-append
"https://linux-libre.fsfla.org/pub/linux-libre/releases/"
version "-gnu/linux-libre-" version "-gnu.tar.xz")
;; XXX: Work around <http://bugs.gnu.org/14851>.
(string-append
"ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
version "-gnu.tar.xz")
;; Maybe this URL will become valid eventually.
(string-append
"mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
version "-gnu.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)))
(define-public linux-libre-5.4-version "5.4.23")
(define-public linux-libre-5.4-pristine-source
(let ((version linux-libre-5.4-version)
(hash (base32 "1jhyg2yc03fka92l7hwdajim6q5rk538hjdr1gwgvpfyyp6sla1z")))
(make-linux-libre-source version
(%upstream-linux-source version hash)
deblob-scripts-5.4)))
(define-public linux-libre-4.19-version "4.19.107")
(define-public linux-libre-4.19-pristine-source
(let ((version linux-libre-4.19-version)
(hash (base32 "0h02pxzzwc5w2kfqw686bpxc13a93yq449lyzxxkxq1qilcsqjv5")))
(make-linux-libre-source version
(%upstream-linux-source version hash)
deblob-scripts-4.19)))
(define-public linux-libre-4.14-version "4.14.172")
(define-public linux-libre-4.14-pristine-source
(let ((version linux-libre-4.14-version)
(hash (base32 "0yi13cky6jdswca7nrjgcrdxk8rnqdbhblhy6mws103mjfms2613")))
(make-linux-libre-source version
(%upstream-linux-source version hash)
deblob-scripts-4.14)))
(define-public linux-libre-4.9-version "4.9.215")
(define-public linux-libre-4.9-pristine-source
(let ((version linux-libre-4.9-version)
(hash (base32 "0j4z2al318654z40w4f8zhh73zwpgn8igjr5k4mz401phm3jyvr3")))
(make-linux-libre-source version
(%upstream-linux-source version hash)
deblob-scripts-4.9)))
(define-public linux-libre-4.4-version "4.4.215")
(define-public linux-libre-4.4-pristine-source
(let ((version linux-libre-4.4-version)
(hash (base32 "00zy6cxwb16pqziiqs25pz5llryx2v2nbk9vvzpzxa8x43ad7g18")))
(make-linux-libre-source version
(%upstream-linux-source version hash)
deblob-scripts-4.4)))
(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-5.4-source
(source-with-patches linux-libre-5.4-pristine-source
(list %boot-logo-patch
%linux-libre-arm-export-__sync_icache_dcache-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)))
(define-public linux-libre-4.14-source
(source-with-patches linux-libre-4.14-pristine-source
(list %boot-logo-patch)))
(define-public linux-libre-4.9-source
(source-with-patches linux-libre-4.9-pristine-source
(list %boot-logo-patch)))
(define-public linux-libre-4.4-source
(source-with-patches linux-libre-4.4-pristine-source
(list %boot-logo-patch)))
;;;
;;; Kernel headers.
;;;
(define (make-linux-libre-headers version hash-string)
(make-linux-libre-headers* version
(origin
(method url-fetch)
(uri (linux-libre-urls version))
(sha256 (base32 hash-string)))))
(define (make-linux-libre-headers* version 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))
'())
,@(if (version>=? version "5.3")
`(("rsync" ,rsync))
'())))
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build utils)
(srfi srfi-1))
#:phases
(modify-phases %standard-phases
(delete 'configure)
(replace 'build
(lambda _
(let ((arch ,(system->linux-architecture
(or (%current-target-system)
(%current-system))))
(defconfig ,(system->defconfig
(or (%current-target-system)
(%current-system)))))
(setenv "ARCH" arch)
(format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
(invoke "make" defconfig)
(invoke "make" "mrproper" "headers_check"))))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(invoke "make"
(string-append "INSTALL_HDR_PATH=" out)
"headers_install")
(mkdir (string-append out "/include/config"))
(call-with-output-file
(string-append out
"/include/config/kernel.release")
(lambda (p)
(format p "~a-default~%" ,version)))
;; Remove the '.install' and '..install.cmd' files; the
;; latter contains store paths, which pulls in bootstrap
;; binaries in the build environment, and prevents bit
;; reproducibility for the bootstrap binaries.
(for-each delete-file (find-files out "\\.install"))
#t))))
#:allowed-references ()
#:tests? #f))
(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-5.4
(make-linux-libre-headers* linux-libre-5.4-version
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-source))
(define-public linux-libre-headers-4.14
(make-linux-libre-headers* linux-libre-4.14-version
linux-libre-4.14-source))
(define-public linux-libre-headers-4.9
(make-linux-libre-headers* linux-libre-4.9-version
linux-libre-4.9-source))
(define-public linux-libre-headers-4.4
(make-linux-libre-headers* linux-libre-4.4-version
linux-libre-4.4-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-4.19.56
(make-linux-libre-headers "4.19.56"
"1zqiic55viy065lhnkmhn33sz3bbbr2ykbm5f92yzd8lpc9zl7yx"))
(define-public linux-libre-headers linux-libre-headers-4.19.56)
;;;
;;; Kernel configurations.
;;;
(define* (kernel-config arch #:key variant)
"Return the absolute file name 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)))
(search-auxiliary-file file)))
;; FIXME: merge into kernel-config
(define* (kernel-config-veyron arch #:key variant)
"Return the absolute file name 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) "-veyron.conf"))
(file (string-append "linux-libre/" name)))
(search-auxiliary-file file)))
(define %default-extra-linux-options
`(;; 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)
;; 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")))
options)
"\n"))
;;;
;;; Kernel package utilities.
;;;
(define* (make-linux-libre version hash-string supported-systems
#:key
;; A function that takes an arch and a variant.
;; See kernel-config for an example.
(extra-version #f)
(configuration-file #f)
(defconfig "defconfig")
(extra-options %default-extra-linux-options)
(patches (list %boot-logo-patch)))
(make-linux-libre* version
(origin
(method url-fetch)
(uri (linux-libre-urls version))
(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 source supported-systems
#:key
;; A function that takes an arch and a variant.
;; See kernel-config for an example.
(extra-version #f)
(configuration-file #f)
(defconfig "defconfig")
(extra-options %default-extra-linux-options))
(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)
(native-inputs
`(("perl" ,perl)
("bc" ,bc)
("openssl" ,openssl)
("kmod" ,kmod)
("elfutils" ,elfutils) ; Needed to enable CONFIG_STACK_VALIDATION
("flex" ,flex)
("bison" ,bison)
;; These are needed to compile the GCC plugins.
("gmp" ,gmp)
("mpfr" ,mpfr)
("mpc" ,mpc)
,@(match (and configuration-file
(configuration-file
(system->linux-architecture
(or (%current-target-system) (%current-system)))
#:variant (version-major+minor version)))
(#f ;no config for this platform
'())
((? string? config)
`(("kconfig" ,config))))))
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build utils)
(srfi srfi-1)
(srfi srfi-26)
(ice-9 match))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-/bin/pwd
(lambda _
(substitute* (find-files "." "^Makefile(\\.include)?$")
(("/bin/pwd") "pwd"))
#t))
(replace 'configure
(lambda* (#:key inputs native-inputs target #:allow-other-keys)
;; On AArch64 (at least), we need to remove glibc headers from
;; CPATH (they are still available as "system headers"), so that
;; the kernel can override uint64_t. See
;; <https://bugs.gnu.org/37593>. This is also true when
;; cross-compiling, except in that case, cross-libc must be
;; removed from CROSS_CPATH.
(let ((var ,(if (%current-target-system)
"CROSS_CPATH"
"CPATH"))
(libc ,(if (%current-target-system)
"cross-libc"
"libc")))
(setenv var
(string-join
(remove
(cut string-prefix? (assoc-ref inputs libc) <>)
(string-split (getenv var) #\:))
":"))
(format #t "environment variable `~a' changed to `~a'~%"
var (getenv var)))
;; Avoid introducing timestamps
(setenv "KCONFIG_NOTIMESTAMP" "1")
(setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
;; Set ARCH and CROSS_COMPILE
(let ((arch ,(system->linux-architecture
(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"))))
(setenv "EXTRA_VERSION" ,extra-version)
(let ((build (assoc-ref %standard-phases 'build))
(config (assoc-ref (or native-inputs inputs) "kconfig")))
;; 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 inputs native-inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(moddir (string-append out "/lib/modules"))
(dtbdir (string-append out "/lib/dtbs"))
(kmod (assoc-ref (or native-inputs inputs) "kmod")))
;; Install kernel image, kernel configuration and link map.
(for-each (lambda (file) (install-file file out))
(find-files "." "^(\\.config|bzImage|zImage|Image|vmlinuz|System\\.map|Module\\.symvers)$"))
;; Install device tree files
(unless (null? (find-files "." "\\.dtb$"))
(mkdir-p dtbdir)
(invoke "make" (string-append "INSTALL_DTBS_PATH=" dtbdir)
"dtbs_install"))
;; Install kernel modules
(mkdir-p moddir)
(invoke "make"
(string-append "DEPMOD=" kmod "/bin/depmod")
(string-append "MODULE_DIR=" moddir)
(string-append "INSTALL_PATH=" out)
(string-append "INSTALL_MOD_PATH=" out)
"INSTALL_MOD_STRIP=1"
"modules_install")))))
#:tests? #f))
(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)))
;;;
;;; Generic kernel packages.
;;;
(define-public linux-libre-5.4
(make-linux-libre* linux-libre-5.4-version
linux-libre-5.4-source
'("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "riscv64-linux")
#:configuration-file kernel-config))
(define-public linux-libre-version linux-libre-5.4-version)
(define-public linux-libre-pristine-source linux-libre-5.4-pristine-source)
(define-public linux-libre-source linux-libre-5.4-source)
(define-public linux-libre linux-libre-5.4)
(define-public linux-libre-4.19
(make-linux-libre* linux-libre-4.19-version
linux-libre-4.19-source
'("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux")
#:configuration-file kernel-config))
(define-public linux-libre-4.14
(make-linux-libre* linux-libre-4.14-version
linux-libre-4.14-source
'("x86_64-linux" "i686-linux" "armhf-linux")
#:configuration-file kernel-config))
(define-public linux-libre-4.9
(make-linux-libre* linux-libre-4.9-version
linux-libre-4.9-source
'("x86_64-linux" "i686-linux")
#:configuration-file kernel-config))
(define-public linux-libre-4.4
(make-linux-libre* linux-libre-4.4-version
linux-libre-4.4-source
'("x86_64-linux" "i686-linux")
#:configuration-file kernel-config
#:extra-options
(append
`(;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html
;; This option was removed upstream in version 4.7.
("CONFIG_DEVPTS_MULTIPLE_INSTANCES" . #t))
%default-extra-linux-options)))
;;;
;;; Specialized kernel variants.
;;;
(define-public linux-libre-arm-veyron
(make-linux-libre* linux-libre-version
linux-libre-source
'("armhf-linux")
#:configuration-file kernel-config-veyron
#:extra-version "arm-veyron"))
(define-public linux-libre-arm-generic
(make-linux-libre* linux-libre-version
linux-libre-source
'("armhf-linux")
#:defconfig "multi_v7_defconfig"
#:extra-version "arm-generic"))
(define-public linux-libre-arm-generic-4.19
(make-linux-libre* linux-libre-4.19-version
linux-libre-4.19-source
'("armhf-linux")
#:defconfig "multi_v7_defconfig"
#:extra-version "arm-generic"))
(define-public linux-libre-arm-generic-4.14
(make-linux-libre* linux-libre-4.14-version
linux-libre-4.14-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-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-source
'("armhf-linux")
#:defconfig "omap2plus_defconfig"
#:extra-version "arm-omap2plus"))
(define-public linux-libre-arm-omap2plus-4.14
(make-linux-libre* linux-libre-4.14-version
linux-libre-4.14-source
'("armhf-linux")
#:defconfig "omap2plus_defconfig"
#:extra-version "arm-omap2plus"))
(define-public linux-libre-riscv64-generic
(make-linux-libre* linux-libre-version
linux-libre-source
'("riscv64-linux")
#:extra-version "riscv64-generic"))
;;;
;;; Linux kernel modules.
;;;
(define-public acpi-call-linux-module
(package
(name "acpi-call-linux-module")
(version "3.17")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/teleshoes/acpi_call.git")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32 "04mbv4lasm3vv1j4ndxhnz4hvp5wg8f5fc9q6qxv0nhvwjynmsl3"))))
(build-system linux-module-build-system)
(arguments
`(#:tests? #f ; no tests
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'fix-for-linux-4.12
(lambda _
(substitute* "acpi_call.c"
(("asm/uaccess\\.h")
"linux/uaccess.h"))
#t))
(add-after 'install 'install-documentation
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(doc (string-append out "/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"))
#t))))))
(home-page "https://github.com/teleshoes/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 rtl8812au-aircrack-ng-linux-module
(let ((commit "945d6ed6505c32f0993b1dba576388e92e78101b")
(revision "0"))
(package
(name "rtl8812au-aircrack-ng-linux-module")
(version (git-version "5.6.4.2" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/aircrack-ng/rtl8812au.git")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "1pjws7qb5l4z9k80vgz4zdxmqhbwxjjrmkpf0hijf821byyddvi7"))
(modules '((guix build utils)))
(snippet
'(begin
;; Remove bundled tarballs, APKs, word lists, speadsheets,
;; and other unnecessary unlicenced things.
(for-each delete-file-recursively (list "android"
"docs"
"tools"))
#t))))
(build-system linux-module-build-system)
(arguments
`(#:phases
(modify-phases %standard-phases
(replace 'build
(lambda* (#:key inputs make-flags #:allow-other-keys)
(apply invoke "make"
(string-append "KSRC="
(assoc-ref inputs "linux-module-builder")
"/lib/modules/build")
(or make-flags '())))))
#:tests? #f)) ; no test suite
(supported-systems '("x86_64-linux" "i686-linux"))
(home-page "https://github.com/aircrack-ng/rtl8812au")
(synopsis "Linux driver for Realtek USB wireless network adapters")
(description
"This is Realtek's rtl8812au Linux driver for USB 802.11n wireless
network adapters, modified by the aircrack-ng project to support monitor mode
and frame injection. It provides a @code{88XXau} kernel module that supports
RTL8812AU, RTL8821AU, and RTL8814AU chips.")
(license license:gpl2+))))
(define-public vhba-module
(package
(name "vhba-module")
(version "20200106")
(source (origin
(method url-fetch)
(uri (string-append
"http://downloads.sourceforge.net/cdemu/vhba-module/vhba-module-"
version ".tar.bz2"))
(sha256
(base32
"10rlvsfj0fw6n0qmwcnvhimqnsnhi7n55lyl7fq1pkwggf5218sr"))))
(build-system linux-module-build-system)
(arguments
;; TODO: No tests?
`(#:tests? #f))
(home-page "https://cdemu.sourceforge.io/")
(synopsis "Kernel module that emulates SCSI devices")
(description "VHBA module provides a Virtual (SCSI) HBA, which is the link
between the CDemu userspace daemon and linux kernel.")
(license license:gpl2+)))
(define-public ddcci-driver-linux
(package
(name "ddcci-driver-linux")
(version "0.3.3")
(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
"0vkkja3ykjil783zjpwp0vz7jy2fp9ccazzi3afd4fjk8gldin7f"))))
(build-system linux-module-build-system)
(arguments
`(#: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"))
#t))
(replace 'install
(lambda args
(for-each
(lambda (module)
(with-directory-excursion module
(apply (assoc-ref %standard-phases 'install) args)))
'("ddcci" "ddcci-backlight"))
#t)))))
(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+)))
;;;
;;; Pluggable authentication modules (PAM).
;;;
(define-public linux-pam
(package
(name "linux-pam")
(version "1.3.1")
(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
"1nyh9kdi3knhxcbv5v4snya0g3gff0m671lnvqcbygw3rm77mx7g"))
(patches (search-patches "linux-pam-no-setfsuid.patch"))))
(build-system gnu-build-system)
(native-inputs
`(("flex" ,flex)
;; TODO: optional dependencies
;; ("libxcrypt" ,libxcrypt)
;; ("cracklib" ,cracklib)
))
(arguments
`(;; Most users, such as `shadow', expect the headers to be under
;; `security'.
#:configure-flags (list (string-append "--includedir="
(assoc-ref %outputs "out")
"/include/security")
;; 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")
'()))
;; 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 linux-pam-1.2
(package
(inherit linux-pam)
(version "1.2.1")
(source
(origin
(method url-fetch)
(uri (string-append
"http://www.linux-pam.org/library/"
"Linux-PAM-" version ".tar.bz2"))
(sha256
(base32
"1n9lnf9gjs72kbj1g354v1xhi2j27aqaah15vykh7cnkq08i4arl"))
(patches (search-patches "linux-pam-no-setfsuid.patch"))))))
;;;
;;; Miscellaneous.
;;;
(define-public psmisc
(package
(name "psmisc")
(version "23.3")
(source
(origin
(method url-fetch)
(uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
version ".tar.xz"))
(sha256
(base32 "16i7qzjmm6g0lzha8yzpfrlcxnvkgh95hkq9gdjd4zmzb8d0wxa1"))))
(build-system gnu-build-system)
(arguments
`(,@(if (%current-target-system)
'(#:configure-flags
(list
"ac_cv_func_malloc_0_nonnull=yes"
"ac_cv_func_realloc_0_nonnull=yes"))
'())))
(inputs `(("ncurses" ,ncurses)))
(home-page "https://gitlab.com/psmisc/psmisc")
(synopsis "Small utilities that use the proc file system")
(description
"This PSmisc package is a set of some small useful utilities that
use the proc file system. We're not about changing the world, but
providing the system administrator with some help in common tasks.")
(license license:gpl2+)))
(define-public util-linux
(package
(name "util-linux")
(version "2.34")
(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
"1db2kydkwjmvgd1glkcba3adhidxw0f1x735dcjdpdjjf869sgvl"))
(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"
"static")) ;>2 MiB of static .a libraries
(arguments
`(#:configure-flags (list "--disable-use-tty-group"
"--enable-fs-paths-default=/run/current-system/profile/sbin"
;; Don't try to chown root:root mount and umount
"--disable-makeinstall-chown"
;; Install completions where our
;; bash-completion package expects them.
(string-append "--with-bashcompletiondir="
(assoc-ref %outputs "out")
"/etc/bash_completion.d"))
#:phases (modify-phases %standard-phases
(add-before 'build 'set-umount-file-name
(lambda* (#:key outputs #:allow-other-keys)
;; Tell 'eject' the right file name of 'umount'.
(let ((out (assoc-ref outputs "out")))
(substitute* "sys-utils/eject.c"
(("\"/bin/umount\"")
(string-append "\"" out "/bin/umount\"")))
#t)))
(add-before 'check 'pre-check
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(net (assoc-ref inputs "net-base")))
;; Change the test to refer to the right file.
(substitute* "tests/ts/misc/mcookie"
(("/etc/services")
(string-append net "/etc/services")))
#t)))
(add-after 'install 'move-static-libraries
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(static (assoc-ref outputs "static")))
(mkdir-p (string-append static "/lib"))
(with-directory-excursion out
(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")))
#t))))))
(inputs `(("zlib" ,zlib)
("ncurses" ,ncurses)
;; XXX: This is so that the 'pre-check' phase can find it.
,@(if (%current-target-system)
`(("net-base" ,net-base))
'())))
(native-inputs
`(("perl" ,perl)
("net-base" ,net-base))) ;for tests
(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.")
;; 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
`(("udev" ,eudev)
,@(package-inputs util-linux)))))
(define-public ddate
(package
(name "ddate")
(version "0.2.2")
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/bo0ts/ddate/archive/v"
version ".tar.gz"))
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32 "1bbqqq8mswj4bp9083gxjaky5ysfznax4cynsqwmy125z053yg6m"))))
(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 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
`(("bison" ,bison)
("flex" ,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 "3.3.16")
(source (origin
(method url-fetch)
(uri (string-append "mirror://sourceforge/procps-ng/Production/"
"procps-ng-" version ".tar.xz"))
(sha256
(base32
"1br0g93ysqhlv13i1k4lfbimsgxnpy5rgs4lxfc9rkzdbpbaqplj"))))
(build-system gnu-build-system)
(arguments
'(#:modules ((guix build utils)
(guix build gnu-build-system)
(srfi srfi-1)
(srfi srfi-26))
#: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 (assoc-ref outputs "out"))
(dup (append-map (cut find-files out <>)
'("^kill" "^uptime"))))
(for-each delete-file dup)
#t))))))
(inputs `(("ncurses" ,ncurses)))
(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 ps, top, vmstat, w, kill, free,
slabtop, and skill.")
(license license:gpl2)))
(define-public usbutils
(package
(name "usbutils")
(version "012")
(source
(origin
(method url-fetch)
(uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
"usbutils-" version ".tar.xz"))
(sha256
(base32 "0iiy0q7fzikavmdsjsb0sl9kp3gfh701qwyjjccvqh0qz4jlcqw8"))))
(build-system gnu-build-system)
(outputs (list "out" "python"))
(arguments
`(#:phases
(modify-phases %standard-phases
(add-before 'bootstrap 'patch-bootstrap-scripts
(lambda _
(substitute* "usbhid-dump/bootstrap"
(("/bin/bash") (which "bash")))
;; Don't let autogen.sh run configure with bogus options & CFLAGS.
(substitute* "autogen.sh"
(("^\\./configure.*") ""))
#t))
(add-after 'install 'separate-python-output
;; Separating one Python script shaves more than 106 MiB from :out.
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(out:python (assoc-ref outputs "python")))
(for-each (lambda (file)
(let ((old (string-append out "/" file))
(new (string-append out:python "/" file)))
(mkdir-p (dirname new))
(rename-file old new)))
(list "bin/lsusb.py"))
#t))))))
(inputs
`(("eudev" ,eudev)
("libusb" ,libusb)
("python" ,python)))
(native-inputs
`(("autoconf" ,autoconf)
("automake" ,automake)
("libtool" ,libtool)
("pkg-config" ,pkg-config)))
(home-page "http://www.linux-usb.org/")
(synopsis
"Tools for working with USB devices, such as lsusb")
(description
"Tools for working with USB devices, such as lsusb.")
(license license:gpl2+)))
(define-public e2fsprogs
(package
(name "e2fsprogs")
(version "1.45.5")
(source (origin
(method url-fetch)
(uri (string-append
"mirror://kernel.org/linux/kernel/people/tytso/"
name "/v" version "/"
name "-" version ".tar.xz"))
(sha256
(base32
"1pmf8inp736l587rqq7qsd8bv0mmg5cwrivxg5p5awqgv70crypr"))))
(build-system gnu-build-system)
(inputs `(("util-linux" ,util-linux)))
(native-inputs `(("pkg-config" ,pkg-config)
("texinfo" ,texinfo) ;for the libext2fs Info manual
;; For tests.
("perl" ,perl)
("procps" ,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"))))
#t))
(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))
#t))))))
(home-page "http://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
`(("e2fsprogs" ,e2fsprogs/static)))
(arguments
`(#:modules ((guix build utils))
#:builder
(begin
(use-modules (guix build utils)
(ice-9 ftw)
(srfi srfi-26))
(let ((e2fsck (string-append (assoc-ref %build-inputs "e2fsprogs")
"/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 `(("e2fsprogs" ,e2fsprogs)))
(home-page "http://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 "5.5")
(home-page "https://strace.io")
(source (origin
(method url-fetch)
(uri (string-append home-page "/files/" version
"/strace-" version ".tar.xz"))
(sha256
(base32
"1zrhpzjlgfwfl8dd53llswmmharm5rbi0zch7lln5sjris69an4z"))))
(build-system gnu-build-system)
(arguments
'(#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-/bin/sh
(lambda _
(substitute* "strace.c"
(("/bin/sh") (which "sh")))
#t)))
;; 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 `(("perl" ,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.")
(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" ,libelf)))
(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-lib
(package
(name "alsa-lib")
(version "1.2.1.2")
(source (origin
(method url-fetch)
(uri (string-append
"ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
version ".tar.bz2"))
(sha256
(base32
"0hvrx0ipzqbcx4y1cmr9bgm9niifzkrhsb1ddgzzdwbk6q72d3lm"))))
(build-system gnu-build-system)
(arguments
'(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
(assoc-ref %outputs "out")
"/lib"))))
(home-page "https://www.alsa-project.org/")
(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.1")
(source (origin
(method url-fetch)
(uri (string-append "ftp://ftp.alsa-project.org/pub/utils/"
name "-" version ".tar.bz2"))
(sha256
(base32
"039c19b7091is0czl9jlrfczp7pp1jpdri0vvc4k07gl3skhn48b"))))
(build-system gnu-build-system)
(arguments
;; XXX: Disable man page creation until we have DocBook.
'(#:configure-flags (list "--disable-xmlto"
;; The udev rule is responsible for restoring
;; the volume.
(string-append "--with-udev-rules-dir="
(assoc-ref %outputs "out")
"/lib/udev/rules.d"))
#:phases
(modify-phases %standard-phases
(add-before 'check 'disable-broken-test
(lambda _
;; XXX: The 1.1.8 release tarball is missing a header that's
;; required for this test to work. Fixed in 1.1.9.
(substitute* "axfer/test/Makefile"
((".*container-test.*") ""))
#t))
(add-before
'install 'pre-install
(lambda _
;; Don't try to mkdir /var/lib/alsa.
(substitute* "Makefile"
(("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
"true\n"))
#t)))))
(inputs
`(("libsamplerate" ,libsamplerate)
("ncurses" ,ncurses)
("alsa-lib" ,alsa-lib)
("xmlto" ,xmlto)
("gettext" ,gettext-minimal)))
(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.1")
(source (origin
(method url-fetch)
(uri (string-append "ftp://ftp.alsa-project.org/pub/plugins/"
name "-" version ".tar.bz2"))
(sha256
(base32
"1nj8cpbi05rb62yzs01c1k7lymdn1ch229b599hbhd0psixdx52d"))))
(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"))
(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
`(("alsa-lib" ,alsa-lib)
("jack" ,jack-1)
("speex" ,speex) ; libspeexdsp resampling plugin
("libsamplerate" ,libsamplerate) ; libsamplerate resampling plugin
("ffmpeg" ,ffmpeg) ; libavcodec resampling plugin, a52 plugin
("pulseaudio" ,pulseaudio))) ; PulseAudio plugin
(native-inputs
`(("pkg-config" ,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.4")
(source (origin
(method url-fetch)
(uri (string-append
"mirror://netfilter.org/iptables/iptables-"
version ".tar.bz2"))
(sha256
(base32
"0z0mgs1ghvn3slc868mgbf2g26njgrzcy5ggyb5w4i55j1a3lflr"))))
(build-system gnu-build-system)
(native-inputs
`(("pkg-config" ,pkg-config)
("flex" ,flex)
("bison" ,bison)))
(inputs
`(("libmnl" ,libmnl)
("libnftnl" ,libnftnl)))
(arguments
'(#: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.")
(license 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
`(("perl" ,perl)
("iptables" ,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 "5.5.0")
(source (origin
(method url-fetch)
(uri (string-append
"mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
version ".tar.xz"))
(sha256
(base32
"0ywg70f98wgfai35jl47xzpjp45a6n7crja4vc8ql85cbi1l7ids"))))
(build-system gnu-build-system)
(arguments
`( ;; There is a test suite, but it wants network namespaces and sudo.
#:tests? #f
#:make-flags (let ((out (assoc-ref %outputs "out")))
(list "DESTDIR="
(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 "DOCDIR=" out "/share/doc/"
,name "-" ,version)
(string-append "MANDIR=" out "/share/man")))
#:phases (modify-phases %standard-phases
(add-before 'install 'pre-install
(lambda _
;; Don't attempt to create /var/lib/arpd.
(substitute* "Makefile"
(("^.*ARPDDIR.*$") ""))
#t)))))
(inputs
`(("db4" ,bdb)
("iptables" ,iptables)
("libmnl" ,libmnl)))
(native-inputs
`(("bison" ,bison)
("flex" ,flex)
("pkg-config" ,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 "http://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 "CC=gcc"
(string-append "BASEDIR=" out)
(string-append "INSTALLNLSDIR=" out "/share/locale")
(string-append "mandir=/share/man")))))
(native-inputs `(("gettext" ,gettext-minimal)
("unzip" ,unzip)))
(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.27")
(source (origin
(method url-fetch)
(uri (string-append
"mirror://kernel.org/linux/libs/security/linux-privs/"
"libcap2/libcap-" version ".tar.xz"))
(sha256
(base32
"0sj8kidl7qgf2qwxcbw1vadnlb30y4zvjzxswsmfdghq04npkhfs"))))
(build-system gnu-build-system)
(arguments '(#:phases
(modify-phases %standard-phases
(replace 'configure
;; Add $libdir to the RUNPATH of executables.
(lambda _
(substitute* "Make.Rules"
(("LDFLAGS := #-g")
(string-append "LDFLAGS := -Wl,-rpath="
%output "/lib")))
#t)))
#:tests? #f ; no 'check' target
#:make-flags (list "lib=lib"
(string-append "prefix="
(assoc-ref %outputs "out"))
"RAISE_SETFCAP=no")))
(native-inputs `(("perl" ,perl)))
(inputs `(("attr" ,attr)))
(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 license:gpl2)))
(define-public bridge-utils
(package
(name "bridge-utils")
(version "1.6")
(source
(origin
(method url-fetch)
(uri (string-append "mirror://kernel.org/linux/utils/net/bridge-utils/"
"bridge-utils-" version ".tar.xz"))
(sha256
(base32 "1j16kr44csyr4yqxly26l1yw2bh4nkiasgwvask2i2gvsnsyyryc"))))
(build-system gnu-build-system)
;; The tarball lacks all the generated files.
(native-inputs `(("autoconf" ,autoconf)
("automake" ,automake)))
(arguments
'(#:phases
(modify-phases %standard-phases
(add-before 'bootstrap 'patch-stuff
(lambda _
;; Fix "field ‘ip6’ has incomplete type" errors.
(substitute* "libbridge/libbridge.h"
(("#include <linux/if_bridge.h>")
"#include <linux/in6.h>\n#include <linux/if_bridge.h>"))
;; Ensure that the entire build fails if one of the
;; sub-Makefiles fails.
(substitute* "Makefile.in"
(("\\$\\(MAKE\\) \\$\\(MFLAGS\\) -C \\$\\$x ;")
"$(MAKE) $(MFLAGS) -C $$x || exit 1;"))
#t)))
#:tests? #f)) ; no 'check' target
(home-page
"http://www.linuxfoundation.org/collaborate/workgroups/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"))))))
(inputs
`(("python-2" ,python-2)
("python-3" ,python-3)))
(outputs '("out" "doc" "python2" "python3"))
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build utils)
(srfi srfi-1))
#:phases
(modify-phases %standard-phases
(add-after 'install 'install-python
(lambda* (#:key outputs #:allow-other-keys)
(define (python-inst python)
(invoke python "setup.py" "build")
(invoke python "setup.py" "install"
(string-append "--prefix="
(assoc-ref %outputs python)))
(invoke python "setup.py" "clean"))
(setenv "LDFLAGS" (format #f "-Wl,-rpath=~a/lib"
(assoc-ref %outputs "out")))
(with-directory-excursion "./python"
(for-each python-inst '("python2" "python3")))
#t))
(add-after 'install 'install-doc
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((dest (string-append (assoc-ref outputs "doc")
"/share/doc/libnl")))
(mkdir-p dest)
(invoke "tar" "xf" (assoc-ref 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)))
(define-public iw
(package
(name "iw")
(version "4.14")
(source (origin
(method url-fetch)
(uri (string-append
"mirror://kernel.org/software/network/iw/iw-"
version ".tar.xz"))
(sha256
(base32
"12ddd6vh6vs97135bnlyr0szv7hvpbnmfh48584frzab0z0725ph"))))
(build-system gnu-build-system)
(native-inputs `(("pkg-config" ,pkg-config)))
(inputs `(("libnl" ,libnl)))
(arguments
`(#:make-flags
(let* ((target ,(%current-target-system))
(gcc (if target (string-append target "-gcc") "gcc"))
(pkg-config (if target
(string-append target "-pkg-config")
"pkg-config")))
(list
(string-append "CC=" gcc)
(string-append "PKG_CONFIG="
(assoc-ref %build-inputs "pkg-config")
"/bin/" pkg-config)
(string-append "PREFIX=" (assoc-ref %outputs "out"))))
#:phases (modify-phases %standard-phases (delete 'configure))))
(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.11")
(source
(origin
(method url-fetch)
(uri (string-append "https://01.org/sites/default/files/downloads/"
"powertop-v" version "-1-g7ef7f79.tar_0.gz"))
(sha256
(base32 "0kynypj5cydfbma0ssblq1k4m1arixc1s2vf0ybv8y2gg09wjs5f"))))
(build-system gnu-build-system)
(arguments
'(#: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/bin/hcitool") "hcitool")
(("/usr/bin/xset") "xset")
(("/usr/sbin/hciconfig") "hciconfig"))
#t))))))
(inputs
`(("kmod" ,kmod)
("libnl" ,libnl)
("ncurses" ,ncurses)
("pciutils" ,pciutils)
("zlib" ,zlib)))
(native-inputs
`(("pkg-config" ,pkg-config)))
(home-page "https://01.org/powertop/")
(synopsis "Analyze power consumption on Intel-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
"http://www.jpj.net/~trevor/aumix/releases/aumix-"
version ".tar.bz2"))
(sha256
(base32
"0a8fwyxnc5qdxff8sl2sfsbnvgh6pkij4yafiln0fxgg6bal7knj"))))
(build-system gnu-build-system)
(inputs `(("ncurses" ,ncurses)))
(home-page "http://www.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
(package
(name "iotop")
(version "0.6")
(source
(origin
(method url-fetch)
(uri (string-append "http://guichaz.free.fr/iotop/files/iotop-"
version ".tar.gz"))
(sha256 (base32
"1kp8mqg2pbxq4xzpianypadfxcsyfgwcaqgqia6h9fsq6zyh4z0s"))))
(build-system python-build-system)
(arguments
'(#:phases
(modify-phases %standard-phases
(add-after 'unpack 'fix-build-with-python3
(lambda _
(substitute* "setup.py"
(("itervalues") "values"))
#t)))
;; There are currently no checks in the package.
#:tests? #f))
(native-inputs `(("python" ,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 fuse
(package
(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"))))
(build-system gnu-build-system)
(inputs `(("util-linux" ,util-linux)))
(arguments
'(#: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 '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)
(string-append (assoc-ref inputs "util-linux")
"/bin/" maybe-u "mount")))
(substitute* '("util/mount.fuse.c")
(("/bin/sh")
(which "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\\\""))
#t)))))
(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 unionfs-fuse
(package
(name "unionfs-fuse")
(version "2.0")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/rpodgorny/unionfs-fuse/archive/v"
version ".tar.gz"))
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32
"0hsn8l1iblvx27bpd4dvnvnbh9ri3sv2f9xzpsnfz3379kb7skgj"))))
(build-system cmake-build-system)
(native-inputs
`(("python" ,python)))
(inputs `(("fuse" ,fuse)))
(arguments
;; The tests were never actually run ("collected 0 items"), but in recent
;; versions of pytest that causes an error.
'(#:tests? #f))
(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"
"util/mount_util.c")
(("mtab_needs_update[[:blank:]]*\\([a-z_]+\\)")
"0")
(("/bin/")
""))
#t))))))
(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)")))
#t))))
(arguments
'(#:tests? #f
#:configure-flags '("-DCMAKE_EXE_LINKER_FLAGS=-static")
#:phases
(modify-phases %standard-phases
(add-after 'install 'post-install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(exe (string-append out "/bin/unionfs")))
;; By default, 'unionfs' keeps references to
;; $glibc/share/locale and similar stuff. Remove them.
(remove-store-references exe)
;; 'unionfsctl' has references to glibc as well. Since
;; we don't need it, remove it.
(delete-file (string-append out "/bin/unionfsctl"))
#t))))))
(inputs `(("fuse" ,fuse-static)))))
(define-public sshfs
(package
(name "sshfs")
(version "2.10")
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/libfuse/sshfs/releases/"
"download/sshfs-" version "/sshfs-" version
".tar.gz"))
(sha256
(base32
"00fir2iykdx11g8nv5gijg0zjrp2g3ldypnv0yi6lq3h5pg5v13h"))))
(build-system gnu-build-system)
(inputs
`(("fuse" ,fuse)
("glib" ,glib)))
(native-inputs
`(("pkg-config" ,pkg-config)))
(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.8.12")
(source
(origin
(method url-fetch)
(uri (string-append "https://www.cybernoia.de/software/archivemount/"
"archivemount-" version ".tar.gz"))
(sha256
(base32 "12fb8fcmd1zwvfgzx4pay47md5cr2kgxcgq82cm6skmq75alfzi4"))))
(build-system gnu-build-system)
(inputs `(("fuse" ,fuse)
("libarchive" ,libarchive)))
(native-inputs `(("pkg-config" ,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.13")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/numactl/numactl/releases/download/v"
version "/numactl-" version ".tar.gz"))
(sha256
(base32
"16lcypvcmx1ydkpi2s82kqhg13kak7qhpbnj8hd9bdbyhr5ja7lr"))))
(build-system gnu-build-system)
(arguments
'(;; There's a 'test' target, but it requires NUMA support in the kernel
;; to run, which we can't assume to have.
#:tests? #f))
;; NUMA is apparently not supported on armhf, see
;; http://www.spinics.net/lists/linux-numa/msg01157.html
(supported-systems (delete "armhf-linux" %supported-systems))
(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.0.4")
(source (origin
(method url-fetch)
(uri (string-append "mirror://kernel.org/linux/utils/kbd/kbd-"
version ".tar.xz"))
(sha256
(base32
"124swm93dm4ca0pifgkrand3r9gvj3019d4zkfxsj9djpvv0mnaz"))
(modules '((guix build utils)))
(snippet
'(begin
(substitute* "tests/Makefile.in"
;; The '%: %.in' rule incorrectly uses @VERSION@.
(("@VERSION@")
"[@]VERSION[@]"))
(substitute* '("src/unicode_start" "src/unicode_stop")
;; Assume the Coreutils are in $PATH.
(("/usr/bin/tty")
"tty"))
#t))))
(build-system gnu-build-system)
(arguments
'(#:phases
(modify-phases %standard-phases
(add-before 'build 'pre-build
(lambda* (#:key inputs #:allow-other-keys)
(let ((gzip (assoc-ref %build-inputs "gzip"))
(bzip2 (assoc-ref %build-inputs "bzip2")))
(substitute* "src/libkeymap/findfile.c"
(("gzip")
(string-append gzip "/bin/gzip"))
(("bzip2")
(string-append bzip2 "/bin/bzip2")))
#t)))
(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"))
#t))))))
(inputs `(("check" ,check)
("gzip" ,gzip)
("bzip2" ,bzip2)
("pam" ,linux-pam)))
(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/**")))))
(native-inputs `(("pkg-config" ,pkg-config)))
(home-page "http://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" ,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"))
#t)))
(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.20.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/rvoicilas/inotify-tools.git")
(commit version)))