summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorJelle Licht <jlicht@fsfe.org>2021-11-29 19:33:44 +0100
committerJelle Licht <jlicht@fsfe.org>2021-11-29 19:33:44 +0100
commitf99d5fabd3baee4f378aaf83f13c589b76337a18 (patch)
tree0d6302d99d4e4abb4ed58f15ef9d0906dec763b1 /guix
parent3ec1e7f16590c3b681d6cb3b110b0d9c115586ea (diff)
[WIP] Move channel to "guix" subdirectory.
Diffstat (limited to 'guix')
-rw-r--r--guix/nongnu/ci.scm35
-rw-r--r--guix/nongnu/packages/anydesk.scm140
-rw-r--r--guix/nongnu/packages/clojure.scm174
-rw-r--r--guix/nongnu/packages/compression.scm47
-rw-r--r--guix/nongnu/packages/coq.scm91
-rw-r--r--guix/nongnu/packages/dotnet.scm303
-rw-r--r--guix/nongnu/packages/emacs.scm72
-rw-r--r--guix/nongnu/packages/emulators.scm55
-rw-r--r--guix/nongnu/packages/fonts.scm176
-rw-r--r--guix/nongnu/packages/game-development.scm302
-rw-r--r--guix/nongnu/packages/gog.scm70
-rw-r--r--guix/nongnu/packages/linux.scm836
-rw-r--r--guix/nongnu/packages/mozilla.scm448
-rw-r--r--guix/nongnu/packages/nvidia.scm435
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-debian-fix-kernel-warnings.patch161
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-fix_mac_profile_discrepancy.patch16
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-gcc.patch11
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-license.patch13
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-linux-4.11.patch52
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-linux-4.12.patch68
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-linux-4.15.patch47
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-linux-4.7.patch109
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-linux-4.8.patch64
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-linux-5.1.patch32
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-linux-5.10.patch211
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-linux-5.6.patch87
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-linux-5.9.patch12
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-null-pointer-fix.patch27
-rw-r--r--guix/nongnu/packages/patches/broadcom-sta-rdtscl.patch22
-rw-r--r--guix/nongnu/packages/playonlinux.scm124
-rw-r--r--guix/nongnu/packages/scanner.scm210
-rw-r--r--guix/nongnu/packages/steam-client.scm591
-rw-r--r--guix/nongnu/packages/vpn.scm90
-rw-r--r--guix/nongnu/packages/wine.scm213
-rw-r--r--guix/nongnu/services/vpn.scm72
-rw-r--r--guix/nongnu/system/install.scm32
-rw-r--r--guix/nongnu/system/linux-initrd.scm99
-rw-r--r--guix/nonguix/build-system/binary.scm162
-rw-r--r--guix/nonguix/build/binary-build-system.scm155
-rw-r--r--guix/nonguix/build/utils.scm111
-rw-r--r--guix/nonguix/download.scm62
-rw-r--r--guix/nonguix/licenses.scm41
-rw-r--r--guix/nonguix/modules.scm35
-rw-r--r--guix/nonguix/utils.scm38
44 files changed, 6151 insertions, 0 deletions
diff --git a/guix/nongnu/ci.scm b/guix/nongnu/ci.scm
new file mode 100644
index 0000000..a4e2c72
--- /dev/null
+++ b/guix/nongnu/ci.scm
@@ -0,0 +1,35 @@
+;;; Copyright © 2021 Mathieu Othacehe <m.othacehe@gmail.com>
+;;;
+;;; This program 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.
+;;;
+;;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (nongnu ci)
+ #:use-module (gnu ci)
+ #:use-module (gnu system image)
+ #:use-module (nongnu system install)
+ #:use-module (srfi srfi-1)
+ #:export (cuirass-jobs))
+
+(define (cuirass-jobs store arguments)
+ (define systems
+ (arguments->systems arguments))
+
+ (append-map
+ (lambda (system)
+ (list
+ (image->job store
+ (image-with-os iso9660-image
+ installation-os-nonfree)
+ #:name "nonfree-iso9660-image"
+ #:system system)))
+ systems))
diff --git a/guix/nongnu/packages/anydesk.scm b/guix/nongnu/packages/anydesk.scm
new file mode 100644
index 0000000..5ba0c7c
--- /dev/null
+++ b/guix/nongnu/packages/anydesk.scm
@@ -0,0 +1,140 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2021 Korytov Pavel <thexcloud@gmail.com>
+;;; Copyright © 2021 Jonathan Brielmaier <jonathan.brielmaier@web.de>
+;;;
+;;; This file is not 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 (nongnu packages anydesk)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages gcc)
+ #:use-module (gnu packages gtk)
+ #:use-module (gnu packages glib)
+ #:use-module (gnu packages gnome)
+ #:use-module (gnu packages gl)
+ #:use-module (gnu packages fontutils)
+ #:use-module (gnu packages polkit)
+ #:use-module (gnu packages pulseaudio)
+ #:use-module (gnu packages xorg)
+ #:use-module (guix download)
+ #:use-module (guix packages)
+ #:use-module (nonguix build-system binary)
+ #:use-module (nonguix licenses))
+
+(define-public anydesk
+ (package
+ (name "anydesk")
+ (version "6.1.1")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://download.anydesk.com/linux/anydesk-"
+ version "-amd64.tar.gz"))
+ (sha256
+ (base32
+ "1ai58fsivb8al1279bayl800qavy0kfj40rjhf87g902ap3p4bhh"))))
+ (build-system binary-build-system)
+ (arguments
+ `(#:validate-runpath? #f
+ #:strip-binaries? #f ;; For some reason it breaks the program
+ #:patchelf-plan
+ `(("anydesk" ("atk"
+ "cairo"
+ "fontconfig"
+ "freetype"
+ "gcc:lib"
+ "gdk-pixbuf"
+ "glib"
+ "glu"
+ "gtk+"
+ "gtkglext"
+ "libice"
+ "libsm"
+ "libx11"
+ "libxcb"
+ "libxdamage"
+ "libxext"
+ "libxfixes"
+ "libxi"
+ "libxkbfile"
+ "libxmu"
+ "libxrandr"
+ "libxrender"
+ "libxsts"
+ "libxt"
+ "mesa"
+ "minizip"
+ "pango"
+ "pangox-compat"
+ "polkit"
+ "polkit-gnome"
+ "pulseaudio")))
+ #:install-plan
+ `(("anydesk" "/bin/")
+ ("polkit-1/com.anydesk.anydesk.policy" "/etc/polkit-1/actions/")
+ ("icons/" "/share/icons/"))
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'unpack
+ (lambda* (#:key inputs #:allow-other-keys)
+ (invoke "tar" "-xvzf" (assoc-ref inputs "source") "--strip-components" "1")))
+ (add-after 'wrap-program 'install-desktop-entry
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((desktop-file "anydesk.desktop")
+ (out (assoc-ref outputs "out"))
+ (applications (string-append out "/share/applications")))
+ (substitute* desktop-file
+ (("^Exec=.*") (string-append "Exec=" out "/bin/anydesk\n"))
+ (("^Icon=.*") "Icon=anydesk\n"))
+ (install-file desktop-file applications))
+ #t)))))
+ (inputs
+ `(("atk" ,atk)
+ ("cairo" ,cairo)
+ ("fontconfig" ,fontconfig)
+ ("freetype" ,freetype)
+ ("gcc:lib" ,gcc "lib")
+ ("gdk-pixbuf" ,gdk-pixbuf)
+ ("glib" ,glib)
+ ("glu" ,glu)
+ ("gtk+" ,gtk+-2)
+ ("gtkglext" ,gtkglext)
+ ("libice" ,libice)
+ ("libsm" ,libsm)
+ ("libx11" ,libx11)
+ ("libxcb" ,libxcb)
+ ("libxdamage" ,libxdamage)
+ ("libxext" ,libxext)
+ ("libxfixes" ,libxfixes)
+ ("libxi" ,libxi)
+ ("libxkbfile" ,libxkbfile)
+ ("libxmu" ,libxmu)
+ ("libxrandr" ,libxrandr)
+ ("libxrender" ,libxrender)
+ ("libxsts" ,libxtst)
+ ("libxt" ,libxt)
+ ("mesa" ,mesa)
+ ("minizip" ,minizip)
+ ("pango" ,pango)
+ ("pangox-compat" ,pangox-compat)
+ ("polkit" ,polkit)
+ ("polkit-gnome" ,polkit-gnome)
+ ("pulseaudio" ,pulseaudio)))
+ (synopsis "Remote desktop software")
+ (supported-systems '("x86_64-linux"))
+ (description "Connect to a computer remotely, be it from the other end of
+the office or halfway around the world. AnyDesk ensures secure and reliable
+remote desktop connections for IT professionals and on-the-go individuals alike.")
+ (home-page "https://anydesk.com/")
+ (license (nonfree "https://anydesk.com/en/terms"))))
diff --git a/guix/nongnu/packages/clojure.scm b/guix/nongnu/packages/clojure.scm
new file mode 100644
index 0000000..195c743
--- /dev/null
+++ b/guix/nongnu/packages/clojure.scm
@@ -0,0 +1,174 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2020 Jelle Licht <jlicht@fsfe.org>
+;;; Copyright © 2020 Alex Griffin <a@ajgrf.com>
+;;;
+;;; This file is not 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 (nongnu packages clojure)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages gcc)
+ #:use-module (gnu packages readline)
+ #:use-module (guix build-system copy)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system trivial)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix packages)
+ #:use-module (nonguix build-system binary)
+ #:use-module ((guix licenses) #:prefix license:))
+
+(define-public clojure-tools
+ (package
+ (name "clojure-tools")
+ (version "1.10.3.1029")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://download.clojure.org/install/clojure-tools-"
+ version
+ ".tar.gz"))
+ (sha256 (base32 "14c08xva1r6sl3h78vhckwx5dd8kqwi7457prygh9330b7r8caa2"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan
+ '(("deps.edn" "lib/clojure/")
+ ("example-deps.edn" "lib/clojure/")
+ ("tools.edn" "lib/clojure/")
+ ("exec.jar" "lib/clojure/libexec/")
+ (,(string-append "clojure-tools-" version ".jar") "lib/clojure/libexec/")
+ ("clojure" "bin/")
+ ("clj" "bin/"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'fix-paths
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* "clojure"
+ (("PREFIX") (string-append (assoc-ref outputs "out") "/lib/clojure")))
+ (substitute* "clj"
+ (("BINDIR") (string-append (assoc-ref outputs "out") "/bin"))
+ (("rlwrap") (which "rlwrap")))
+ #true)))))
+ (inputs `(("rlwrap" ,rlwrap)))
+ (synopsis "CLI tools for the Clojure programming language")
+ (description "The Clojure command line tools can be used to start
+a Clojure repl, use Clojure and Java libraries, and start Clojure
+programs.")
+ (license license:epl1.0)
+ (home-page "https://clojure.org/releases/tools")))
+
+
+;; This is a hidden package, as it does not really serve a purpose on its own.
+(define leiningen-jar
+ (package
+ (name "leiningen-jar")
+ (version "2.9.8")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://github.com/technomancy/leiningen/releases/download/"
+ version "/leiningen-" version "-standalone.jar"))
+ (file-name "leiningen-standalone.jar")
+ (sha256
+ (base32
+ "13f4n15i0gsk9jq52gxivnsk32qjahmxgrddm54cf8ynw0a923ia"))))
+ (build-system trivial-build-system)
+ (arguments
+ `(#:modules ((guix build utils))
+ #:builder (begin
+ (use-modules (guix build utils))
+ (let ((source (assoc-ref %build-inputs "source"))
+ (jar-dir (string-append %output "/share/")))
+ (mkdir-p jar-dir)
+ (copy-file source
+ (string-append jar-dir "leiningen-standalone.jar"))))))
+ (home-page "https://leiningen.org")
+ (synopsis "Automate Clojure projects without setting your hair on fire")
+ (description "Leiningen is a Clojure tool with a focus on project
+automation and declarative configuration. It gets out of your way and
+lets you focus on your code.")
+ (license license:epl1.0)))
+
+(define-public leiningen
+ (package
+ (inherit leiningen-jar)
+ (name "leiningen")
+ (version "2.9.8")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/technomancy/leiningen.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1i6pn8vzzhgnm9hmlb92z65l79nxcxa5zdsrgg5svq7vmbixgnhl"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f
+ #:phases (modify-phases %standard-phases
+ (delete 'configure)
+ (delete 'build)
+ (replace 'install
+ (lambda _
+ (let* ((lein-pkg (string-append (assoc-ref %build-inputs "source") "/bin/lein-pkg"))
+ (lein-jar (string-append (assoc-ref %build-inputs "leiningen-jar")
+ "/share/leiningen-standalone.jar"))
+ (bin-dir (string-append %output "/bin"))
+ (lein (string-append bin-dir "/lein")))
+ (mkdir-p bin-dir)
+ (copy-file lein-pkg lein)
+ (patch-shebang lein)
+ (chmod lein #o555)
+ (substitute* lein
+ (("LEIN_JAR=.*") (string-append "LEIN_JAR=" lein-jar)))
+ #t))))))
+ (inputs
+ `(("leiningen-jar" ,leiningen-jar)))))
+
+(define-public clj-kondo
+ (package
+ (name "clj-kondo")
+ (version "2021.10.19")
+ (source (origin
+ (method url-fetch/zipbomb)
+ (uri (string-append
+ "https://github.com/clj-kondo/clj-kondo/releases/download/v"
+ version "/clj-kondo-" version "-linux-amd64.zip"))
+ (sha256
+ (base32
+ "1xiv7waaj2lkfxszaklg59gkkfsrqh39i3a8bj9slq6lg80q7lxs"))))
+ (build-system binary-build-system)
+ (arguments
+ `(#:patchelf-plan
+ '(("clj-kondo" ("gcc:lib" "zlib")))
+ #:install-plan
+ '(("clj-kondo" "/bin/"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'chmod
+ (lambda _
+ (chmod "clj-kondo" #o755))))))
+ (native-inputs
+ `(("unzip" ,unzip)))
+ (inputs
+ `(("gcc:lib" ,gcc "lib")
+ ("zlib" ,zlib)))
+ (supported-systems '("x86_64-linux"))
+ (home-page "https://github.com/clj-kondo/clj-kondo")
+ (synopsis "Linter for Clojure code")
+ (description "Clj-kondo performs static analysis on Clojure, ClojureScript
+and EDN, without the need of a running REPL.")
+ (license license:epl1.0)))
diff --git a/guix/nongnu/packages/compression.scm b/guix/nongnu/packages/compression.scm
new file mode 100644
index 0000000..60b1352
--- /dev/null
+++ b/guix/nongnu/packages/compression.scm
@@ -0,0 +1,47 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;;
+;;; This file is not 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 (nongnu packages compression)
+ #:use-module (guix packages)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix download)
+ #:use-module (nonguix licenses))
+
+(define-public unrar
+ (package
+ (name "unrar")
+ (version "6.0.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://www.rarlab.com/rar/unrarsrc-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "1lzdsfb4d00silyk04lkvaklmxaiyqksyxx4h1krg77q6f1iigw1"))))
+ (build-system gnu-build-system)
+ (arguments
+ '(#:tests? #f ; No tests.
+ #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure))))
+ (home-page "https://www.rarlab.com/rar_add.htm")
+ (synopsis "Extract files from RAR archives")
+ (description "The RAR decompression program. It is nonfree (as in
+freedom), but open-source.")
+ (license (nonfree "https://www.win-rar.com/gtb_priv.html?&L=0"))))
diff --git a/guix/nongnu/packages/coq.scm b/guix/nongnu/packages/coq.scm
new file mode 100644
index 0000000..4754b47
--- /dev/null
+++ b/guix/nongnu/packages/coq.scm
@@ -0,0 +1,91 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2021 Isaac Young <isyoung@pm.me>
+;;;
+;;; This file is not 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 (nongnu packages coq)
+ #:use-module (ice-9 match)
+ #:use-module (guix packages)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix git-download)
+ #:use-module (gnu packages coq)
+ #:use-module (gnu packages ocaml)
+ #:use-module (nonguix licenses))
+
+(define-public compcert
+ (package
+ (name "compcert")
+ (version "3.9")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/AbsInt/compcert")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1srcz2dqrvmbvv5cl66r34zqkm0hsbryk7gd3i9xx4slahc9zvdb"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((system ,(match (or (%current-target-system) (%current-system))
+ ("armhf-linux" "arm-eabihf")
+ ("i686-linux" "x86_32-linux")
+ (s s))))
+ (format #t "Building for ~a~%" system)
+ (invoke "./configure" system "-prefix"
+ (assoc-ref outputs "out")))
+ #t))
+ (add-after 'install 'install-lib
+ (lambda* (#:key outputs #:allow-other-keys)
+ (for-each
+ (lambda (file)
+ (install-file
+ file
+ (string-append
+ (assoc-ref outputs "out")
+ "/lib/coq/user-contrib/compcert/" (dirname file))))
+ (find-files "." ".*.vo$"))
+ #t)))
+ #:tests? #f))
+ ;; MIPS is not supported.
+ (supported-systems (delete "mips64el-linux" %supported-systems))
+ (native-inputs
+ `(("ocaml" ,ocaml)
+ ("ocaml-findlib" ,ocaml-findlib); for menhir --suggest-menhirlib
+ ("coq" ,coq)))
+ (inputs
+ `(("menhir" ,ocaml-menhir)))
+ (home-page "http://compcert.inria.fr")
+ (synopsis "Certified C compiler")
+ (description "The CompCert project investigates the formal verification of
+realistic compilers usable for critical embedded software. Such verified
+compilers come with a mathematical, machine-checked proof that the generated
+executable code behaves exactly as prescribed by the semantics of the source
+program. By ruling out the possibility of compiler-introduced bugs, verified
+compilers strengthen the guarantees that can be obtained by applying formal
+methods to source programs.
+
+The main result of the project is the CompCert C verified compiler, a
+high-assurance compiler for almost all of the C language (ISO C99), generating
+efficient code for the PowerPC, ARM, RISC-V and x86 processors.")
+ ;; actually the "INRIA Non-Commercial License Agreement"
+ ;; a non-free license.
+ (license (nonfree "file:///LICENSE"))))
diff --git a/guix/nongnu/packages/dotnet.scm b/guix/nongnu/packages/dotnet.scm
new file mode 100644
index 0000000..cb9a0d8
--- /dev/null
+++ b/guix/nongnu/packages/dotnet.scm
@@ -0,0 +1,303 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2021 Jelle Licht <jlicht@fsfe.org>
+;;;
+;;; This file is not 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 (nongnu packages dotnet)
+ #:use-module (ice-9 match)
+ #:use-module (guix download)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix packages)
+ #:use-module (nonguix build-system binary)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages gcc)
+ #:use-module (gnu packages icu4c)
+ #:use-module (gnu packages kerberos)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages tls))
+
+(define-public omnisharp
+ (package
+ (name "omnisharp")
+ (version "1.37.7")
+ (source
+ (origin
+ (method url-fetch/tarbomb)
+ (uri
+ (string-append "https://github.com/OmniSharp/omnisharp-roslyn/releases/download/v"
+ version "/omnisharp-linux-x64.tar.gz"))
+ (sha256
+ (base32
+ "0x1ynqrfipbqwf182fx27f9xw4khg65nsvpy9vx35jarfshyrqac"))))
+ (build-system binary-build-system)
+ (arguments
+ `(#:patchelf-plan
+ `(("bin/mono"
+ ("gcc:lib" "zlib"))
+ ("lib/libmono-native.so"
+ ("mit-krb5")))
+ #:install-plan
+ `(("run" "bin/omnisharp-wrapper")
+ ("bin" "share/omnisharp/")
+ ("etc" "share/omnisharp/")
+ ("lib" "share/omnisharp/")
+ ("omnisharp" "share/omnisharp/"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'fix-wrapper
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* "run"
+ (("base_dir=.*")
+ (string-append "base_dir="
+ (assoc-ref outputs "out") "/share/omnisharp\n"))
+ (("chmod.*") ""))))
+ (add-before 'patchelf 'patchelf-writable
+ (lambda _
+ (for-each make-file-writable
+ '("bin/mono" "lib/libmono-native.so")))))))
+ (inputs
+ `(("gcc:lib" ,gcc "lib")
+ ("mit-krb5" ,mit-krb5)
+ ("zlib" ,zlib)))
+ (home-page "https://github.com/OmniSharp/omnisharp-roslyn")
+ (supported-systems '("x86_64-linux"))
+ (synopsis "Implementation of Language Server Protocol based on Roslyn workspaces")
+ (description "OmniSharp is a @code{.NET} development platform based on
+Roslyn workspaces. It provides project dependencies and C# language services to
+various IDEs and plugins.")
+ (license license:expat)))
+
+(define-public dotnet
+ (let ((dotnet-sdk-version "5.0.4"))
+ (package
+ (name "dotnet")
+ (version "5.0.201")
+ (source
+ (origin
+ (method url-fetch/tarbomb)
+ (uri
+ (string-append "https://dotnetcli.azureedge.net/dotnet/Sdk/"
+ version "/dotnet-sdk-"
+ version "-linux-x64.tar.gz"))
+ (sha256
+ (base32
+ "0hdkwz39ql7madg5dzy50by6q4vyagpwjvjn34ks730yhf3p1xwz"))))
+ (build-system binary-build-system)
+ (arguments
+ `(#:patchelf-plan
+ `(("dotnet"
+ ("gcc:lib" "zlib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version
+ "/libSystem.Net.Security.Native.so")
+ ("mit-krb5"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version
+ "/libSystem.Security.Cryptography.Native.OpenSsl.so")
+ ("openssl"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version
+ "/libSystem.IO.Compression.Native.so")
+ ("zlib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version
+ "/libcoreclrtraceptprovider.so")
+ ("gcc:lib" "lttng-ust"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/createdump")
+ ("gcc:lib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libclrjit.so")
+ ("gcc:lib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libcoreclr.so")
+ ("gcc:lib" "icu4c"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libdbgshim.so")
+ ("gcc:lib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libhostpolicy.so")
+ ("gcc:lib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libmscordaccore.so")
+ ("gcc:lib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libmscordbi.so")
+ ("gcc:lib"))
+ (,,(string-append "packs/Microsoft.NETCore.App.Host.linux-x64/"
+ dotnet-sdk-version
+ "/runtimes/linux-x64/native/singlefilehost")
+ ("gcc:lib" "openssl" "mit-krb5" "zlib" "icu4c"))
+ (,,(string-append "packs/Microsoft.NETCore.App.Host.linux-x64/"
+ dotnet-sdk-version
+ "/runtimes/linux-x64/native/apphost")
+ ("gcc:lib"))
+ (,,(string-append "packs/Microsoft.NETCore.App.Host.linux-x64/"
+ dotnet-sdk-version
+ "/runtimes/linux-x64/native/libnethost.so")
+ ("gcc:lib"))
+ (,,(string-append "sdk/" version "/AppHostTemplate/apphost")
+ ("gcc:lib"))
+ (,,(string-append "host/fxr/" dotnet-sdk-version "/libhostfxr.so")
+ ("gcc:lib")))
+ #:install-plan
+ `(("." "share/dotnet/"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'patchelf 'patchelf-writable
+ (lambda _
+ (for-each make-file-writable (find-files "."))))
+ (add-after 'install 'install-wrapper
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin-dir (string-append out "/bin"))
+ (dotnet-target (string-append out "/share/dotnet/dotnet"))
+ (dotnet-dest (string-append bin-dir "/dotnet")))
+ (mkdir-p bin-dir)
+ (symlink dotnet-target dotnet-dest)
+ ;; First symlink, then wrap-program: dotnet cannot run when renamed
+ (wrap-program dotnet-dest
+ ;; Ensure the `dotnet' program does not phone home to share telemetry
+ `("DOTNET_CLI_TELEMETRY_OPTOUT" = ("1")))))))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "DOTNET_ROOT")
+ (separator #f)
+ (files '("share/dotnet")))))
+ (inputs
+ `(("gcc:lib" ,gcc "lib")
+ ("icu4c" ,icu4c)
+ ("lttng-ust" ,lttng-ust)
+ ("mit-krb5" ,mit-krb5)
+ ("openssl" ,openssl)
+ ("zlib" ,zlib)))
+ (home-page "https://docs.microsoft.com/en-us/dotnet/")
+ (supported-systems '("x86_64-linux"))
+ (synopsis "Binary build of the @code{.NET} SDK and runtime")
+ (description "@code{.NET} is a cross-platform developer platform for
+building different types of applications.")
+ (license license:expat))))
+
+(define-public dotnet-core-3.1
+ (let ((dotnet-sdk-version "3.1.13"))
+ (package
+ (name "dotnet")
+ (version "3.1.113")
+ (source
+ (origin
+ (method url-fetch/tarbomb)
+ (uri
+ (string-append "https://dotnetcli.azureedge.net/dotnet/Sdk/"
+ version "/dotnet-sdk-"
+ version "-linux-x64.tar.gz"))
+ (sha256
+ (base32
+ "0dm4kxpq235yfxzf41m1iyfg5avlxdic0nwr865g5wyzc6kz9nhw"))))
+ (build-system binary-build-system)
+ (arguments
+ `(#:patchelf-plan
+ `(("dotnet"
+ ("glibc" "gcc:lib" "zlib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version
+ "/System.Net.Security.Native.so")
+ ("mit-krb5"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version
+ "/System.Security.Cryptography.Native.OpenSsl.so")
+ ("openssl"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version
+ "/System.IO.Compression.Native.so")
+ ("zlib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version
+ "/libcoreclrtraceptprovider.so")
+ ("gcc:lib" "lttng-ust"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/createdump")
+ ("gcc:lib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libclrjit.so")
+ ("gcc:lib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libcoreclr.so")
+ ("gcc:lib" "icu4c"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libdbgshim.so")
+ ("gcc:lib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libhostpolicy.so")
+ ("gcc:lib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libmscordaccore.so")
+ ("gcc:lib"))
+ (,,(string-append "shared/Microsoft.NETCore.App/"
+ dotnet-sdk-version "/libmscordbi.so")
+ ("gcc:lib"))
+ (,,(string-append "packs/Microsoft.NETCore.App.Host.linux-x64/"
+ dotnet-sdk-version
+ "/runtimes/linux-x64/native/apphost")
+ ("gcc:lib"))
+ (,,(string-append "packs/Microsoft.NETCore.App.Host.linux-x64/"
+ dotnet-sdk-version
+ "/runtimes/linux-x64/native/libnethost.so")
+ ("gcc:lib"))
+ (,,(string-append "sdk/" version "/AppHostTemplate/apphost")
+ ("gcc:lib"))
+ (,,(string-append "host/fxr/" dotnet-sdk-version "/libhostfxr.so")
+ ("gcc:lib")))
+ #:install-plan
+ `(("." "share/dotnet/"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'patchelf 'patchelf-writable
+ (lambda _
+ (for-each make-file-writable (find-files "."))))
+ (add-after 'install 'install-wrapper
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin-dir (string-append out "/bin"))
+ (dotnet-target (string-append out "/share/dotnet/dotnet"))
+ (dotnet-dest (string-append bin-dir "/dotnet")))
+ (mkdir-p bin-dir)
+ (symlink dotnet-target dotnet-dest)
+ ;; First symlink, then wrap-program: dotnet cannot run when renamed
+ (wrap-program dotnet-dest
+ ;; Ensure the `dotnet' program does not phone home to share telemetry and get
+ ;; rid of a bunch of i18n warnings.
+ `("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT" = ("1"))
+ `("DOTNET_CLI_TELEMETRY_OPTOUT" = ("1")))))))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "DOTNET_ROOT")
+ (separator #f)
+ (files '("share/dotnet")))))
+ (inputs
+ `(("gcc:lib" ,gcc "lib")
+ ("glibc", glibc)
+ ("icu4c" ,icu4c)
+ ("lttng-ust" ,lttng-ust)
+ ("mit-krb5" ,mit-krb5)
+ ("openssl" ,openssl)
+ ("zlib" ,zlib)))
+ (home-page "https://docs.microsoft.com/en-us/dotnet/")
+ (supported-systems '("x86_64-linux"))
+ (synopsis "Binary build of the @code{.NET} SDK and runtime")
+ (description "@code{.NET} is a cross-platform developer platform for
+building different types of applications.")
+ (license license:expat))))
diff --git a/guix/nongnu/packages/emacs.scm b/guix/nongnu/packages/emacs.scm
new file mode 100644
index 0000000..4e070e2
--- /dev/null
+++ b/guix/nongnu/packages/emacs.scm
@@ -0,0 +1,72 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
+;;;
+;;; This file is not 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 (nongnu packages emacs)
+ #:use-module (guix packages)
+ #:use-module (guix build-system emacs)
+ #:use-module (guix download)
+ #:use-module (nonguix licenses))
+
+(define-public clhs
+ (package
+ (name "clhs")
+ (version "0.6.3")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://beta.quicklisp.org/archive/clhs/2015-04-07/clhs-"
+ version
+ ".tgz"))
+ (sha256
+ (base32
+ "1cn5bfrcawrbc8s1wb07lpr6xv8758l1n5pgkyhamagmi1r0x128"))))
+ (build-system emacs-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'replace-loader
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (delete-file "clhs-use-local.el")
+ (let* ((out (assoc-ref outputs "out"))
+ (hyperspec-dir (string-append "file://" out
+ "/share/HyperSpec-7-0/")))
+ (with-output-to-file "clhs.el"
+ (lambda ()
+ (format #t ";;;###autoload~%~s~%~%~s"
+ `(defun clhs-setup ()
+ (setq common-lisp-hyperspec-root ,hyperspec-dir))
+ `(provide 'clhs)))))))
+ (add-after 'install 'install-doc
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (hyperspec-dir (string-append out "/share/HyperSpec-7-0/")))
+ (mkdir-p hyperspec-dir)
+ (copy-recursively "HyperSpec-7-0/HyperSpec" hyperspec-dir)))))))
+ (home-page "http://quickdocs.org/clhs/")
+ (synopsis "Offline Common Lisp HyperSpec")
+ (description
+ "This package bundles the full Common Lisp HyperSpec ready for offline
+browsing. An Emacs package is provided for easy access. Load it with:
+
+@lisp
+(require 'clhs)
+(clhs-setup)
+@end lisp
+")
+ (license (nonfree "http://quickdocs.org/clhs/"))))
diff --git a/guix/nongnu/packages/emulators.scm b/guix/nongnu/packages/emulators.scm
new file mode 100644
index 0000000..0ec22c0
--- /dev/null
+++ b/guix/nongnu/packages/emulators.scm
@@ -0,0 +1,55 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;;
+;;; This file is not 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 (nongnu packages emulators)
+ #:use-module (gnu packages backup)
+ #:use-module (gnu packages gl)
+ #:use-module (gnu packages sdl)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix download)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix packages)
+ #:use-module (nonguix licenses))
+
+(define-public dgen
+ (package
+ (name "dgen")
+ (version "1.33")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "mirror://sourceforge/dgen/dgen/"
+ version "/dgen-sdl-" version ".tar.gz"))
+ (sha256
+ (base32
+ "07pnvsw04jq9pdiwfhp0nr728rwqq2y6w648gz3p6a622xhc1qlr"))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("sdl" ,sdl)
+ ("libarchive" ,libarchive)
+ ("libgl" ,mesa)))
+ (home-page "http://dgen.sourceforge.net")
+ (synopsis "Emulator for Sega Genesis/Mega Drive systems")
+ (description
+ "DGen isn't the best Mega Drive/Genesis emulator out there, but it works
+and it's probably the most portable. It's one of the few that's x86_64
+compatible. It's also perfect for command line freaks.")
+ (license (list license:bsd-3
+ ;; Many non-free licenses.
+ (nonfree "https://sourceforge.net/p/dgen/dgen/ci/master/tree/COPYING")))))
diff --git a/guix/nongnu/packages/fonts.scm b/guix/nongnu/packages/fonts.scm
new file mode 100644
index 0000000..7120fef
--- /dev/null
+++ b/guix/nongnu/packages/fonts.scm
@@ -0,0 +1,176 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2021 Korytov Pavel <thexcloud@gmail.com>
+;;; Copyright © 2021 Jonathan Brielmaier <jonathan.brielmaier@web.de>
+;;;
+;;; This file is not 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 (nongnu packages fonts)
+ #:use-module (ice-9 string-fun)
+ #:use-module (gnu packages compression)
+ #:use-module (guix download)
+ #:use-module (guix packages)
+ #:use-module (guix build-system font)
+ #:use-module (guix build-system copy)
+ #:use-module (nonguix licenses))
+
+(define mscorefont
+ (lambda* (file #:key version font-name hash)
+ (package
+ ;; Downcase and replace " " with - to get "font-microsoft-times-new-roman"
+ ;; from "Times New Roman"
+ (name (string-append
+ "font-microsoft-"
+ (string-replace-substring (string-downcase font-name) " " "-")))
+ (version version)
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://deac-ams.dl.sourceforge.net/project/corefonts/the%20fonts/final/" file ".exe"))
+ (sha256 (base32 hash))))
+ (build-system font-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ ;; Unpack EXE and replace .TTF with .ttf
+ (replace 'unpack
+ (lambda* (#:key inputs #:allow-other-keys)
+ (use-modules (ice-9 string-fun))
+ (let ((source (assoc-ref inputs "source")))
+ (system (format #f "7z e ~a -ofont" source))
+ (map (lambda (oldname)
+ (rename-file oldname
+ (string-replace-substring oldname "TTF" "ttf")))
+ (find-files "./font" "\\.TTF$"))))))))
+ (native-inputs
+ `(("p7zip" ,p7zip)))
+ (home-page "http://corefonts.sourceforge.net/")
+ (synopsis (string-append font-name " font"))
+ (description (string-append "This package provides " font-name "
+font from the pack of Microsoft core fonts for the web."))
+ (license (nonfree "http://corefonts.sourceforge.net/eula.htm")))))
+
+(define-public font-microsoft-andale-mono
+ (mscorefont
+ "andale32"
+ #:version "2.00"
+ #:font-name "Andale Mono"
+ #:hash "0w7927hlwayqf3vvanf8f3qp2g1i404jzqvhp1z3mp0sjm1gw905"))
+
+(define-public font-microsoft-arial
+ (mscorefont
+ "arial32"
+ #:version "2.82"
+ #:font-name "Arial"
+ #:hash "1xkqyivbyb3z9dcalzidf8m4npzfpls2g0kldyn8g73f2i6plac5"))
+
+(define-public font-microsoft-arial-black
+ (mscorefont
+ "arialb32"
+ #:version "2.35"
+ #:font-name "Arial Black"
+ #:hash "1a60zqrg63kjnykh5hz7dbpzvx7lyivn3vbrp7jyv9d1nvzz09d4"))
+
+(define-public font-microsoft-comic-sans-ms
+ (mscorefont
+ "comic32"
+ #:version "2.10"
+ #:font-name "Comic Sans MS"
+ #:hash "0ki0rljjc1pxkbsxg515fwx15yc95bdyaksa3pjd89nyxzzg6vcw"))
+
+(define-public font-microsoft-couirer-new
+ (mscorefont
+ "courie32"
+ #:version "2.82"
+ #:font-name "Courier New"
+ #:hash "111k3waxki9yyxpjwl2qrdkswvsd2dmvhbjmmrwyipam2s31sldv"))
+
+(define-public font-microsoft-georgia
+ (mscorefont
+ "georgi32"
+ #:version "2.05"
+ #:font-name "Georgia"
+ #:hash "0083jcpd837j2c06kp1q8glfjn9k7z6vg3wi137savk0lv6psb1c"))
+
+(define-public font-microsoft-impact
+ (mscorefont
+ "impact32"
+ #:version "2.35"
+ #:font-name "Impact"
+ #:hash "1yyc5z7zmm3s418hmrkmc8znc55afsrz5dgxblpn9n81fhxyyqb0"))
+
+(define-public font-microsoft-trebuchet-ms
+ (mscorefont
+ "trebuc32"
+ #:version "1.22"
+ #:font-name "Trebuchet MS"
+ #:hash "1jfsgz80pvyqvpfpaiz5pd8zwlcn67rg2jgynjwf22sip2dhssas"))
+
+(define-public font-microsoft-times-new-roman
+ (mscorefont
+ "times32"
+ #:version "2.82"
+ #:font-name "Times New Roman"
+ #:hash "1aq7z3l46vwgqljvq9zfgkii6aivy00z1529qbjkspggqrg5jmnv"))
+
+(define-public font-microsoft-verdana
+ (mscorefont
+ "verdan32"
+ #:version "2.35"
+ #:font-name "Verdana"
+ #:hash "15mdbbfqbyp25a6ynik3rck3m3mg44plwrj79rwncc9nbqjn3jy1"))
+
+(define-public font-microsoft-webdings
+ (mscorefont
+ "webdin32"
+ #:version "1.03"
+ #:font-name "Webdings"
+ #:hash "0nnp2znmnmx87ijq9zma0vl0hd46npx38p0cc6lgp00hpid5nnb4"))
+
+(define-public font-microsoft-web-core-fonts
+ (package
+ (inherit font-microsoft-times-new-roman)
+ (name "font-microsoft-web-core-fonts")
+ (version "1.0.0")
+ (synopsis "Collection of widely spread Microsoft TrueType fonts")
+ (description "This package provides fonts from the collection of Microsoft
+True Type Core Fonts for the Web.
+
+Included fonts:
+@itemize
+@item Andale Mono
+@item Arial Black
+@item Arial (Bold, Italic, Bold Italic)
+@item Comic Sans MS (Bold)
+@item Courier New (Bold, Italic, Bold Italic)
+@item Georgia (Bold, Italic, Bold Italic)
+@item Impact
+@item Times New Roman (Bold, Italic, Bold Italic)
+@item Trebuchet (Bold, Italic, Bold Italic)
+@item Verdana (Bold, Italic, Bold Italic)
+@item Webdings
+@end itemize")
+ (propagated-inputs
+ `(("font-microsoft-andale-mono" ,font-microsoft-andale-mono)
+ ("font-microsoft-arial" ,font-microsoft-arial)
+ ("font-microsoft-arial-black" ,font-microsoft-arial-black)
+ ("font-microsoft-comic-sans-ms" ,font-microsoft-comic-sans-ms)
+ ("font-microsoft-couirer-new" ,font-microsoft-couirer-new)
+ ("font-microsoft-georgia" ,font-microsoft-georgia)
+ ("font-microsoft-impact" ,font-microsoft-impact)
+ ("font-microsoft-times-new-roman" ,font-microsoft-times-new-roman)
+ ("font-microsoft-trebuchet-ms" ,font-microsoft-trebuchet-ms)
+ ("font-microsoft-verdana" ,font-microsoft-verdana)
+ ("font-microsoft-webdings" ,font-microsoft-webdings)))))
diff --git a/guix/nongnu/packages/game-development.scm b/guix/nongnu/packages/game-development.scm
new file mode 100644
index 0000000..0974af5
--- /dev/null
+++ b/guix/nongnu/packages/game-development.scm
@@ -0,0 +1,302 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019, 2020 Pierre Neidhardt <mail@ambrevar.xyz>
+;;;
+;;; This file is not 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 (nongnu packages game-development)
+ #:use-module (ice-9 match)
+ #:use-module ((nonguix licenses) :prefix license:)
+ #:use-module (guix packages)
+ #:use-module (nonguix build-system binary)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix utils)
+ #:use-module (gnu packages audio)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages gcc)
+ #:use-module (gnu packages gl)
+ #:use-module (gnu packages gtk)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages sdl)
+ #:use-module (gnu packages video)
+ #:use-module (gnu packages xiph)
+ #:use-module (gnu packages xorg))
+
+(define nvidia-cg-toolkit-version "3.1")
+(define nvidia-cg-toolkit-date "April2012")
+
+(define nvidia-cg-toolkit-i686-archive
+ (origin
+ (method url-fetch)
+ (uri
+ (string-append "http://developer.download.nvidia.com/cg/Cg_"
+ nvidia-cg-toolkit-version
+ "/Cg-" nvidia-cg-toolkit-version "_" nvidia-cg-toolkit-date "_"
+ "x86" ".tgz"))
+ (sha256
+ (base32 "0yc8n6vpqyb6qhcv5kwvr3h21ya271fi930fvd98hlkg8cg5kwyf"))))
+
+(define nvidia-cg-toolkit-x86_64-archive
+ (origin
+ (method url-fetch)
+ (uri
+ (string-append "http://developer.download.nvidia.com/cg/Cg_"
+ nvidia-cg-toolkit-version
+ "/Cg-" nvidia-cg-toolkit-version "_" nvidia-cg-toolkit-date "_"
+ "x86_64" ".tgz"))
+ (sha256
+ (base32 "0y4qms4lm9xiix93g45337rx5nrp0y3gb0x0avyv7l9qrkk03zz8"))))
+
+(define (lib)
+ (if (string=? (or (%current-target-system) (%current-system)) "x86_64-linux")
+ "lib64" "lib"))
+
+(define-public nvidia-cg-toolkit
+ (package
+ (name "nvidia-cg-toolkit")
+ (version nvidia-cg-toolkit-version)
+ (source #f)
+ (build-system binary-build-system)
+ (arguments
+ `(#:strip-binaries? #f ; Fails with "allocated section `.dynstr' not in segment".
+ #:patchelf-plan
+ `(("bin/cgc"
+ ("glibc" "out"))
+ ("bin/cginfo"
+ ("gcc:lib" "glibc"))
+ ("bin/cgfxcat"
+ ("out" "glibc" "glu" "mesa" "libice" "libsm"
+ "libxmu" "libxt" "libxi" "libxext" "libx11"))
+ (,,(string-append (lib) "/libCg.so")
+ ("glibc"))
+ (,,(string-append (lib) "/libCgGL.so")
+ ("out" "glibc")))
+ #:install-plan
+ `(("bin" "./")
+ (,,(lib) "lib")
+ ("include" "./")
+ ("local/" "share/"))
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'unpack
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((archive (assoc-ref inputs "nvidia-cg-toolkit-archive")))
+ (invoke "tar" "xf" archive)
+ (chdir "usr")
+ #t))))))
+ (native-inputs
+ `(("nvidia-cg-toolkit-archive"
+ ,(match (or (%current-target-system) (%current-system))
+ ("x86_64-linux" nvidia-cg-toolkit-x86_64-archive)
+ (_ nvidia-cg-toolkit-i686-archive)))))
+ (inputs
+ `(("gcc:lib" ,gcc "lib")
+ ("glibc" ,glibc)
+ ("glu" ,glu)
+ ("libice" ,libice)
+ ("libsm" ,libsm)
+ ("libxmu" ,libxmu)
+ ("libxt" ,libxt)
+ ("libxi" ,libxi)
+ ("libxext" ,libxext)
+ ("libx11" ,libx11)))
+ (home-page "https://developer.nvidia.com/cg-toolkit")
+ (synopsis "High-level shading language")
+ (description "NVIDIA introduced programmable shading with Cg, which
+supported dozens of different OpenGL and DirectX profile targets. It allowed
+developers to incorporate interactive effects within 3D applications and share
+them among other Cg applications, across graphics APIs, and most operating
+systems as well as balance effect complexities with client GPU capabilities.
+
+The Cg Toolkit is a legacy NVIDIA toolkit no longer under active development
+or support. It is not recommended using it in new development projects
+because future hardware features may not be supported. Going forward, new
+development should opt for GLSL rather than Cg.")
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (license (license:nonfree "file://share/Cg/docs/license.txt"))))
+
+(define-public libsteam
+ (package
+ (name "libsteam")
+ (version "2013")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://github.com/ValveSoftware/source-sdk-"
+ version
+ "/raw/master/sp/src/lib/public/linux32/libsteam_api.so"))
+ (sha256
+ (base32
+ "1ivxvikm8i6mmmqvib8j5m7g5n1cdlki2sf4v7g13c7xba7aj438"))))
+ (build-system binary-build-system)
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (arguments
+ `(#:system "i686-linux"
+ #:validate-runpath? #f ; TODO: Why doesn't it pass?
+ #:patchelf-plan
+ `(("libsteam_api.so"
+ ("gcc:lib")))
+ #:install-plan
+ `(("." ("steam") "lib/"))
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'unpack
+ (lambda* (#:key inputs #:allow-other-keys)
+ (copy-file (assoc-ref inputs "source") "libsteam_api.so")
+ (chmod "libsteam_api.so" #o644)
+ #t))
+ (add-after 'install 'symlink
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (symlink (string-append out "/lib/libsteam_api.so")
+ (string-append out "/lib/libsteam_api.so.1")))
+ #t)))))
+ (inputs
+ `(("gcc:lib" ,gcc "lib")))
+ (home-page "https://developer.valvesoftware.com/wiki/SDK2013_GettingStarted")
+ (synopsis "Redistribution binary needed by some video games")
+ (description "")
+ (license (license:nonfree
+ "https://raw.githubusercontent.com/ValveSoftware/source-sdk-2013/master/LICENSE"))))
+
+(define-public eduke32
+ ;; There are no official releases.
+ (let ((commit "188e14622cfe5c6f63b04b989b350bf2a29a893c")
+ (revision "1")
+ (duke-nukem-3d-directory "share/dukenukem3d"))
+ (package
+ (name "eduke32")
+ (version (git-version "0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://voidpoint.io/terminx/eduke32.git")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0wy4bppiw4q2hn0v38msrjyvj2hzfvigakc23c2wqfnbl7rm0hrz"))
+ ;; Unbundle libxmp.
+ (modules '((guix build utils)))
+ (snippet
+ '(begin (delete-file-recursively "source/libxmp-lite") #t))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f
+ ;; Add glu to rpath so that SDL can dlopen it.
+ #:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
+ (assoc-ref %build-inputs "glu") "/lib"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'unbundle-libxmp
+ (lambda _
+ (substitute* "GNUmakefile"
+ (("-I\\$\\(libxmplite_inc\\)")
+ (string-append "-I" (assoc-ref %build-inputs "libxmp") "/include"))
+ (("^ *audiolib_deps \\+= libxmplite.*$") "")
+ (("-logg") "-logg -lxmp"))
+ (with-directory-excursion "source/audiolib/src"
+ (for-each (lambda (file) (substitute* file (("libxmp-lite/") "")))
+ '("multivoc.cpp" "xmp.cpp")))
+ #t))
+ (delete 'configure)
+ (replace 'install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (glu (assoc-ref inputs "glu"))
+ (eduke (string-append out "/bin/eduke32"))
+ (eduke-real (string-append out "/bin/.eduke32-real")))
+ ;; TODO: Install custom .desktop file? Need icon.
+ ;; See https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=eduke32.
+ (install-file "eduke32" (string-append out "/bin"))
+ (install-file "mapster32" (string-append out "/bin"))
+ (install-file "package/common/buildlic.txt"
+ (string-append out "/share/licenses"))
+ ;; Wrap program:
+ ;; - Make sure current directory is writable, else eduke32 will segfault.
+ ;; - Add ../share/dukenukem3d to the dir search list.
+ ;; TODO: Skip store duke3d.grp When ~/.config/eduke32/duke3d.grp is found.
+ (rename-file eduke eduke-real)
+ (call-with-output-file eduke
+ (lambda (p)
+ (format p "\
+#!~a
+mkdir -p ~~/.config/eduke32
+cd ~~/.config/eduke32
+exec -a \"$0\" ~a\
+ -g \"${0%/*}\"/../~a/*.grp\
+ -g \"${0%/*}\"/../~a/*.zip\
+ -g \"${0%/*}\"/../~a/*.map\
+ -g \"${0%/*}\"/../~a/*.con\
+ -g \"${0%/*}\"/../~a/*.def\
+ \"$@\"~%"
+ (which "bash") eduke-real
+ ,duke-nukem-3d-directory
+ ,duke-nukem-3d-directory
+ ,duke-nukem-3d-directory
+ ,duke-nukem-3d-directory
+ ,duke-nukem-3d-directory)))
+ (chmod eduke #o755)))))))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)))
+ (inputs
+ `(("sdl-union" ,(sdl-union (list sdl2 sdl2-mixer)))
+ ("alsa-lib" ,alsa-lib)
+ ("glu" ,glu)
+ ("libvorbis" ,libvorbis)
+ ("libvpx" ,libvpx)
+ ("libxmp" ,libxmp)
+ ("flac" ,flac)
+ ("gtk+" ,gtk+-2)))
+ (synopsis "Engine of the classic PC first person shooter Duke Nukem 3D")
+ (description "EDuke32 is a free homebrew game engine and source port of the
+classic PC first person shooter Duke Nukem 3D—Duke3D for short. A thousands
+of features and upgrades were added for regular players and additional editing
+capabilities and scripting extensions for homebrew developers and mod
+creators. EDuke32 is open source but non-free software.
+
+This package does not contain any game file. You can either install packages
+with game files or or put @file{.grp} game files manually in
+@file{~/.config/eduke32/}.")
+ (home-page "https://eduke32.com/")
+ (license (license:nonfree
+ "https://eduke32.com/buildlic.txt")))))
+
+(define-public fury
+ (package
+ (inherit eduke32)
+ (name "fury")
+ (arguments
+ (substitute-keyword-arguments (package-arguments eduke32)
+ ((#:make-flags flags ''()) `(cons* "FURY=1" ,flags))
+ ((#:phases phases '%standard-phases)
+ `(modify-phases ,phases
+ (replace 'install
+ (lambda _
+ (let* ((out (assoc-ref %outputs "out")))
+ (install-file "fury" (string-append out "/bin"))
+ (install-file "mapster32" (string-append out "/bin"))
+ (install-file "package/common/buildlic.txt"
+ (string-append out "/share/licenses")))
+ #t))))))
+ (synopsis "Game engine for the first-person shooter Ion Fury")
+ (description
+ (string-append
+ "This is the @code{eduke32} engine built with support for the Ion Fury
+game. Game data is not provided. Run @command{fury} with the option
+@option{-j} to specify the directory containing @file{fury.grp}."))))
diff --git a/guix/nongnu/packages/gog.scm b/guix/nongnu/packages/gog.scm
new file mode 100644
index 0000000..88a8a84
--- /dev/null
+++ b/guix/nongnu/packages/gog.scm
@@ -0,0 +1,70 @@
+;;; Copyright © 2019, 2020 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2021 Timotej Lazar <timotej.lazar@araneo.si>
+;;;
+;;; This program 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.
+;;;
+;;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (nongnu packages gog)
+ #:use-module (gnu packages boost)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages crypto)
+ #:use-module (gnu packages curl)
+ #:use-module (gnu packages man)
+ #:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages qt)
+ #:use-module (gnu packages serialization)
+ #:use-module (gnu packages web)
+ #:use-module (gnu packages xml)
+ #:use-module (guix packages)
+ #:use-module (guix git-download)
+ #:use-module (guix build-system cmake)
+ #:use-module ((guix licenses) #:prefix license:))
+
+(define-public lgogdownloader
+ (package
+ (name "lgogdownloader")
+ (version "3.7")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/Sude-/lgogdownloader.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "02zn4zc9hqym81vbs88x5ayk2xb808jlvfyvn96ksx1ai4b6a4fz"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:configure-flags '("-DUSE_QT_GUI=ON")
+ #:tests? #f)) ; no tests
+ (inputs
+ `(("boost" ,boost)
+ ("curl" ,curl)
+ ("htmlcxx" ,htmlcxx)
+ ("jsoncpp" ,jsoncpp)
+ ("liboauth" ,liboauth)
+ ("qtbase" ,qtbase-5)
+ ("qtdeclarative" ,qtdeclarative)
+ ("qtwebchannel" ,qtwebchannel)
+ ("qtwebengine" ,qtwebengine)
+ ("rhash" ,rhash)
+ ("tinyxml2" ,tinyxml2)
+ ("zlib" ,zlib)))
+ (native-inputs
+ `(("help2man" ,help2man)
+ ("pkg-config" ,pkg-config)))
+ (home-page "https://sites.google.com/site/gogdownloader/")
+ (synopsis "Downloader for GOG.com files")
+ (description "LGOGDownloader is a client for the GOG.com download API,
+allowing simple downloads and updates of games and other files from GOG.com.")
+ (license license:wtfpl2)))
diff --git a/guix/nongnu/packages/linux.scm b/guix/nongnu/packages/linux.scm
new file mode 100644
index 0000000..c0db919
--- /dev/null
+++ b/guix/nongnu/packages/linux.scm
@@ -0,0 +1,836 @@
+;;; Copyright © 2019, 2020 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2019 Timotej Lazar <timotej.lazar@araneo.si>
+;;; Copyright © 2020, 2021 James Smith <jsubuntuxp@disroot.org>
+;;; Copyright © 2020, 2021 Jonathan Brielmaier <jonathan.brielmaier@web.de>
+;;; Copyright © 2021 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;;
+;;; This program 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.
+;;;
+;;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (nongnu packages linux)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages linux)
+ #:use-module (guix licenses)
+ #:use-module (guix packages)
+ #:use-module (guix utils)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix build-system copy)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system linux-module)
+ #:use-module (guix build-system trivial)
+ #:use-module (ice-9 match)
+ #:use-module (nonguix licenses)
+ #:export (corrupt-linux))
+
+(define (linux-urls version)
+ "Return a list of URLS for Linux VERSION."
+ (list (string-append "https://www.kernel.org/pub/linux/kernel/v"
+ (version-major version) ".x/linux-" version ".tar.xz")))
+
+(define (corrupt-linux freedo version hash)
+ (package
+ (inherit freedo)
+ (name "linux")
+ (version version)
+ (source (origin
+ (method url-fetch)
+ (uri (linux-urls version))
+ (sha256 (base32 hash))))
+ (home-page "https://www.kernel.org/")
+ (synopsis "Linux kernel with nonfree binary blobs included")
+ (description
+ "The unmodified Linux kernel, including nonfree blobs, for running Guix
+System on hardware which requires nonfree software to function.")))
+
+(define-public linux-5.15
+ (corrupt-linux linux-libre-5.15 "5.15.5"
+ "07w5k2y5hk6ys19zgg3x21g6im9x0pwk5f6f8b0q3b152lq5lmp9"))
+
+(define-public linux-5.10
+ (corrupt-linux linux-libre-5.10 "5.10.81"
+ "1nssv94zivx08vrxxflq4dxk5fxl3azsqlnzvw58qnf469hniqd2"))
+
+(define-public linux-5.4
+ (corrupt-linux linux-libre-5.4 "5.4.145"
+ "1yb8vk5sbnyswylkpqw5i4n9cmnmlrfmbrnmy3nif579q8p7ixsw"))
+
+(define-public linux-4.19
+ (corrupt-linux linux-libre-4.19 "4.19.206"
+ "1h44lvzxd0cngj71bk8qba9dz7jlqj68ir6xjwfafglb81ppgsxp"))
+
+(define-public linux-4.14
+ (corrupt-linux linux-libre-4.14 "4.14.246"
+ "0fpgig84shpas1jc0h4s3aw9brkcq1as84gjbk4bfhc48bpi4mlw"))
+
+(define-public linux-4.9
+ (corrupt-linux linux-libre-4.9 "4.9.282"
+ "059fin4si93ya13xy831w84q496ksxidpd3kyw38918sfy4p6wk7"))
+
+(define-public linux-4.4
+ (corrupt-linux linux-libre-4.4 "4.4.283"
+ "1d9v4h4cbc4i371lhhwpxbmg88gna6xyi2ahfvv0clz60802y982"))
+
+(define-public linux linux-5.15)
+;; linux-lts points to the *newest* released long-term support version.
+(define-public linux-lts linux-5.10)
+
+(define-public linux-firmware
+ (package
+ (name "linux-firmware")
+ (version "20210919")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://git.kernel.org/pub/scm/linux/kernel"
+ "/git/firmware/linux-firmware.git/snapshot/"
+ "linux-firmware-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1fy6alg7pz5bc09vq0icmgbwqpribws6nyc6k2pkip8jljmxvlr0"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f
+ #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'validate-runpath))))
+ (home-page
+ "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git")
+ (synopsis "Nonfree firmware blobs for Linux")
+ (description "Nonfree firmware blobs for enabling support for various
+hardware in the Linux kernel. This is a large package which may be overkill
+if your hardware is supported by one of the smaller firmware packages.")
+ (license
+ (nonfree
+ (string-append "https://git.kernel.org/pub/scm/linux/kernel/git/"
+ "firmware/linux-firmware.git/plain/WHENCE")))))
+
+(define (select-firmware keep)
+ "Modify linux-firmware copy list to retain only files matching KEEP regex."
+ `(lambda _
+ (use-modules (ice-9 regex))
+ (substitute* "WHENCE"
+ (("^(File|Link): *([^ ]*)(.*)" _ type file rest)
+ (string-append (if (string-match ,keep file) type "Skip") ": " file rest)))))
+
+(define-public amdgpu-firmware
+ (package
+ (inherit linux-firmware)
+ (name "amdgpu-firmware")
+ (arguments
+ `(#:license-file-regexp "LICENSE.amdgpu"
+ ,@(substitute-keyword-arguments (package-arguments linux-firmware)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'select-firmware
+ ,(select-firmware "^amdgpu/")))))))
+ (home-page "http://support.amd.com/en-us/download/linux")
+ (synopsis "Nonfree firmware for AMD graphics chips")
+ (description "Nonfree firmware for AMD graphics chips. While most AMD
+graphics cards can be run with the free Mesa, many modern cards require a
+nonfree kernel module to run properly and support features like hibernation and
+advanced 3D.")
+ (license
+ (nonfree
+ (string-append
+ "https://git.kernel.org/pub/scm/linux/kernel/git/firmware"
+ "/linux-firmware.git/plain/LICENSE.amdgpu")))))
+
+(define-public radeon-firmware
+ (package
+ (inherit amdgpu-firmware)
+ (name "radeon-firmware")
+ (arguments
+ `(#:license-file-regexp "LICENSE.radeon"
+ ,@(substitute-keyword-arguments (package-arguments linux-firmware)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'select-firmware
+ ,(select-firmware "^radeon/")))))))
+ (synopsis "Nonfree firmware for older AMD graphics chips")
+ (description "Nonfree firmware for AMD graphics chips. While most AMD
+graphics cards can be run with the free Mesa, some cards require a nonfree
+kernel module to run properly and support features like hibernation and
+advanced 3D.")))
+
+(define-public raspberrypi-firmware
+(package
+ (name "raspberrypi-firmware")
+ (version "1.20210527")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/raspberrypi/firmware")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "08lgg90k6lhqm3ccg7db0lrrng0pgf63dvbrxpfpwm1pswrc5vf5"))))
+ (build-system copy-build-system)
+ (synopsis "Firmware for the Raspberry Pi boards")
+ (description "Pre-compiled binaries of the current Raspberry Pi kernel
+and modules, userspace libraries, and bootloader/GPU firmware.")
+ (home-page "https://github.com/raspberrypi/firmware")
+ (supported-systems '("armhf-linux" "aarch64-linux"))
+ (license
+ (list gpl2
+ (nonfree
+ (string-append "file://boot/LICENCE.broadcom"))
+ (nonfree
+ (string-append "file://opt/vc/LICENCE"))))))
+
+(define-public atheros-firmware
+ (package
+ (inherit linux-firmware)
+ (name "atheros-firmware")
+ (arguments
+ `(#:license-file-regexp "LICEN[CS]E.*[Aa]th"
+ ,@(substitute-keyword-arguments (package-arguments linux-firmware)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'select-firmware
+ ,(select-firmware "^(ar[3579]|ath[1369]|htc_[79]|qca/|wil6)")))))))
+ (synopsis "Nonfree firmware blobs for Atheros wireless cards")
+ (description "Nonfree firmware blobs for Atheros wireless cards. This
+package contains nonfree firmware for the following chips:
+@itemize
+@item Atheros AR3012 rev 01020001 patch (ar3k/AthrBT_0x01020001.dfu)
+@item Atheros AR3012 rev 01020200 patch (ar3k/AthrBT_0x01020200.dfu)
+@item Atheros AR3012 rev 01020201 patch, version 170 (ar3k/AthrBT_0x01020201.dfu)
+@item Atheros AR3012 rev 11020000 patch (ar3k/AthrBT_0x11020000.dfu)
+@item Atheros AR3012 rev 11020100 patch (ar3k/AthrBT_0x11020100.dfu)
+@item Atheros AR3012 rev 31010000 patch (ar3k/AthrBT_0x31010000.dfu)
+@item Atheros AR3012 rev 31010100 patch (ar3k/AthrBT_0x31010100.dfu)
+@item Atheros AR3012 rev 41020000 patch (ar3k/AthrBT_0x41020000.dfu)
+@item Atheros AR3012 rev 01020001 config (ar3k/ramps_0x01020001_26.dfu)
+@item Atheros AR3012 rev 01020200 26 MHz config (ar3k/ramps_0x01020200_26.dfu)
+@item Atheros AR3012 rev 01020200 40 MHz config (ar3k/ramps_0x01020200_40.dfu)
+@item Atheros AR3012 rev 01020201 26 MHz config (ar3k/ramps_0x01020201_26.dfu)
+@item Atheros AR3012 rev 01020201 40 MHz config (ar3k/ramps_0x01020201_40.dfu)
+@item Atheros AR3012 rev 11020000 config (ar3k/ramps_0x11020000_40.dfu)
+@item Atheros AR3012 rev 11020100 config (ar3k/ramps_0x11020100_40.dfu)
+@item Atheros AR3012 rev 31010000 config (ar3k/ramps_0x31010000_40.dfu)
+@item Atheros AR3012 rev 31010100 config (ar3k/ramps_0x31010100_40.dfu)
+@item Atheros AR3012 rev 41020000 config (ar3k/ramps_0x41020000_40.dfu)
+@item Atheros AR5523 firmware (ar5523.bin)
+@item Atheros AR7010 rev 1.0 firmware (ar7010.fw)
+@item Atheros AR7010 rev 1.1 firmware (ar7010_1_1.fw)
+@item Atheros AR9271 firmware (ar9271.fw)
+@item Qualcomm Atheros QCA4019 rev 1.0 board configuration
+(ath10k/QCA4019/hw1.0/board-2.bin)
+@item Qualcomm Atheros QCA4019 rev 1.0 firmware, version 10.4-3.6-00140
+(ath10k/QCA4019/hw1.0/firmware-5.bin)
+@item Qualcomm Atheros QCA6174 rev 2.1 board configuration, version 1
+(ath10k/QCA6174/hw2.1/board.bin)
+@item Qualcomm Atheros QCA6174 rev 2.1 board configuration, version 2
+(ath10k/QCA6174/hw2.1/board-2.bin)
+@item Qualcomm Atheros QCA6174 rev 2.1 firmware, version
+SW_RM.1.1.1-00157-QCARMSWPZ-1 (ath10k/QCA6174/hw2.1/firmware-5.bin)
+@item Qualcomm Atheros QCA6174 rev 3.0 board configuration, version 1
+(ath10k/QCA6174/hw3.0/board.bin)
+@item Qualcomm Atheros QCA6174 rev 3.0 board configuration
+(ath10k/QCA6174/hw3.0/board-2.bin)
+@item Qualcomm Atheros QCA6174 rev 3.0 firmware, version
+WLAN.RM.2.0-00180-QCARMSWPZ-1 (ath10k/QCA6174/hw3.0/firmware-4.bin)
+@item Qualcomm Atheros QCA6174 rev 3.0 firmware, version
+WLAN.RM.4.4.1-00079-QCARMSWPZ-1 (ath10k/QCA6174/hw3.0/firmware-6.bin)
+@item Qualcomm Atheros QCA9377 rev 1.0 board configuration, version 1
+(ath10k/QCA9377/hw1.0/board.bin)
+@item Qualcomm Atheros QCA9377 rev 1.0 board configuration, version 2
+(ath10k/QCA9377/hw1.0/board-2.bin)
+@item Qualcomm Atheros QCA9377 rev 1.0 firmware, version WLAN.TF.1.0-00267-1
+(ath10k/QCA9377/hw1.0/firmware-5.bin)
+@item Qualcomm Atheros QCA9377 rev 1.0 firmware, version
+WLAN.TF.2.1-00021-QCARMSWP-1 (ath10k/QCA9377/hw1.0/firmware-6.bin)
+@item Qualcomm Atheros QCA9887 rev 1.0 board configuration, version 1
+(ath10k/QCA9887/hw1.0/board.bin)
+@item Qualcomm Atheros QCA9887 rev 1.0 firmware, version 10.2.4-1.0-00041
+(ath10k/QCA9887/hw1.0/firmware-5.bin)
+@item Qualcomm Atheros QCA9888 rev 2.0 board configuration, version 2
+(ath10k/QCA9888/hw2.0/board-2.bin)
+@item Qualcomm Atheros QCA9888 rev 2.0 firmware, version 10.4-3.9.0.2-00024
+(ath10k/QCA9888/hw2.0/firmware-5.bin)
+@item Qualcomm Atheros QCA988X board configuration, version 1
+(ath10k/QCA988X/hw2.0/board.bin)
+@item Qualcomm Atheros QCA988X firmware, version 10.2.4.45
+(ath10k/QCA988X/hw2.0/firmware-4.bin)
+@item Qualcomm Atheros QCA988X firmware, version 10.2.4-1.0-00043
+(ath10k/QCA988X/hw2.0/firmware-5.bin)
+@item Qualcomm Atheros QCA9984 rev 1.0 board configuration, version 2
+(ath10k/QCA9984/hw1.0/board-2.bin)
+@item Qualcomm Atheros QCA9984 rev 1.0 firmware, version 10.4-3.9.0.2-00021
+(ath10k/QCA9984/hw1.0/firmware-5.bin)
+@item Qualcomm Atheros QCA99X0 board configuration, version 1
+(ath10k/QCA99X0/hw2.0/board.bin)
+@item Qualcomm Atheros QCA99X0 firmware, version 10.4.1.00030-1
+(ath10k/QCA99X0/hw2.0/firmware-5.bin)
+@item Atheros AR3011 firmware (ath3k-1.fw)
+@item ath6k/AR6003.1/hw2.1.1/athwlan.bin
+@item ath6k/AR6003.1/hw2.1.1/bdata.SD31.bin
+@item ath6k/AR6003.1/hw2.1.1/bdata.SD32.bin
+@item ath6k/AR6003.1/hw2.1.1/bdata.WB31.bin
+@item ath6k/AR6003.1/hw2.1.1/data.patch.bin
+@item ath6k/AR6003.1/hw2.1.1/endpointping.bin
+@item ath6k/AR6003.1/hw2.1.1/otp.bin
+@item ath6k/AR6003/hw1.0/athwlan.bin.z77
+@item ath6k/AR6003/hw1.0/bdata.SD31.bin
+@item ath6k/AR6003/hw1.0/bdata.SD32.bin
+@item ath6k/AR6003/hw1.0/bdata.WB31.bin
+@item ath6k/AR6003/hw1.0/data.patch.bin
+@item ath6k/AR6003/hw1.0/otp.bin.z77
+@item ath6k/AR6003/hw2.0/athwlan.bin.z77
+@item ath6k/AR6003/hw2.0/bdata.SD31.bin
+@item ath6k/AR6003/hw2.0/bdata.SD32.bin
+@item ath6k/AR6003/hw2.0/bdata.WB31.bin
+@item ath6k/AR6003/hw2.0/data.patch.bin
+@item ath6k/AR6003/hw2.0/otp.bin.z77
+@item ath6k/AR6003/hw2.1.1/athwlan.bin
+@item ath6k/AR6003/hw2.1.1/bdata.SD31.bin
+@item ath6k/AR6003/hw2.1.1/bdata.SD32.bin
+@item ath6k/AR6003/hw2.1.1/bdata.WB31.bin
+@item ath6k/AR6003/hw2.1.1/data.patch.bin
+@item ath6k/AR6003/hw2.1.1/endpointping.bin
+@item ath6k/AR6003/hw2.1.1/fw-2.bin
+@item ath6k/AR6003/hw2.1.1/fw-3.bin
+@item ath6k/AR6003/hw2.1.1/otp.bin
+@item ath6k/AR6004/hw1.2/bdata.bin
+@item ath6k/AR6004/hw1.2/fw-2.bin
+@item ath6k/AR6004/hw1.3/bdata.bin
+@item ath6k/AR6004/hw1.3/fw-3.bin
+@item Atheros AR7010 firmware, version 1.4.0 (ath9k_htc/htc_7010-1.4.0.fw)
+@item Atheros AR9271 firmware, version 1.4.0 (ath9k_htc/htc_9271-1.4.0.fw)
+@item Atheros AR7010 firmware, version 1.3.1 (htc_7010.fw)
+@item Atheros AR9271 firmware, version 1.3.1 (htc_9271.fw)
+@item Qualcomm WCN3990 Bluetooth firmware (qca/crbtfw21.tlv)
+@item Qualcomm WCN3990 Bluetooth NVM configuration (qca/crnv21.bin)
+@item Qualcomm Atheros QCA61x4 version 3.0 UART BT NVM configuration
+(qca/nvm_00130300.bin)
+@item Qualcomm Atheros QCA61x4 version 3.2 UART BT NVM configuration
+(qca/nvm_00130302.bin)
+@item Qualcomm Atheros QCA6174 BT NVM configuration (qca/nvm_00440302.bin)
+@item Qualcomm Atheros QCA61x4 version 2.0 USB BT NVM configuration
+(qca/nvm_usb_00000200.bin)
+@item Qualcomm Atheros QCA61x4 version 2.1 USB BT NVM configuration
+(qca/nvm_usb_00000201.bin)
+@item Qualcomm Atheros QCA61x4 version 3.0 USB BT NVM configuration
+(qca/nvm_usb_00000300.bin)
+@item Qualcomm Atheros QCA61x4 version 3.2 USB BT NVM configuration
+(qca/nvm_usb_00000302.bin)
+@item Qualcomm Atheros QCA61x4 version 3.0 UART BT rampatch
+(qca/rampatch_00130300.bin)
+@item Qualcomm Atheros QCA61x4 version 3.2 UART BT rampatch
+(qca/rampatch_00130302.bin)
+@item Qualcomm Atheros QCA6174 BT rampatch (qca/rampatch_00440302.bin)
+@item Qualcomm Atheros QCA61x4 version 2.0 USB BT rampatch
+(qca/rampatch_usb_00000200.bin)
+@item Qualcomm Atheros QCA61x4 version 2.1 USB BT rampatch
+(qca/rampatch_usb_00000201.bin)
+@item Qualcomm Atheros QCA61x4 version 3.0 USB BT rampatch
+(qca/rampatch_usb_00000300.bin)
+@item Qualcomm Atheros QCA61x4 version 3.2 USB BT rampatch
+(qca/rampatch_usb_00000302.bin)
+@item Qualcomm Atheros Wil62x0 default board parameters, version 5.2.0.18
+(wil6210.brd)
+@item Qualcomm Atheros Wil62x0 firmware, version 5.2.0.18 (wil6210.fw)
+@end itemize")
+ (license
+ (list
+ (nonfree
+ (string-append
+ "https://git.kernel.org/pub/scm/linux/kernel/git/firmware"
+ "/linux-firmware.git/plain/LICENCE.atheros_firmware"))
+ (non-copyleft
+ (string-append
+ "https://git.kernel.org/pub/scm/linux/kernel/git/firmware"
+ "/linux-firmware.git/plain/LICENCE.open-ath9k-htc-firmware"))
+ (nonfree
+ (string-append
+ "https://git.kernel.org/pub/scm/linux/kernel/git/firmware"
+ "/linux-firmware.git/plain/LICENSE.QualcommAtheros_ar3k"))
+ (nonfree
+ (string-append
+ "https://git.kernel.org/pub/scm/linux/kernel/git/firmware"
+ "/linux-firmware.git/plain/LICENSE.QualcommAtheros_ath10k"))))))
+
+(define-public ath3k-firmware
+ (deprecated-package "ath3k-firmware" atheros-firmware))
+
+(define-public ibt-hw-firmware
+ (package
+ (inherit linux-firmware)
+ (name "ibt-hw-firmware")
+ (arguments
+ `(#:license-file-regexp "LICENCE.ibt_firmware"
+ ,@(substitute-keyword-arguments (package-arguments linux-firmware)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'select-firmware
+ ,(select-firmware "^intel/ibt-")))))))
+ (home-page "http://www.intel.com/support/wireless/wlan/sb/CS-016675.htm")
+ (synopsis "Non-free firmware for Intel bluetooth chips")
+ (description "This firmware is required by the btintel kernel module to
+support many modern bluetooth Intel wireless cards (commonly found in
+laptops).")
+ (license
+ (nonfree (string-append
+ "https://git.kernel.org/pub/scm/linux/kernel/git/firmware"
+ "/linux-firmware.git/plain/LICENCE.ibt_firmware")))))
+
+(define-public iwlwifi-firmware
+ (package
+ (inherit linux-firmware)
+ (name "iwlwifi-firmware")
+ (arguments
+ `(#:license-file-regexp "LICENCE.iwlwifi_firmware"
+ ,@(substitute-keyword-arguments (package-arguments linux-firmware)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'select-firmware
+ ,(select-firmware "^iwlwifi-")))))))
+ (home-page "https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi")
+ (synopsis "Nonfree firmware for Intel wifi chips")
+ (description "The proprietary iwlwifi kernel module is required by many
+modern Intel wifi cards (commonly found in laptops). This blob enables
+support for 5GHz and 802.11ac, among others.")
+ (license
+ (nonfree (string-append
+ "https://git.kernel.org/pub/scm/linux/kernel/git/firmware"
+ "/linux-firmware.git/plain/LICENCE.iwlwifi_firmware")))))
+
+(define-public realtek-firmware
+ (package
+ (inherit linux-firmware)
+ (name "realtek-firmware")
+ (arguments
+ `(#:license-file-regexp "LICENCE.rtlwifi_firmware.txt"
+ ,@(substitute-keyword-arguments (package-arguments linux-firmware)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'select-firmware
+ ,(select-firmware "^(rtlwifi|rtl_nic|rtl_bt)/")))))))
+ (home-page "https://wireless.wiki.kernel.org/en/users/drivers/rtl819x")
+ (synopsis "Nonfree firmware for Realtek ethernet, wifi, and bluetooth chips")
+ (description
+ "Nonfree firmware for Realtek ethernet, wifi, and Bluetooth chips. This
+package contains nonfree firmware for the following chips:
+@itemize
+@item Realtek RTL8188EE firmware (rtlwifi/rtl8188efw.bin)
+@item Realtek RTL8188EU firmware (rtlwifi/rtl8188eufw.bin)
+@item Realtek RTL8192CE/RTL8188CE firmware (rtlwifi/rtl8192cfw.bin)
+@item Realtek RTL8192CE/RTL8188CE B-cut firmware (rtlwifi/rtl8192cfwU_B.bin)
+@item Realtek RTL8188CE A-cut firmware, version 4.816.2011 (rtlwifi/rtl8192cfwU.bin)
+@item Realtek RTL8192CU/RTL8188CU UMC A-cut firmware (rtlwifi/rtl8192cufw_A.bin)
+@item Realtek RTL8192CU/RTL8188CU UMC B-cut firmware (rtlwifi/rtl8192cufw_B.bin)
+@item Realtek RTL8192CU/RTL8188CU TMSC firmware (rtlwifi/rtl8192cufw_TMSC.bin)
+@item Realtek RTL8192CU/RTL8188CU fallback firmware (rtlwifi/rtl8192cufw.bin)
+@item Realtek RTL8192DE firmware (rtlwifi/rtl8192defw.bin)
+@item Realtek RTL8192EE wifi firmware (rtlwifi/rtl8192eefw.bin)
+@item Realtek RTL8192EU non-WoWLAN firmware (rtlwifi/rtl8192eu_nic.bin)
+@item Realtek RTL8192EU WoWLAN firmware (rtlwifi/rtl8192eu_wowlan.bin)
+@item Realtek RTL8192SE/RTL8191SE firmware, version 4.816.2011 (rtlwifi/rtl8192sefw.bin)
+@item Realtek RTL8192SU/RTL8712U firmware (rtlwifi/rtl8712u.bin)
+@item Realtek RTL8723AU rev A wifi-with-BT firmware (rtlwifi/rtl8723aufw_A.bin)
+@item Realtek RTL8723AU rev B wifi-with-BT firmware (rtlwifi/rtl8723aufw_B.bin)
+@item Realtek RTL8723AU rev B wifi-only firmware (rtlwifi/rtl8723aufw_B_NoBT.bin)
+@item Realtek RTL8723BE firmware, version 36 (rtlwifi/rtl8723befw_36.bin)
+@item Realtek RTL8723BE firmware (rtlwifi/rtl8723befw.bin)
+@item Realtek RTL8723BS BT firmware (rtlwifi/rtl8723bs_bt.bin)
+@item Realtek RTL8723BS wifi non-WoWLAN firmware (rtlwifi/rtl8723bs_nic.bin)
+@item Realtek RTL8723BS wifi WoWLAN firmware (rtlwifi/rtl8723bs_wowlan.bin)
+@item Realtek RTL8723BU non-WoWLAN firmware (rtlwifi/rtl8723bu_nic.bin)
+@item Realtek RTL8723BU WoWLAN firmware (rtlwifi/rtl8723bu_wowlan.bin)
+@item Realtek RTL8723DE firmware (rtlwifi/rtl8723defw.bin)
+@item Realtek RTL8723AE rev B firmware (rtlwifi/rtl8723fw_B.bin)
+@item Realtek RTL8723AE rev A firmware (rtlwifi/rtl8723fw.bin)
+@item Realtek RTL8821AE firmware, version 29 (rtlwifi/rtl8821aefw_29.bin)
+@item Realtek RTL8821AE firmware (rtlwifi/rtl8821aefw_wowlan.bin)
+@item Realtek RTL8821AE firmware (rtlwifi/rtl8821aefw.bin)
+@item Realtek RTL8822BE firmware (rtlwifi/rtl8822befw.bin)
+@item Realtek RTL8105E-1 firmware (rtl_nic/rtl8105e-1.fw)
+@item Realtek RTL8106E-1 firmware, version 0.0.1 (rtl_nic/rtl8106e-1.fw)
+@item Realtek RTL8106E-2 firmware, version 0.0.1 (rtl_nic/rtl8106e-2.fw)
+@item Realtek RTL8107E-1 firmware, version 0.0.2 (rtl_nic/rtl8107e-1.fw)
+@item Realtek RTL8107E-2 firmware, version 0.0.2 (rtl_nic/rtl8107e-2.fw)
+@item Realtek RTL8111D-1/RTL8168D-1 firmware (rtl_nic/rtl8168d-1.fw)
+@item Realtek RTL8111D-2/RTL8168D-2 firmware (rtl_nic/rtl8168d-2.fw)
+@item Realtek RTL8168E-1 firmware (rtl_nic/rtl8168e-1.fw)
+@item Realtek RTL8168E-2 firmware (rtl_nic/rtl8168e-2.fw)
+@item Realtek RTL8168E-3 firmware, version 0.0.4 (rtl_nic/rtl8168e-3.fw)
+@item Realtek RTL8168F-1 firmware, version 0.0.5 (rtl_nic/rtl8168f-1.fw)
+@item Realtek RTL8168F-2 firmware, version 0.0.4 (rtl_nic/rtl8168f-2.fw)
+@item Realtek RTL8168G-1 firmware, version 0.0.3 (rtl_nic/rtl8168g-1.fw)
+@item Realtek RTL8168G-2 firmware, version 0.0.1 (rtl_nic/rtl8168g-2.fw)
+@item Realtek RTL8168G-3 firmware, version 0.0.1 (rtl_nic/rtl8168g-3.fw)
+@item Realtek RTL8168H-1 firmware, version 0.0.2 (rtl_nic/rtl8168h-1.fw)
+@item Realtek RTL8168H-2 firmware, version 0.0.2 (rtl_nic/rtl8168h-2.fw)
+@item Realtek RTL8402-1 firmware, version 0.0.1 (rtl_nic/rtl8402-1.fw)
+@item Realtek RTL8411-1 firmware, version 0.0.3 (rtl_nic/rtl8411-1.fw)
+@item Realtek RTL8411-2 firmware, version 0.0.1 (rtl_nic/rtl8411-2.fw)
+@item Realtek RTL8192EE Bluetooth firmware (rtl_bt/rtl8192ee_fw.bin)
+@item Realtek RTL8812AE Bluetooth firmware (rtl_bt/rtl8812ae_fw.bin)
+@item Realtek RTL8761A Bluetooth firmware (rtl_bt/rtl8761a_fw.bin)
+@item Realtek RTL8821A Bluetooth firmware (rtl_bt/rtl8821a_fw.bin)
+@item Realtek RTL8192EU Bluetooth firmware (rtl_bt/rtl8192eu_fw.bin)
+@item Realtek RTL8723AU rev A Bluetooth firmware (rtl_bt/rtl8723a_fw.bin)
+@item Realtek RTL8723BU rev B Bluetooth firmware (rtl_bt/rtl8723b_fw.bin)
+@item Realtek RTL8723D Bluetooth config (rtl_bt/rtl8723d_config.bin)
+@item Realtek RTL8723D Bluetooth firmware (rtl_bt/rtl8723d_fw.bin)
+@item Realtek RTL8821C Bluetooth config (rtl_bt/rtl8821c_config.bin)
+@item Realtek RTL8821C Bluetooth firmware (rtl_bt/rtl8821c_fw.bin)
+@item Realtek RTL8822B Bluetooth config (rtl_bt/rtl8822b_config.bin)
+@item Realtek RTL8822B Bluetooth firmware (rtl_bt/rtl8822b_fw.bin)
+@item Realtek RTL8822CU Bluetooth firmware (rtl_bt/rtl8822cu_fw.bin)
+@end itemize")
+ (license
+ (nonfree
+ (string-append
+ "https://git.kernel.org/pub/scm/linux/kernel/git/firmware"
+ "/linux-firmware.git/plain/LICENCE.rtlwifi_firmware.txt")))))
+
+(define-public rtlwifi-firmware
+ (deprecated-package "rtlwifi-firmware" realtek-firmware))
+
+(define-public rtl-nic-firmware
+ (deprecated-package "rtl-nic-firmware" realtek-firmware))
+
+(define-public rtl-bt-firmware
+ (deprecated-package "rtl-bt-firmware" realtek-firmware))
+
+(define-public rtl8192eu-linux-module
+ (let ((commit "cdf1b06b7bff49042f42d0294610d3f3780ee62b")
+ (revision "1"))
+ (package
+ (name "rtl8192eu-linux-module")
+ (version (git-version "0.0.0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/clnhub/rtl8192eu-linux")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1afscxmjmapvm8hcd0blp1fn5lxg92rhpiqkgj89x53shfsp12d6"))))
+ (build-system linux-module-build-system)
+ (arguments
+ `(#:make-flags
+ (list "CC=gcc"
+ (string-append "KSRC="
+ (assoc-ref %build-inputs "linux-module-builder")
+ "/lib/modules/build"))
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'build
+ (lambda* (#:key (make-flags '()) #:allow-other-keys)
+ (apply invoke "make" make-flags))))
+ #:tests? #f)) ; no test suite
+ (home-page "https://github.com/clnhub/rtl8192eu-linux")
+ (synopsis "Linux driver for Realtek RTL8192EU wireless network adapters")
+ (description "This is Realtek's RTL8192EU Linux driver for wireless
+network adapters.")
+ (license gpl2))))
+
+(define broadcom-sta-version "6.30.223.271")
+
+(define broadcom-sta-x86_64-source
+ (origin
+ (method url-fetch/tarbomb)
+ (uri (string-append "https://docs.broadcom.com/docs-and-downloads/"
+ "docs/linux_sta/hybrid-v35_64-nodebug-pcoem-"
+ (string-replace-substring broadcom-sta-version "." "_")
+ ".tar.gz"))
+ (patches
+ (parameterize
+ ((%patch-path
+ (map (lambda (directory)
+ (string-append directory "/nongnu/packages/patches"))
+ %load-path)))
+ ;; https://github.com/NixOS/nixpkgs/tree/master/pkgs/os-specific/linux/broadcom-sta
+ ;; https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/broadcom-wl-dkms
+ (search-patches "broadcom-sta-gcc.patch"
+ "broadcom-sta-license.patch"
+ "broadcom-sta-null-pointer-fix.patch"
+ "broadcom-sta-rdtscl.patch"
+ "broadcom-sta-linux-4.7.patch"
+ "broadcom-sta-linux-4.8.patch"
+ "broadcom-sta-debian-fix-kernel-warnings.patch"
+ "broadcom-sta-linux-4.11.patch"
+ "broadcom-sta-linux-4.12.patch"
+ "broadcom-sta-linux-4.15.patch"
+ "broadcom-sta-fix_mac_profile_discrepancy.patch"
+ "broadcom-sta-linux-5.1.patch"
+ ;; source: https://github.com/NixOS/nixpkgs/commit/8ce65087c333097ab714d23800b69fc471ec48ca
+ "broadcom-sta-linux-5.6.patch"
+ "broadcom-sta-linux-5.9.patch"
+ "broadcom-sta-linux-5.10.patch")))
+ (sha256
+ (base32
+ "1gj485qqr190idilacpxwgqyw21il03zph2rddizgj7fbd6pfyaz"))))
+
+(define broadcom-sta-i686-source
+ (origin
+ (inherit broadcom-sta-x86_64-source)
+ (uri (string-append "https://docs.broadcom.com/docs-and-downloads/"
+ "docs/linux_sta/hybrid-v35-nodebug-pcoem-"
+ (string-replace-substring broadcom-sta-version "." "_")
+ ".tar.gz"))
+ (sha256
+ (base32
+ "1kaqa2dw3nb8k23ffvx46g8jj3wdhz8xa6jp1v3wb35cjfr712sg"))))
+
+(define-public broadcom-sta
+ (package
+ (name "broadcom-sta")
+ (version broadcom-sta-version)
+ (source #f)
+ (build-system linux-module-build-system)
+ (arguments
+ `(#:linux ,linux
+ #:tests? #f
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'unpack
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((source (assoc-ref inputs "broadcom-sta-source")))
+ (invoke "tar" "xf" source)
+ (chdir ((@@ (guix build gnu-build-system) first-subdirectory) "."))
+ #t))))))
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (native-inputs
+ `(("broadcom-sta-source"
+ ,(match (or (%current-target-system) (%current-system))
+ ("x86_64-linux" broadcom-sta-x86_64-source)
+ (_ broadcom-sta-i686-source)))))
+ (home-page "https://www.broadcom.com/support/802.11")
+ (synopsis "Broadcom 802.11 Linux STA wireless driver")
+ (description "This package contains Broadcom's IEEE 802.11a/b/g/n/ac hybrid
+Linux device driver for the following chipsets:
+@itemize
+@item BCM4311
+@item BCM4312
+@item BCM4313
+@item BCM4321
+@item BCM4322
+@item BCM43224
+@item BCM43225
+@item BCM43227
+@item BCM43228
+@item BCM43142
+@item BCM4331
+@item BCM4352
+@item BCM4360
+@end itemize
+
+It is recommended that anyone who uses this package stays with Linux LTS
+releases.")
+ (license (nonfree "https://www.broadcom.com/support/802.11"))))
+
+(define-public broadcom-bt-firmware
+ (package
+ (name "broadcom-bt-firmware")
+ (version "12.0.1.1012")
+ (source
+ (origin
+ (method url-fetch)
+ (uri
+ (string-append
+ "http://download.windowsupdate.com/c/msdownload/update/driver/drvs/2017/04/"
+ "852bb503-de7b-4810-a7dd-cbab62742f09_7cf83a4c194116648d17707ae37d564f9c70bec2"
+ ".cab"))
+ (file-name (string-append name "-" version ".cab"))
+ (sha256
+ (base32
+ "1b1qjwxjk4y91l3iz157kms8601n0mmiik32cs6w9b1q4sl4pxx9"))))
+ (build-system trivial-build-system)
+ (arguments
+ `(#:modules ((guix build utils)
+ (ice-9 rdelim)
+ (ice-9 regex))
+ #:builder
+ (begin
+ (use-modules (guix build utils)
+ (ice-9 rdelim)
+ (ice-9 regex))
+ (let ((PATH (string-append (assoc-ref %build-inputs "cabextract") "/bin:"
+ (assoc-ref %build-inputs "bluez") "/bin"))
+ (source (assoc-ref %build-inputs "source"))
+ (firmware-dir (string-append %output "/lib/firmware/brcm/")))
+ (setenv "PATH" PATH)
+ (system* "cabextract" source)
+ (mkdir-p firmware-dir)
+ ;; process the inf file to get the correct filenames
+ (with-input-from-file "bcbtums.inf"
+ (lambda ()
+ (do ((line (read-line) (read-line))
+ (devices '()))
+ ((eof-object? line) #t)
+ ;; these two `lets' are like awk patterns matching against
+ ;; records. link devices in this file with its vids and pids
+ (let ((rcrd (string-match "%.*%=(.*),.*VID_(....).*PID_(....)"
+ line)))
+ (when rcrd
+ (set! devices
+ (assoc-set! devices (match:substring rcrd 1)
+ `((vid . ,(match:substring rcrd 2))
+ (pid . ,(match:substring rcrd 3)))))))
+ ;; find the hex file associated with each device, build the
+ ;; output file name
+ (let ((rcrd (string-match "\\[(RAMUSB.*)\\.CopyList\\]" line)))
+ (when rcrd
+ (let* ((key (match:substring rcrd 1))
+ (hex-file (begin (do ((line (read-line) (read-line)))
+ ((string-match "^([0-9A-Z_.]+\\.hex)" line)
+ (string-drop-right line 1)))))
+ (chipset (car (string-tokenize
+ hex-file
+ char-set:letter+digit)))
+ (vid (assoc-ref (assoc-ref devices key) 'vid))
+ (pid (assoc-ref (assoc-ref devices key) 'pid))
+ (hcd-file (string-append chipset "-"
+ (string-downcase vid) "-"
+ (string-downcase pid)
+ ".hcd")))
+ ;; finally convert the file, phew!
+ (system* "hex2hcd"
+ "-o" (string-append firmware-dir hcd-file)
+ hex-file)))))))))))
+ (native-inputs
+ `(("bluez" ,bluez)
+ ("cabextract" ,cabextract)))
+ (home-page "http://www.broadcom.com/support/bluetooth")
+ (synopsis "Broadcom bluetooth firmware")
+ (description
+ "This package contains nonfree firmware for the following bluetooth
+chipsets from Broadcom:
+@itemize
+@item BCM4335C0
+@item BCM4350C5
+@item BCM4356A2
+@item BCM4371C2
+@item BCM20702A1
+@item BCM20702B0
+@item BCM20703A1
+@item BCM43142A0
+@end itemize")
+ (license
+ (undistributable
+ (string-append
+ "https://raw.githubusercontent.com/winterheart/broadcom-bt-firmware"
+ "/b60fa04881bf8f9b9d578f57d1dfa596cae2a82e"
+ "/LICENSE.broadcom_bcm20702")))))
+
+(define-public intel-microcode
+ (package
+ (name "intel-microcode")
+ (version "20210608")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url (string-append
+ "https://github.com/intel/"
+ "Intel-Linux-Processor-Microcode-Data-Files.git"))
+ (commit (string-append "microcode-" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "08nk353z2lcqsjbm2qdsfapfgrvlfw0rj7r9scr9pllzkjj5n9x3"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan
+ (let ((doc (string-append "share/doc/" ,name "-" ,version "/")))
+ `(("intel-ucode" "lib/firmware/")
+ ("README.md" ,doc)
+ ("releasenote.md" ,doc)
+ ("security.md" ,doc)))))
+ (home-page
+ "https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files")
+ (synopsis "Processor microcode firmware for Intel CPUs")
+ (description "Updated system processor microcode for Intel i686 and Intel
+x86-64 processors. Intel releases microcode updates to correct processor
+behavior as documented in the respective processor specification updates. The
+@code{iucode-tool} package can be used to determine the appropriate file for
+your CPU.")
+ (license (nonfree "file://license"))))
+
+(define-public amd-microcode
+ (package
+ (inherit linux-firmware)
+ (name "amd-microcode")
+ (arguments
+ `(#:license-file-regexp "LICENSE.amd-ucode"
+ ,@(substitute-keyword-arguments (package-arguments linux-firmware)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'select-firmware
+ ,(select-firmware "^amd-ucode/")))))))
+ (synopsis "Processor microcode firmware for AMD CPUs")
+ (description "Updated system processor microcode for AMD x86-64
+processors. AMD releases microcode updates to correct processor behavior as
+documented in the respective processor revision guides.")
+ (license
+ (nonfree
+ (string-append "https://git.kernel.org/pub/scm/linux/kernel/git/"
+ "firmware/linux-firmware.git/plain/LICENSE.amd-ucode")))))
+
+(define-public sof-firmware
+ (package
+ (name "sof-firmware")
+ (version "1.6.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/thesofproject/sof-bin")
+ (commit (string-append "stable-v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1zg5fki8skmmx84p4ws8x2m13bm13fb3kvlhz7zsnmdg6ra06az6"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan
+ (let* ((base
+ (string-append "lib/firmware/intel/sof/v" ,version))
+ (dest "lib/firmware/intel/sof")
+ (tplg
+ (string-append "lib/firmware/intel/sof-tplg-v" ,version))
+ (dest-tplg "lib/firmware/intel/sof-tplg")
+ (fw-file (lambda* (file #:optional subdir)
+ (list (string-append base "/"
+ (or subdir "")
+ file "-v" ,version ".ri")
+ (string-append dest "/" file ".ri"))))
+ (unsigned fw-file)
+ (intel-signed (lambda (file)
+ (fw-file file "intel-signed/"))))
+ (list (unsigned "sof-bdw")
+ (unsigned "sof-byt")
+ (unsigned "sof-cht")
+ (intel-signed "sof-apl")
+ (intel-signed "sof-cnl")
+ (intel-signed "sof-ehl")
+ (intel-signed "sof-icl")
+ (intel-signed "sof-tgl")
+ (list tplg dest-tplg)))))
+ (home-page "https://www.sofproject.org")
+ (synopsis "Sound Open Firmware")
+ (description "This package contains Linux firmwares and topology files for
+audio DSPs that can be found on the Intel Skylake architecture. Those
+firmware can be built for source but need to be signed by Intel in order to be
+loaded by Linux.")
+ (license bsd-3)))
diff --git a/guix/nongnu/packages/mozilla.scm b/guix/nongnu/packages/mozilla.scm
new file mode 100644
index 0000000..6d090f1
--- /dev/null
+++ b/guix/nongnu/packages/mozilla.scm
@@ -0,0 +1,448 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
+;;; Copyright © 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
+;;; Copyright © 2017, 2018 Nikita <nikita@n0.is>
+;;; Copyright (C) 2017, 2018 ng0 <gillmann@infotropique.org>
+;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018, 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
+;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
+;;; Copyright © 2019, 2020 Adrian Malacoda <malacoda@monarch-pass.net>
+;;; Copyright (C) 2019, 2020 Adrian Malacoda <malacoda@monarch-pass.net>
+;;; Copyright © 2020, 2021 Jonathan Brielmaier <jonathan.brielmaier@web.de>
+;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
+;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
+;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;;
+;;; This file is not 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 (nongnu packages mozilla)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system cargo)
+ #:use-module (guix build-system trivial)
+ #:use-module (guix download)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix packages)
+ #:use-module (guix utils)
+
+ #:use-module (gnu packages)
+ #:use-module (gnu packages assembly)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages bash)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages crates-io)
+ #:use-module (gnu packages cups)
+ #:use-module (gnu packages fontutils)
+ #:use-module (gnu packages gl)
+ #:use-module (gnu packages glib)
+ #:use-module (gnu packages gnome)
+ #:use-module (gnu packages gtk)
+ #:use-module (gnu packages icu4c)
+ #:use-module (gnu packages image)
+ #:use-module (gnu packages jemalloc)
+ #:use-module (gnu packages kerberos)
+ #:use-module (gnu packages libcanberra)
+ #:use-module (gnu packages libevent)
+ #:use-module (gnu packages libffi)
+ #:use-module (gnu packages libreoffice) ;for hunspell
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages llvm)
+ #:use-module (gnu packages m4)
+ #:use-module (gnu packages node)
+ #:use-module (gnu packages nss)
+ #:use-module (gnu packages perl)
+ #:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages pulseaudio)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages rust)
+ #:use-module (gnu packages rust-apps)
+ #:use-module (gnu packages sqlite)
+ #:use-module (gnu packages video)
+ #:use-module (gnu packages xdisorg)
+ #:use-module (gnu packages xorg))
+
+;; Update this id with every firefox update to it's release date.
+;; It's used for cache validation and therefor can lead to strange bugs.
+(define %firefox-build-id "20211017000000")
+
+(define-public firefox
+ (package
+ (name "firefox")
+ (version "93.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://archive.mozilla.org/pub/firefox/releases/"
+ version "/source/firefox-" version ".source.tar.xz"))
+ (sha256
+ (base32 "00kiz6hnwmz659cqndpalxhyj4jajd03b7r9hi5jig29b07hi3x7"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:configure-flags
+ (let ((clang (assoc-ref %build-inputs "clang")))
+ `("--enable-application=browser"
+
+ ;; Configuration
+ "--with-system-jpeg"
+ "--with-system-zlib"
+ ;; "--with-system-png" ;require libpng-apng >= 1.6.35
+ "--with-system-icu"
+ "--enable-system-ffi"
+ "--enable-system-pixman"
+ "--enable-jemalloc"
+
+ ;; see https://bugs.gnu.org/32833
+ ;; "--with-system-nspr"
+ ;; "--with-system-nss"
+
+ ,(string-append "--with-clang-path="
+ clang "/bin/clang")
+ ,(string-append "--with-libclang-path="
+ clang "/lib")
+
+ ;; Distribution
+ "--with-distribution-id=org.nonguix"
+ "--disable-official-branding"
+
+ ;; Features
+ "--disable-tests"
+ "--disable-updater"
+ "--enable-pulseaudio"
+ "--disable-crashreporter"
+
+ ;; Build details
+ "--disable-debug"
+ "--enable-rust-simd"
+ "--enable-release"
+ "--enable-optimize"
+ "--enable-strip"
+ "--disable-elf-hack"))
+ #:imported-modules ,%cargo-utils-modules
+ #:modules ((ice-9 regex)
+ (ice-9 ftw)
+ (srfi srfi-26)
+ ,@%gnu-build-system-modules)
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'fix-preferences
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((port (open-file "browser/app/profile/firefox.js" "a")))
+ (define (write-setting key value)
+ (format port "~%pref(\"~a\", ~a);~%"
+ key value)
+ (format #t "fix-preferences: setting value of ~a to ~a~%"
+ key value))
+
+ ;; We should allow Firefox sandbox to read the store directory,
+ ;; because Firefox sandbox have access to /usr on FHS distros.
+ (write-setting "security.sandbox.content.read_path_whitelist"
+ (string-append "\"" (%store-directory) "/\""))
+
+ ;; XDG settings should be managed by Guix.
+ (write-setting "browser.shell.checkDefaultBrowser" "false")
+ (close-port port))
+ #t))
+ (add-after 'fix-preferences 'fix-ffmpeg-runtime-linker
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((ffmpeg (assoc-ref inputs "ffmpeg"))
+ (libavcodec (string-append ffmpeg "/lib/libavcodec.so")))
+ ;; Arrange to load libavcodec.so by its absolute file name.
+ (substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
+ (("libavcodec\\.so")
+ libavcodec))
+ #t)))
+
+ (add-after 'patch-source-shebangs 'patch-cargo-checksums
+ (lambda _
+ (use-modules (guix build cargo-utils))
+ (let ((null-hash
+ ;; This is the SHA256 output of an empty string.
+ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
+ (for-each
+ (lambda (file)
+ (format #t "patch-cargo-checksums: patching checksums in ~a~%"
+ file)
+ (substitute* file
+ (("(checksum = )\".*\"" all name)
+ (string-append name "\"" null-hash "\""))))
+ (find-files "." "Cargo\\.lock$"))
+ (for-each generate-all-checksums
+ '("build"
+ "dom/media"
+ "dom/webauthn"
+ "gfx"
+ "intl"
+ "js"
+ "media"
+ "modules"
+ "mozglue/static/rust"
+ "netwerk"
+ "remote"
+ "security/manager/ssl"
+ "servo"
+ "storage"
+ "third_party/rust"
+ "toolkit"
+ "xpcom/rust"
+ "services"))
+ #t)))
+ (add-after 'patch-cargo-checksums 'remove-cargo-frozen-flag
+ (lambda _
+ ;; Remove --frozen flag from cargo invokation, otherwise it'll
+ ;; complain that it's not able to change Cargo.lock.
+ ;; https://bugzilla.mozilla.org/show_bug.cgi?id=1726373
+ (substitute* "build/RunCbindgen.py"
+ (("\"--frozen\",") ""))
+ #t))
+ (delete 'bootstrap)
+ (replace 'configure
+ (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
+ (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
+ "/bin/autoconf"))
+ (setenv "SHELL" (which "bash"))
+ (setenv "CONFIG_SHELL" (which "bash"))
+ (setenv "MACH_USE_SYSTEM_PYTHON" "1")
+
+ ;; Use Clang, Clang is 2x faster than GCC
+ (setenv "AR" "llvm-ar")
+ (setenv "NM" "llvm-nm")
+ (setenv "CC" "clang")
+ (setenv "CXX" "clang++")
+
+ (setenv "MOZ_NOSPAM" "1")
+ ;; Firefox will write the timestamp to output, which is harmful for
+ ;; reproducibility, so change it to a fixed date.
+ (setenv "MOZ_BUILD_DATE" ,%firefox-build-id)
+
+ (setenv "MOZBUILD_STATE_PATH" (getcwd))
+
+ (let* ((mozconfig (string-append (getcwd) "/mozconfig"))
+ (out (assoc-ref outputs "out"))
+ (flags (cons (string-append "--prefix=" out)
+ configure-flags)))
+ (format #t "build directory: ~s~%" (getcwd))
+ (format #t "configure flags: ~s~%" flags)
+
+ (define write-flags
+ (lambda flags
+ (display (string-join
+ (map (cut string-append "ac_add_options " <>)
+ flags)
+ "\n"))
+ (display "\n")))
+ (with-output-to-file mozconfig
+ (lambda ()
+ (apply write-flags flags)
+ ;; The following option unsets Telemetry Reporting. With the Addons Fiasco,
+ ;; Mozilla was found to be collecting user's data, including saved passwords and
+ ;; web form data, without users consent. Mozilla was also found shipping updates
+ ;; to systems without the user's knowledge or permission.
+ ;; As a result of this, use the following command to permanently disable
+ ;; telemetry reporting in Firefox.
+ (display "unset MOZ_TELEMETRY_REPORTING\n")))
+ (setenv "MOZCONFIG" mozconfig))
+ (invoke "./mach" "configure")))
+ (replace 'build
+ (lambda* (#:key (make-flags '()) (parallel-build? #t)
+ #:allow-other-keys)
+ (apply invoke "./mach" "build"
+ ;; mach will use parallel build if possible by default
+ `(,@(if parallel-build?
+ '()
+ '("-j1"))
+ ,@make-flags))))
+ (add-after 'build 'neutralise-store-references
+ (lambda _
+ ;; Mangle the store references to compilers & other build tools in
+ ;; about:buildconfig, reducing Firefox's closure by 1 GiB on x86-64.
+ (let* ((build-dir (car (scandir "." (cut string-prefix? "obj-" <>))))
+ (file (string-append build-dir "/dist/bin/chrome/toolkit/content/global/buildconfig.html")))
+ (substitute* file
+ (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
+ (regexp-quote (%store-directory)))
+ _ store hash)
+ (string-append store
+ (string-take hash 8)
+ "<!-- Guix: not a runtime dependency -->"
+ (string-drop hash 8)))))
+ #t))
+ (replace 'install
+ (lambda _ (invoke "./mach" "install")))
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (lib (string-append out "/lib"))
+ (ld-libs
+ (map (lambda (x)
+ (string-append (assoc-ref inputs x)
+ "/lib"))
+ '("pulseaudio" "mesa"
+ "udev" ;; For U2F and WebAuthn
+ ;; For hardware video acceleration via VA-API
+ "libva"
+ ;; For the integration of native notifications
+ "libnotify")))
+ (gtk-share (string-append (assoc-ref inputs "gtk+")
+ "/share")))
+ (wrap-program (car (find-files lib "^firefox$"))
+ `("LD_LIBRARY_PATH" prefix ,ld-libs)
+ `("XDG_DATA_DIRS" prefix (,gtk-share))
+ `("MOZ_LEGACY_PROFILES" = ("1"))
+ `("MOZ_ALLOW_DOWNGRADE" = ("1")))
+ #t)))
+ (add-after 'wrap-program 'install-desktop-entry
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((desktop-file "taskcluster/docker/firefox-snap/firefox.desktop")
+ (out (assoc-ref outputs "out"))
+ (applications (string-append out "/share/applications")))
+ (substitute* desktop-file
+ (("^Exec=firefox") (string-append "Exec=" out "/bin/firefox"))
+ (("Icon=.*") "Icon=firefox\n")
+ (("NewWindow") "new-window")
+ (("NewPrivateWindow") "new-private-window"))
+ (install-file desktop-file applications))
+ #t))
+ (add-after 'install-desktop-entry 'install-icons
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (icon-source-dir
+ (string-append
+ out "/lib/firefox/browser/chrome/icons/default")))
+ (for-each
+ (lambda (size)
+ (let ((dest (string-append out "/share/icons/hicolor/"
+ size "x" size "/apps")))
+ (mkdir-p dest)
+ (symlink (string-append icon-source-dir
+ "/default" size ".png")
+ (string-append dest "/firefox.png"))))
+ '("16" "32" "48" "64" "128"))
+ #t))))
+
+ ;; Test will significantly increase build time but with little rewards.
+ #:tests? #f
+
+ ;; WARNING: Parallel build will consume lots of memory!
+ ;; If you have encountered OOM issue in build phase, try disable it.
+ ;; #:parallel-build? #f
+
+ ;; Some dynamic lib was determined at runtime, so rpath check may fail.
+ #:validate-runpath? #f))
+ (inputs
+ `(("bzip2" ,bzip2)
+ ("cairo" ,cairo)
+ ("cups" ,cups)
+ ("dbus-glib" ,dbus-glib)
+ ("freetype" ,freetype)
+ ("ffmpeg" ,ffmpeg)
+ ("gdk-pixbuf" ,gdk-pixbuf)
+ ("glib" ,glib)
+ ("gtk+" ,gtk+)
+ ("gtk+-2" ,gtk+-2)
+ ("hunspell" ,hunspell)
+ ("icu4c" ,icu4c-69)
+ ("jemalloc" ,jemalloc)
+ ("libcanberra" ,libcanberra)
+ ("libevent" ,libevent)
+ ("libffi" ,libffi)
+ ("libgnome" ,libgnome)
+ ("libjpeg-turbo" ,libjpeg-turbo)
+ ("libnotify" ,libnotify)
+ ;; ("libpng-apng" ,libpng-apng)
+ ("libva" ,libva)
+ ("libvpx" ,libvpx)
+ ("libxcomposite" ,libxcomposite)
+ ("libxft" ,libxft)
+ ("libxinerama" ,libxinerama)
+ ("libxscrnsaver" ,libxscrnsaver)
+ ("libxt" ,libxt)
+ ("mesa" ,mesa)
+ ("mit-krb5" ,mit-krb5)
+ ;; ("nspr" ,nspr)
+ ;; ("nss" ,nss)
+ ("pango" ,pango)
+ ("pixman" ,pixman)
+ ("pulseaudio" ,pulseaudio)
+ ("startup-notification" ,startup-notification)
+ ("sqlite" ,sqlite)
+ ("udev" ,eudev)
+ ("unzip" ,unzip)
+ ("zip" ,zip)
+ ("zlib" ,zlib)))
+ (native-inputs
+ `(("autoconf" ,autoconf-2.13)
+ ("cargo" ,rust-1.51 "cargo")
+ ("clang" ,clang-10)
+ ("llvm" ,llvm-10)
+ ("m4" ,m4)
+ ("nasm" ,nasm)
+ ("node" ,node)
+ ("perl" ,perl)
+ ("pkg-config" ,pkg-config)
+ ("python" ,python)
+ ("rust" ,rust-1.51)
+ ("rust-cbindgen" ,rust-cbindgen-0.19)
+ ("which" ,which)
+ ("yasm" ,yasm)))
+ (home-page "https://mozilla.org/firefox/")
+ (synopsis "Trademarkless version of Firefox")
+ (description
+ "Full-featured browser client built from Firefox source tree, without
+the official icon and the name \"firefox\".")
+ (license license:mpl2.0)))
+
+ (define-public firefox/wayland
+ (package
+ (inherit firefox)
+ (name "firefox-wayland")
+ (native-inputs '())
+ (inputs
+ `(("bash" ,bash-minimal)
+ ("firefox" ,firefox)))
+ (build-system trivial-build-system)
+ (arguments
+ '(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let* ((bash (assoc-ref %build-inputs "bash"))
+ (firefox (assoc-ref %build-inputs "firefox"))
+ (out (assoc-ref %outputs "out"))
+ (exe (string-append out "/bin/firefox")))
+ (mkdir-p (dirname exe))
+
+ (call-with-output-file exe
+ (lambda (port)
+ (format port "#!~a
+MOZ_ENABLE_WAYLAND=1 exec ~a $@\n"
+ (string-append bash "/bin/bash")
+ (string-append firefox "/bin/firefox"))))
+ (chmod exe #o555)
+
+ ;; Provide the manual and .desktop file.
+ (copy-recursively (string-append firefox "/share")
+ (string-append out "/share"))
+ (substitute* (string-append
+ out "/share/applications/firefox.desktop")
+ ((firefox) out))
+ #t))))))
diff --git a/guix/nongnu/packages/nvidia.scm b/guix/nongnu/packages/nvidia.scm
new file mode 100644
index 0000000..a154f28
--- /dev/null
+++ b/guix/nongnu/packages/nvidia.scm
@@ -0,0 +1,435 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Hebi Li <hebi@lihebi.com>
+;;; Copyright © 2020 Malte Frank Gerdes <malte.f.gerdes@gmail.com>
+;;; Copyright © 2020, 2021 Jean-Baptiste Volatier <jbv@pm.me>
+;;; Copyright © 2020, 2021 Jonathan Brielmaier <jonathan.brielmaier@web.de>
+;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;;
+;;; This file is not part of GNU Guix.
+;;;
+;;; This program 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.
+;;;
+;;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (nongnu packages nvidia)
+ #:use-module (guix packages)
+ #:use-module (guix download)
+ #:use-module (guix utils)
+ #:use-module ((nonguix licenses) #:prefix license:)
+ #:use-module (guix build-system linux-module)
+ #:use-module (guix build-system copy)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system trivial)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages bash)
+ #:use-module (gnu packages bootstrap)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages elf)
+ #:use-module (gnu packages freedesktop)
+ #:use-module (gnu packages gcc)
+ #:use-module (gnu packages gl)
+ #:use-module (gnu packages glib)
+ #:use-module (gnu packages gtk)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages perl)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages xorg)
+ #:use-module (nongnu packages linux)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 format)
+ #:use-module (ice-9 textual-ports)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1))
+
+(define-public nvidia-driver
+ (package
+ (name "nvidia-driver")
+ (version "465.27")
+ (source
+ (origin
+ (uri (format #f "http://us.download.nvidia.com/XFree86/Linux-x86_64/~a/~a.run"
+ version
+ (format #f "NVIDIA-Linux-x86_64-~a" version)))
+ (sha256 (base32 "0w9ivi4z4j4hvhkimr11mgwrj09v53dy39vfdfmamrnybflgysby"))
+ (method url-fetch)
+ (file-name (string-append "nvidia-driver-" version "-checkout"))))
+ (build-system linux-module-build-system)
+ (arguments
+ `(#:linux ,linux-lts
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'unpack
+ (lambda* (#:key inputs #:allow-other-keys #:rest r)
+ (let ((source (assoc-ref inputs "source")))
+ (invoke "sh" source "--extract-only")
+ (chdir ,(format #f "NVIDIA-Linux-x86_64-~a" version))
+ #t)))
+ (replace 'build
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ ;; We cannot use with-directory-excursion, because the install
+ ;; phase needs to be in the kernel folder. Otherwise no .ko
+ ;; would be installed.
+ (chdir "kernel")
+ ;; Patch Kbuild
+ (substitute* "Kbuild"
+ (("/bin/sh") (string-append (assoc-ref inputs "bash-minimal") "/bin/sh")))
+ (invoke "make"
+ "-j"
+ (string-append "SYSSRC="
+ (assoc-ref inputs "linux-module-builder")
+ "/lib/modules/build")
+ "CC=gcc")
+ #t))
+ (delete 'check)
+ (delete 'strip)
+ (add-after 'install 'install-copy
+ (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
+ (chdir "..")
+ (use-modules (ice-9 ftw)
+ (ice-9 regex)
+ (ice-9 textual-ports))
+ (let* ((out (assoc-ref outputs "out"))
+ (libdir (string-append out "/lib"))
+ (bindir (string-append out "/bin"))
+ (etcdir (string-append out "/etc")))
+ ;; ------------------------------
+ ;; Copy .so files
+ (for-each
+ (lambda (file)
+ (format #t "Copying '~a'...~%" file)
+ (install-file file libdir))
+ (scandir "." (lambda (name)
+ (string-contains name ".so"))))
+
+ (install-file "nvidia_drv.so" (string-append out "/lib/xorg/modules/drivers/"))
+ (install-file ,(string-append "libglxserver_nvidia.so." version) (string-append out "/lib/xorg/modules/extensions/"))
+
+ ;; ICD Loader for OpenCL
+ (let ((file (string-append etcdir "/OpenCL/vendors/nvidia.icd")))
+ (mkdir-p (string-append etcdir "/OpenCL/vendors/"))
+ (call-with-output-file file
+ (lambda (port)
+ (display (string-append out "/lib/libnvidia-opencl.so.1") port)))
+ (chmod file #o555))
+
+ ;; Add udev rules for nvidia
+ (let ((rulesdir (string-append out "/lib/udev/rules.d/"))
+ (rules (string-append out "/lib/udev/rules.d/90-nvidia.rules"))
+ (sh (string-append (assoc-ref inputs "bash-minimal") "/bin/sh"))
+ (mknod (string-append (assoc-ref inputs "coreutils") "/bin/mknod"))
+ (cut (string-append (assoc-ref inputs "coreutils") "/bin/cut"))
+ (grep (string-append (assoc-ref inputs "grep") "/bin/grep")))
+ (mkdir-p rulesdir)
+ (call-with-output-file rules
+ (lambda (port)
+ (put-string port
+ (string-append
+ "KERNEL==\"nvidia\", "
+ "RUN+=\"" sh " -c '" mknod " -m 666 /dev/nvidiactl c $$(" grep " nvidia-frontend /proc/devices | " cut " -d \\ -f 1) 255'\"" "\n"
+ "KERNEL==\"nvidia_modeset\", "
+ "RUN+=\"" sh " -c '" mknod " -m 666 /dev/nvidia-modeset c $$(" grep " nvidia-frontend /proc/devices | " cut " -d \\ -f 1) 254'\"" "\n"
+ "KERNEL==\"card*\", SUBSYSTEM==\"drm\", DRIVERS==\"nvidia\", "
+ "RUN+=\"" sh " -c '" mknod " -m 666 /dev/nvidia0 c $$(" grep " nvidia-frontend /proc/devices | " cut " -d \\ -f 1) 0'\"" "\n"
+ "KERNEL==\"nvidia_uvm\", "
+ "RUN+=\"" sh " -c '" mknod " -m 666 /dev/nvidia-uvm c $$(" grep " nvidia-uvm /proc/devices | " cut " -d \\ -f 1) 0'\"" "\n"
+ "KERNEL==\"nvidia_uvm\", "
+ "RUN+=\"" sh " -c '" mknod " -m 666 /dev/nvidia-uvm-tools c $$(" grep " nvidia-uvm /proc/devices | " cut " -d \\ -f 1) 0'\"" "\n" )))))
+
+ ;; ------------------------------
+ ;; Add a file to load nvidia drivers
+ (mkdir-p bindir)
+ (let ((file (string-append bindir "/nvidia-insmod"))
+ (out (assoc-ref outputs "out"))
+ (moddir (string-append "/lib/modules/" (utsname:release (uname)) "-gnu/extra")))
+ (call-with-output-file file
+ (lambda (port)
+ (put-string port (string-append "#!" (assoc-ref inputs "bash-minimal") "/bin/sh" "\n"
+ "modprobe ipmi_devintf" "\n"
+ "insmod " out moddir "/nvidia.ko" "\n"
+ "insmod " out moddir "/nvidia-modeset.ko" "\n"
+ "insmod " out moddir "/nvidia-uvm.ko" "\n"
+ "insmod " out moddir "/nvidia-drm.ko" "\n"))))
+ (chmod file #o555))
+ (let ((file (string-append bindir "/nvidia-rmmod")))
+ (call-with-output-file file
+ (lambda (port)
+ (put-string port (string-append "#!" (assoc-ref inputs "bash-minimal") "/bin/sh" "\n"
+ "rmmod " "nvidia-drm" "\n"
+ "rmmod " "nvidia-uvm" "\n"
+ "rmmod " "nvidia-modeset" "\n"
+ "rmmod " "nvidia" "\n"
+ "rmmod " "ipmi_devintf" "\n"))))
+ (chmod file #o555))
+
+ ;; ------------------------------
+ ;; nvidia-smi
+
+ (install-file "nvidia-smi" bindir)
+
+ ;; ------------------------------
+ ;; patchelf
+ (let* ((libc (assoc-ref inputs "libc"))
+ (ld.so (string-append libc ,(glibc-dynamic-linker)))
+
+ (out (assoc-ref outputs "out"))
+ (rpath (string-join
+ (list "$ORIGIN"
+ (string-append out "/lib")
+ (string-append libc "/lib")
+ (string-append (assoc-ref inputs "libx11") "/lib")
+ (string-append (assoc-ref inputs "libxext") "/lib")
+ (string-append (assoc-ref inputs "pango") "/lib")
+ (string-append (assoc-ref inputs "gtk+") "/lib")
+ (string-append (assoc-ref inputs "gtk2") "/lib")
+ (string-append (assoc-ref inputs "atk") "/lib")
+ (string-append (assoc-ref inputs "glib") "/lib")
+ (string-append (assoc-ref inputs "cairo") "/lib")
+ (string-append (assoc-ref inputs "gdk-pixbuf") "/lib")
+ (string-append (assoc-ref inputs "wayland") "/lib")
+ (string-append (assoc-ref inputs "gcc:lib") "/lib"))
+ ":")))
+ (define (patch-elf file)
+ (format #t "Patching ~a ...~%" file)
+ (unless (string-contains file ".so")
+ (invoke "patchelf" "--set-interpreter" ld.so file))
+ (invoke "patchelf" "--set-rpath" rpath file))
+ (for-each (lambda (file)
+ (when (elf-file? file)
+ (patch-elf file)))
+ (find-files out ".*\\.so"))
+ (patch-elf (string-append bindir "/" "nvidia-smi")))
+
+ ;; ------------------------------
+ ;; Create short name symbolic links
+ (for-each (lambda (file)
+ (let* ((short (regexp-substitute
+ #f
+ (string-match "([^/]*\\.so).*" file)
+ 1))
+ (major (if (or (string=? short "libEGL.so")
+ (string=? short "libEGL_nvidia.so")
+ (string=? short "libGLX.so")
+ (string=? short "libGLX_nvidia.so"))
+ "0" "1"))
+ (mid (string-append short "." major))
+ (short-file (string-append libdir "/" short))
+ (mid-file (string-append libdir "/" mid)))
+ ;; FIXME the same name, print out warning at least
+ ;; [X] libEGL.so.1.1.0
+ ;; [ ] libEGL.so.435.21
+ (when (not (file-exists? short-file))
+ (format #t "Linking ~a to ~a ...~%" short file)
+ (symlink (basename file) short-file))
+ (when (not (file-exists? mid-file))
+ (format #t "Linking ~a to ~a ...~%" mid file)
+ (symlink (basename file) mid-file))))
+ (find-files libdir "\\.so\\."))
+ (symlink ,(string-append "libglxserver_nvidia.so." version)
+ (string-append out "/lib/xorg/modules/extensions/" "libglxserver_nvidia.so")))
+ #t)))))
+ (native-inputs
+ `(("patchelf" ,patchelf)
+ ("perl" ,perl)
+ ("python" ,python-2)
+ ("which" ,which)
+ ("xz" ,xz)))
+ (inputs
+ `(("atk" ,atk)
+ ("bash-minimal" ,bash-minimal)
+ ("cairo" ,cairo)
+ ("coreutils" ,coreutils)
+ ("gcc:lib" ,gcc "lib")
+ ("gdk-pixbuf" ,gdk-pixbuf)
+ ("glib" ,glib)
+ ("grep" ,grep)
+ ("gtk+" ,gtk+)
+ ("gtk2" ,gtk+-2)
+ ("kmod" ,kmod)
+ ("libc" ,glibc)
+ ("libx11" ,libx11)
+ ("libxext" ,libxext)
+ ("linux" ,linux-lts)
+ ("pango" ,pango)
+ ("wayland" ,wayland)))
+ (home-page "https://www.nvidia.com")
+ (synopsis "Proprietary Nvidia driver")
+ (description "This is the evil Nvidia driver. Don't forget to add
+nvidia-driver to the udev-rules in your config.scm:
+@code{(simple-service 'custom-udev-rules udev-service-type (list nvidia-driver))}
+Further xorg should be configured by adding:
+@code{(modules (cons* nvidia-driver %default-xorg-modules))
+(drivers '(\"nvidia\"))} to @code{xorg-configuration}.")
+ (license (license:nonfree (format #f "file:///share/doc/nvidia-driver-~a/LICENSE" version)))))
+
+(define-public nvidia-libs
+ (package
+ (name "nvidia-libs")
+ (version "465.27")
+ (source
+ (origin
+ (uri (format #f "http://us.download.nvidia.com/XFree86/Linux-x86_64/~a/~a.run"
+ version
+ (format #f "NVIDIA-Linux-x86_64-~a" version)))
+ (sha256 (base32 "0w9ivi4z4j4hvhkimr11mgwrj09v53dy39vfdfmamrnybflgysby"))
+ (method url-fetch)
+ (file-name (string-append "nvidia-driver-" version "-checkout"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'unpack
+ (lambda* (#:key inputs #:allow-other-keys #:rest r)
+ (let ((source (assoc-ref inputs "source")))
+ (invoke "sh" source "--extract-only")
+ (chdir ,(format #f "NVIDIA-Linux-x86_64-~a" version))
+ #t)))
+ (delete 'build)
+ (delete 'check)
+ (add-after 'install 'patch-symlink
+ (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
+ (use-modules (ice-9 ftw)
+ (ice-9 regex)
+ (ice-9 textual-ports))
+ (let* ((out (assoc-ref outputs "out"))
+ (libdir (string-append out "/lib"))
+ (bindir (string-append out "/bin"))
+ (etcdir (string-append out "/etc")))
+ ;; ------------------------------
+ ;; patchelf
+ (let* ((libc (assoc-ref inputs "libc"))
+ (ld.so (string-append libc ,(glibc-dynamic-linker)))
+
+ (out (assoc-ref outputs "out"))
+ (rpath (string-join
+ (list "$ORIGIN"
+ (string-append out "/lib")
+ (string-append libc "/lib")
+ (string-append (assoc-ref inputs "atk") "/lib")
+ (string-append (assoc-ref inputs "cairo") "/lib")
+ (string-append (assoc-ref inputs "gcc:lib") "/lib")
+ (string-append (assoc-ref inputs "gdk-pixbuf") "/lib")
+ (string-append (assoc-ref inputs "glib") "/lib")
+ (string-append (assoc-ref inputs "gtk+") "/lib")
+ (string-append (assoc-ref inputs "gtk2") "/lib")
+ (string-append (assoc-ref inputs "libx11") "/lib")
+ (string-append (assoc-ref inputs "libxext") "/lib")
+ (string-append (assoc-ref inputs "pango") "/lib")
+ (string-append (assoc-ref inputs "wayland") "/lib"))
+ ":")))
+ (define (patch-elf file)
+ (format #t "Patching ~a ...~%" file)
+ (unless (string-contains file ".so")
+ (invoke "patchelf" "--set-interpreter" ld.so file))
+ (invoke "patchelf" "--set-rpath" rpath file))
+ (for-each (lambda (file)
+ (when (elf-file? file)
+ (patch-elf file)))
+ (find-files out ".*\\.so")))
+
+ ;; ------------------------------
+ ;; Create short name symbolic links
+ (for-each (lambda (file)
+ (let* ((short (regexp-substitute
+ #f
+
+ (string-match "([^/]*\\.so).*" file)
+ 1))
+ (major (if (or (string=? short "libEGL.so")
+ (string=? short "libEGL_nvidia.so")
+ (string=? short "libGLX.so")
+ (string=? short "libGLX_nvidia.so"))
+ "0" "1"))
+ (mid (string-append short "." major))
+ (short-file (string-append libdir "/" short))
+ (mid-file (string-append libdir "/" mid)))
+ ;; FIXME the same name, print out warning at least
+ ;; [X] libEGL.so.1.1.0
+ ;; [ ] libEGL.so.435.21
+ (when (not (file-exists? short-file))
+ (format #t "Linking ~a to ~a ...~%" short file)
+ (symlink (basename file) short-file))
+ (when (not (file-exists? mid-file))
+ (format #t "Linking ~a to ~a ...~%" mid file)
+ (symlink (basename file) mid-file))))
+ (find-files libdir "\\.so\\."))
+ #t))))
+ #:install-plan
+ ,@(match (%current-system)
+ ("x86_64-linux" '(`(("." "lib" #:include-regexp ("^./[^/]+\\.so")))))
+ ("i686-linux" '(`(("32" "lib" #:include-regexp ("^./[^/]+\\.so")))))
+ (_ '()))))
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (native-inputs
+ `(("patchelf" ,patchelf)
+ ("perl" ,perl)
+ ("python" ,python-2)
+ ("which" ,which)
+ ("xz" ,xz)))
+ (inputs
+ `(("atk" ,atk)
+ ("cairo" ,cairo)
+ ("gcc:lib" ,gcc "lib")
+ ("gdk-pixbuf" ,gdk-pixbuf)
+ ("glib" ,glib)
+ ("gtk+" ,gtk+)
+ ("gtk2" ,gtk+-2)
+ ("libc" ,glibc)
+ ("libx11" ,libx11)
+ ("libxext" ,libxext)
+ ("wayland" ,wayland)))
+ (home-page "https://www.nvidia.com")
+ (synopsis "Libraries of the proprietary Nvidia driver")
+ (description "These are the libraries of the evil Nvidia driver compatible
+with the ones usually provided by Mesa. To use these libraries with
+packages that have been compiled with a mesa output, take a look at the nvda
+package.")
+ (license (license:nonfree (format #f "file:///share/doc/nvidia-driver-~a/LICENSE" version)))))
+
+;; nvda is used as a name because it has the same length as mesa which is
+;; required for grafting
+(define-public nvda
+ (package
+ (inherit nvidia-libs)
+ (name "nvda")
+ (source #f)
+ (build-system trivial-build-system)
+ (arguments
+ '(#:modules ((guix build union))
+ #:builder (begin
+ (use-modules (guix build union)
+ (srfi srfi-1)
+ (ice-9 regex))
+ (union-build (assoc-ref %outputs "out")
+ (list (assoc-ref %build-inputs "mesa") (assoc-ref %build-inputs "nvidia-libs"))
+ #:resolve-collision (lambda (files) (let ((file
+ (if (string-match "nvidia-libs" (first files))
+ (first files)
+ (last files))))
+ (format #t "chosen ~a ~%" file)
+ file)))
+ #t)))
+ (description "These are the libraries of the evil Nvidia driver,
+packaged in such a way that you can use the transformation option
+@code{--with-graft=mesa=nvda} to use the nvidia driver with a package that requires mesa.")
+ (inputs
+ `(("nvidia-libs" ,nvidia-libs)
+ ("mesa" ,mesa)))
+ (outputs '("out"))))
+
+(define mesa/fake
+ (package
+ (inherit mesa)
+ (replacement nvda)))
+
+(define-public replace-mesa
+ (package-input-rewriting `((,mesa . ,mesa/fake))))
diff --git a/guix/nongnu/packages/patches/broadcom-sta-debian-fix-kernel-warnings.patch b/guix/nongnu/packages/patches/broadcom-sta-debian-fix-kernel-warnings.patch
new file mode 100644
index 0000000..e9bf66a
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-debian-fix-kernel-warnings.patch
@@ -0,0 +1,161 @@
+--- a/src/wl/sys/wl_cfg80211_hybrid.c
++++ b/src/wl/sys/wl_cfg80211_hybrid.c
+@@ -1968,7 +1968,7 @@
+
+ if (dtoh32(bi->length) > WL_BSS_INFO_MAX) {
+ WL_DBG(("Beacon is larger than buffer. Discarding\n"));
+- return err;
++ return -E2BIG;
+ }
+ notif_bss_info = kzalloc(sizeof(*notif_bss_info) + sizeof(*mgmt) - sizeof(u8) +
+ WL_BSS_INFO_MAX, GFP_KERNEL);
+@@ -1992,9 +1992,15 @@
+ beacon_proberesp->capab_info = cpu_to_le16(bi->capability);
+ wl_rst_ie(wl);
+
+- wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length);
+- wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX -
++ err = wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length);
++ if (err)
++ goto inform_single_bss_out;
++
++ err = wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX -
+ offsetof(struct wl_cfg80211_bss_info, frame_buf));
++ if (err)
++ goto inform_single_bss_out;
++
+ notif_bss_info->frame_len = offsetof(struct ieee80211_mgmt, u.beacon.variable) +
+ wl_get_ielen(wl);
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
+@@ -2006,14 +2012,14 @@
+ #endif
+ if (freq == 0) {
+ WL_ERR(("Invalid channel, fail to chcnage channel to freq\n"));
+- kfree(notif_bss_info);
+- return -EINVAL;
++ err = -EINVAL;
++ goto inform_single_bss_out;
+ }
+ channel = ieee80211_get_channel(wiphy, freq);
+ if (unlikely(!channel)) {
+ WL_ERR(("ieee80211_get_channel error\n"));
+- kfree(notif_bss_info);
+- return -EINVAL;
++ err = -EINVAL;
++ goto inform_single_bss_out;
+ }
+
+ WL_DBG(("SSID : \"%s\", rssi %d, channel %d, capability : 0x04%x, bssid %pM\n",
+@@ -2021,28 +2027,37 @@
+ mgmt->u.beacon.capab_info, &bi->BSSID));
+
+ signal = notif_bss_info->rssi * 100;
+- cbss = cfg80211_inform_bss_frame(wiphy, channel, mgmt,
+- le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL);
+- if (unlikely(!cbss)) {
+- WL_ERR(("cfg80211_inform_bss_frame error\n"));
+- kfree(notif_bss_info);
+- return -EINVAL;
+- }
+
+- notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
+- notify_ielen = le32_to_cpu(bi->ie_length);
++ if (!wl->scan_request) {
++ cbss = cfg80211_inform_bss_frame(wiphy, channel, mgmt,
++ le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL);
++ if (unlikely(!cbss)) {
++ WL_ERR(("cfg80211_inform_bss_frame error\n"));
++ err = -ENOMEM;
++ goto inform_single_bss_out;
++ }
++ } else {
++ notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
++ notify_ielen = le32_to_cpu(bi->ie_length);
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
+- cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet),
+- 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
+- (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
++ cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet),
++ 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
++ (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
+ #else
+- cbss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, (const u8 *)(bi->BSSID.octet),
+- 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
+- (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
++ cbss = cfg80211_inform_bss(wiphy, channel,
++ wl->active_scan ?
++ CFG80211_BSS_FTYPE_PRESP : CFG80211_BSS_FTYPE_BEACON,
++ (const u8 *)(bi->BSSID.octet), 0,
++ beacon_proberesp->capab_info,
++ beacon_proberesp->beacon_int,
++ (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
+ #endif
+-
+- if (unlikely(!cbss))
+- return -ENOMEM;
++ if (unlikely(!cbss)) {
++ WL_ERR(("cfg80211_inform_bss error\n"));
++ err = -ENOMEM;
++ goto inform_single_bss_out;
++ }
++ }
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+ cfg80211_put_bss(wiphy, cbss);
+@@ -2050,6 +2065,7 @@
+ cfg80211_put_bss(cbss);
+ #endif
+
++inform_single_bss_out:
+ kfree(notif_bss_info);
+
+ return err;
+@@ -2316,6 +2332,9 @@
+ if (err)
+ goto update_bss_info_out;
+
++ bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
++ ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
++
+ ie = ((u8 *)bi) + bi->ie_offset;
+ ie_len = bi->ie_length;
+ } else {
+@@ -2328,11 +2347,18 @@
+ ie_len = bss->len_information_elements;
+ #endif
+ wl->conf->channel = *bss->channel;
++ }
++
++ if (bss) {
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+ cfg80211_put_bss(wiphy, bss);
+ #else
+ cfg80211_put_bss(bss);
+ #endif
++ } else {
++ WL_DBG(("Could not update BSS\n"));
++ err = -EINVAL;
++ goto update_bss_info_out;
+ }
+
+ tim = bcm_parse_tlvs(ie, ie_len, WLAN_EID_TIM);
+@@ -2360,10 +2386,17 @@
+ struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl);
+ s32 err = 0;
+
+- wl_get_assoc_ies(wl);
++ err = wl_get_assoc_ies(wl);
++ if (err)
++ return err;
++
+ memcpy(wl->profile->bssid, &e->addr, ETHER_ADDR_LEN);
+ memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
+- wl_update_bss_info(wl);
++
++ err = wl_update_bss_info(wl);
++ if (err)
++ return err;
++
+ cfg80211_roamed(ndev,
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
+ &wl->conf->channel,
diff --git a/guix/nongnu/packages/patches/broadcom-sta-fix_mac_profile_discrepancy.patch b/guix/nongnu/packages/patches/broadcom-sta-fix_mac_profile_discrepancy.patch
new file mode 100644
index 0000000..586bfcc
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-fix_mac_profile_discrepancy.patch
@@ -0,0 +1,16 @@
+https://bugs.archlinux.org/task/61090
+
+--- a/src/wl/sys/wl_cfg80211_hybrid.c 2015-09-19 00:47:30.000000000 +0200
++++ b/src/wl/sys/wl_cfg80211_hybrid.c 2018-11-14 14:06:03.313487995 +0100
+@@ -1444,11 +1444,10 @@
+ s32 rate;
+ s32 err = 0;
+
+ if (memcmp(mac, wl->profile->bssid, ETHER_ADDR_LEN)) {
+ WL_ERR(("Wrong Mac address, mac = %pM profile =%pM\n", mac, wl->profile->bssid));
+- return -ENOENT;
+ }
+
+ err = wl_dev_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate));
+ if (err) {
+ WL_DBG(("Could not get rate (%d)\n", err));
diff --git a/guix/nongnu/packages/patches/broadcom-sta-gcc.patch b/guix/nongnu/packages/patches/broadcom-sta-gcc.patch
new file mode 100644
index 0000000..f93e3f1
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-gcc.patch
@@ -0,0 +1,11 @@
+--- a/Makefile 2014-06-26 10:42:08.000000000 +0000
++++ b/Makefile 2014-07-17 22:44:01.662297228 +0000
+@@ -126,6 +126,8 @@
+ EXTRA_CFLAGS += -I$(src)/src/shared/bcmwifi/include
+ #EXTRA_CFLAGS += -DBCMDBG_ASSERT -DBCMDBG_ERR
+
++EXTRA_CFLAGS += -Wno-date-time
++
+ EXTRA_LDFLAGS := $(src)/lib/wlc_hybrid.o_shipped
+
+ KBASE ?= /lib/modules/`uname -r`
diff --git a/guix/nongnu/packages/patches/broadcom-sta-license.patch b/guix/nongnu/packages/patches/broadcom-sta-license.patch
new file mode 100644
index 0000000..aebb463
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-license.patch
@@ -0,0 +1,13 @@
+diff -Naur hybrid-portsrc-x86_32-v5_10_91_9.orig/src/wl/sys/wl_linux.c hybrid-portsrc-x86_32-v5_10_91_9/src/wl/sys/wl_linux.c
+--- hybrid-portsrc-x86_32-v5_10_91_9.orig/src/wl/sys/wl_linux.c 2009-04-23 02:48:59.000000000 +0900
++++ hybrid-portsrc-x86_32-v5_10_91_9/src/wl/sys/wl_linux.c 2009-05-08 00:48:20.000000000 +0900
+@@ -171,6 +171,8 @@
+ static void wl_free_if(wl_info_t *wl, wl_if_t *wlif);
+ static void wl_get_driver_info(struct net_device *dev, struct ethtool_drvinfo *info);
+
++MODULE_LICENSE("MIXED/Proprietary");
++
+ #if defined(WL_CONFIG_RFKILL)
+ #include <linux/rfkill.h>
+ static int wl_init_rfkill(wl_info_t *wl);
+
diff --git a/guix/nongnu/packages/patches/broadcom-sta-linux-4.11.patch b/guix/nongnu/packages/patches/broadcom-sta-linux-4.11.patch
new file mode 100644
index 0000000..a779f8c
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-linux-4.11.patch
@@ -0,0 +1,52 @@
+diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
+index a9671e2..da36405 100644
+--- a/src/wl/sys/wl_cfg80211_hybrid.c
++++ b/src/wl/sys/wl_cfg80211_hybrid.c
+@@ -30,6 +30,9 @@
+ #include <linux/kthread.h>
+ #include <linux/netdevice.h>
+ #include <linux/ieee80211.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++#include <linux/sched/signal.h>
++#endif
+ #include <net/cfg80211.h>
+ #include <linux/nl80211.h>
+ #include <net/rtnetlink.h>
+diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
+index 489c9f5..f8278ad 100644
+--- a/src/wl/sys/wl_linux.c
++++ b/src/wl/sys/wl_linux.c
+@@ -117,6 +117,9 @@ int wl_found = 0;
+
+ typedef struct priv_link {
+ wl_if_t *wlif;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++ unsigned long last_rx;
++#endif
+ } priv_link_t;
+
+ #define WL_DEV_IF(dev) ((wl_if_t*)((priv_link_t*)DEV_PRIV(dev))->wlif)
+@@ -2450,6 +2453,9 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rxsts, void *p)
+ {
+ struct sk_buff *oskb = (struct sk_buff *)p;
+ struct sk_buff *skb;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++ priv_link_t *priv_link;
++#endif
+ uchar *pdata;
+ uint len;
+
+@@ -2916,7 +2922,13 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rxsts, void *p)
+ if (skb == NULL) return;
+
+ skb->dev = wl->monitor_dev;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++ priv_link = MALLOC(wl->osh, sizeof(priv_link_t));
++ priv_link = netdev_priv(skb->dev);
++ priv_link->last_rx = jiffies;
++#else
+ skb->dev->last_rx = jiffies;
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
+ skb_reset_mac_header(skb);
+ #else
diff --git a/guix/nongnu/packages/patches/broadcom-sta-linux-4.12.patch b/guix/nongnu/packages/patches/broadcom-sta-linux-4.12.patch
new file mode 100644
index 0000000..8abc73d
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-linux-4.12.patch
@@ -0,0 +1,68 @@
+diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
+index da36405..d3741eb 100644
+--- a/src/wl/sys/wl_cfg80211_hybrid.c
++++ b/src/wl/sys/wl_cfg80211_hybrid.c
+@@ -53,7 +53,11 @@ u32 wl_dbg_level = WL_DBG_ERR;
+ #endif
+
+ static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++ enum nl80211_iftype type, struct vif_params *params);
++#else
+ enum nl80211_iftype type, u32 *flags, struct vif_params *params);
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
+ static s32
+ wl_cfg80211_scan(struct wiphy *wiphy,
+@@ -466,7 +470,11 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
+
+ static s32
+ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++ enum nl80211_iftype type,
++#else
+ enum nl80211_iftype type, u32 *flags,
++#endif
+ struct vif_params *params)
+ {
+ struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
+@@ -2361,6 +2369,20 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
+ const wl_event_msg_t *e, void *data)
+ {
+ struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++ struct cfg80211_bss *bss;
++ struct wlc_ssid *ssid;
++ ssid = &wl->profile->ssid;
++ bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
++ ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
++ struct cfg80211_roam_info roam_info = {
++ .bss = bss,
++ .req_ie = conn_info->req_ie,
++ .req_ie_len = conn_info->req_ie_len,
++ .resp_ie = conn_info->resp_ie,
++ .resp_ie_len = conn_info->resp_ie_len,
++ };
++#endif
+ s32 err = 0;
+
+ wl_get_assoc_ies(wl);
+@@ -2368,12 +2390,17 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
+ memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
+ wl_update_bss_info(wl);
+ cfg80211_roamed(ndev,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++ &roam_info,
++#else
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
+ &wl->conf->channel,
+ #endif
+ (u8 *)&wl->bssid,
+ conn_info->req_ie, conn_info->req_ie_len,
+- conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
++ conn_info->resp_ie, conn_info->resp_ie_len,
++#endif
++ GFP_KERNEL);
+ WL_DBG(("Report roaming result\n"));
+
+ set_bit(WL_STATUS_CONNECTED, &wl->status);
diff --git a/guix/nongnu/packages/patches/broadcom-sta-linux-4.15.patch b/guix/nongnu/packages/patches/broadcom-sta-linux-4.15.patch
new file mode 100644
index 0000000..523fa29
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-linux-4.15.patch
@@ -0,0 +1,47 @@
+See: https://lkml.org/lkml/2017/11/25/90
+
+diff -urNZ a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
+--- a/src/wl/sys/wl_linux.c 2015-09-18 22:47:30.000000000 +0000
++++ b/src/wl/sys/wl_linux.c 2018-01-31 22:52:10.859856221 +0000
+@@ -93,7 +93,11 @@
+
+ #include <wlc_wowl.h>
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++static void wl_timer(struct timer_list *tl);
++#else
+ static void wl_timer(ulong data);
++#endif
+ static void _wl_timer(wl_timer_t *t);
+ static struct net_device *wl_alloc_linux_if(wl_if_t *wlif);
+
+@@ -2298,9 +2302,15 @@
+ }
+
+ static void
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++wl_timer(struct timer_list *tl)
++{
++ wl_timer_t *t = from_timer(t, tl, timer);
++#else
+ wl_timer(ulong data)
+ {
+ wl_timer_t *t = (wl_timer_t *)data;
++#endif
+
+ if (!WL_ALL_PASSIVE_ENAB(t->wl))
+ _wl_timer(t);
+@@ -2352,9 +2362,13 @@
+
+ bzero(t, sizeof(wl_timer_t));
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++ timer_setup(&t->timer, wl_timer, 0);
++#else
+ init_timer(&t->timer);
+ t->timer.data = (ulong) t;
+ t->timer.function = wl_timer;
++#endif
+ t->wl = wl;
+ t->fn = fn;
+ t->arg = arg;
diff --git a/guix/nongnu/packages/patches/broadcom-sta-linux-4.7.patch b/guix/nongnu/packages/patches/broadcom-sta-linux-4.7.patch
new file mode 100644
index 0000000..566680a
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-linux-4.7.patch
@@ -0,0 +1,109 @@
+Since Linux 4.7, the enum ieee80211_band is no longer used
+
+This shall cause no problem's since both enums ieee80211_band
+and nl80211_band were added in the same commit:
+https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=13ae75b103e07304a34ab40c9136e9f53e06475c
+
+This patch refactors the references of IEEE80211_BAND_* to NL80211_BAND_*
+
+Reference:
+https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=57fbcce37be7c1d2622b56587c10ade00e96afa3
+
+--- a/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:57:36.159340297 -0500
++++ b/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:58:18.442323435 -0500
+@@ -236,7 +236,7 @@
+ #endif
+
+ #define CHAN2G(_channel, _freq, _flags) { \
+- .band = IEEE80211_BAND_2GHZ, \
++ .band = NL80211_BAND_2GHZ, \
+ .center_freq = (_freq), \
+ .hw_value = (_channel), \
+ .flags = (_flags), \
+@@ -245,7 +245,7 @@
+ }
+
+ #define CHAN5G(_channel, _flags) { \
+- .band = IEEE80211_BAND_5GHZ, \
++ .band = NL80211_BAND_5GHZ, \
+ .center_freq = 5000 + (5 * (_channel)), \
+ .hw_value = (_channel), \
+ .flags = (_flags), \
+@@ -379,7 +379,7 @@
+ };
+
+ static struct ieee80211_supported_band __wl_band_2ghz = {
+- .band = IEEE80211_BAND_2GHZ,
++ .band = NL80211_BAND_2GHZ,
+ .channels = __wl_2ghz_channels,
+ .n_channels = ARRAY_SIZE(__wl_2ghz_channels),
+ .bitrates = wl_g_rates,
+@@ -387,7 +387,7 @@
+ };
+
+ static struct ieee80211_supported_band __wl_band_5ghz_a = {
+- .band = IEEE80211_BAND_5GHZ,
++ .band = NL80211_BAND_5GHZ,
+ .channels = __wl_5ghz_a_channels,
+ .n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
+ .bitrates = wl_a_rates,
+@@ -395,7 +395,7 @@
+ };
+
+ static struct ieee80211_supported_band __wl_band_5ghz_n = {
+- .band = IEEE80211_BAND_5GHZ,
++ .band = NL80211_BAND_5GHZ,
+ .channels = __wl_5ghz_n_channels,
+ .n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
+ .bitrates = wl_a_rates,
+@@ -1876,8 +1876,8 @@
+ wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
+ #endif
+ wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
+- wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
+- wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a;
++ wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz;
++ wdev->wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a;
+ wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
+ wdev->wiphy->cipher_suites = __wl_cipher_suites;
+ wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
+@@ -2000,7 +2000,7 @@
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
+ freq = ieee80211_channel_to_frequency(notif_bss_info->channel,
+ (notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ?
+- IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ);
++ NL80211_BAND_2GHZ : NL80211_BAND_5GHZ);
+ #else
+ freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
+ #endif
+@@ -2116,7 +2116,7 @@
+ return err;
+ }
+ chan = wf_chspec_ctlchan(chanspec);
+- band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
++ band = (chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
+ freq = ieee80211_channel_to_frequency(chan, band);
+ channel = ieee80211_get_channel(wiphy, freq);
+ cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, channel, GFP_KERNEL);
+@@ -2250,10 +2250,10 @@
+ join_params->params.chanspec_list[0] =
+ ieee80211_frequency_to_channel(chan->center_freq);
+
+- if (chan->band == IEEE80211_BAND_2GHZ) {
++ if (chan->band == NL80211_BAND_2GHZ) {
+ chanspec |= WL_CHANSPEC_BAND_2G;
+ }
+- else if (chan->band == IEEE80211_BAND_5GHZ) {
++ else if (chan->band == NL80211_BAND_5GHZ) {
+ chanspec |= WL_CHANSPEC_BAND_5G;
+ }
+ else {
+@@ -2885,7 +2885,7 @@
+
+ if (phy == 'n' || phy == 'a' || phy == 'v') {
+ wiphy = wl_to_wiphy(wl);
+- wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
++ wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_n;
+ }
+
+ return err;
diff --git a/guix/nongnu/packages/patches/broadcom-sta-linux-4.8.patch b/guix/nongnu/packages/patches/broadcom-sta-linux-4.8.patch
new file mode 100644
index 0000000..20e8a9a
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-linux-4.8.patch
@@ -0,0 +1,64 @@
+From d3f93542326a06d920c6eb89b703384290d37b8b Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone@canonical.com>
+Date: Fri, 2 Sep 2016 17:35:34 +0200
+Subject: [PATCH 1/1] Add support for Linux 4.8
+
+Orginal author: Krzysztof Kolasa
+---
+ src/wl/sys/wl_cfg80211_hybrid.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
+index 2fc71fe..ec5e472 100644
+--- a/src/wl/sys/wl_cfg80211_hybrid.c
++++ b/src/wl/sys/wl_cfg80211_hybrid.c
+@@ -2388,8 +2388,16 @@ wl_bss_connect_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
+ s32 err = 0;
+
+ if (wl->scan_request) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++ struct cfg80211_scan_info info = {
++ .aborted = true,
++ };
++ WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
++ cfg80211_scan_done(wl->scan_request, &info);
++#else
+ WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
+ cfg80211_scan_done(wl->scan_request, true);
++#endif
+ wl->scan_request = NULL;
+ }
+
+@@ -2490,7 +2498,14 @@ wl_notify_scan_status(struct wl_cfg80211_priv *wl, struct net_device *ndev,
+
+ scan_done_out:
+ if (wl->scan_request) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++ struct cfg80211_scan_info info = {
++ .aborted = false,
++ };
++ cfg80211_scan_done(wl->scan_request, &info);
++#else
+ cfg80211_scan_done(wl->scan_request, false);
++#endif
+ wl->scan_request = NULL;
+ }
+ rtnl_unlock();
+@@ -2909,7 +2924,14 @@ s32 wl_cfg80211_down(struct net_device *ndev)
+ s32 err = 0;
+
+ if (wl->scan_request) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++ struct cfg80211_scan_info info = {
++ .aborted = true,
++ };
++ cfg80211_scan_done(wl->scan_request, &info);
++#else
+ cfg80211_scan_done(wl->scan_request, true);
++#endif
+ wl->scan_request = NULL;
+ }
+
+--
+2.7.4
+
diff --git a/guix/nongnu/packages/patches/broadcom-sta-linux-5.1.patch b/guix/nongnu/packages/patches/broadcom-sta-linux-5.1.patch
new file mode 100644
index 0000000..8f04a73
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-linux-5.1.patch
@@ -0,0 +1,32 @@
+commit bcb06af629a36eb84f9a35ac599ec7e51e2d39fb
+Author: georgewhewell <georgerw@gmail.com>
+Date: Sat May 18 21:22:37 2019 +0100
+
+ find src -type f -name \'*.c\' -exec sed -i "s/get_ds()/KERNEL_DS/g" {} \;
+
+diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
+index 7b606e0..51c81bc 100644
+--- a/src/wl/sys/wl_cfg80211_hybrid.c
++++ b/src/wl/sys/wl_cfg80211_hybrid.c
+@@ -450,7 +450,7 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
+ ifr.ifr_data = (caddr_t)&ioc;
+
+ fs = get_fs();
+- set_fs(get_ds());
++ set_fs(KERNEL_DS);
+ #if defined(WL_USE_NETDEV_OPS)
+ err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+ #else
+diff --git a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
+index c4c610b..9c3c74e 100644
+--- a/src/wl/sys/wl_iw.c
++++ b/src/wl/sys/wl_iw.c
+@@ -117,7 +117,7 @@ dev_wlc_ioctl(
+ ifr.ifr_data = (caddr_t) &ioc;
+
+ fs = get_fs();
+- set_fs(get_ds());
++ set_fs(KERNEL_DS);
+ #if defined(WL_USE_NETDEV_OPS)
+ ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+ #else
diff --git a/guix/nongnu/packages/patches/broadcom-sta-linux-5.10.patch b/guix/nongnu/packages/patches/broadcom-sta-linux-5.10.patch
new file mode 100644
index 0000000..c77fdc5
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-linux-5.10.patch
@@ -0,0 +1,211 @@
+From f3d652840f8dd959395065a1cf67ca40b04ec69b Mon Sep 17 00:00:00 2001
+From: Joan Bruguera <joanbrugueram@gmail.com>
+Date: Tue, 13 Oct 2020 19:35:55 +0200
+Subject: [PATCH] Get rid of get_fs/set_fs calls in Broadcom WL driver.
+
+Tentative patch for broadcom-wl 6.30.223.271 driver for Linux 5.10 (tested -rc1 up to 5.10.1)
+
+Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-23 on Arch Linux.
+
+NB: Some checks in wlc_ioctl_internal are likely superfluous,
+ but I'm not familiar enough with the driver to remove them with confidence.
+
+See also: https://lwn.net/Articles/722267/
+ https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=47058bb54b57962b3958a936ddbc59355e4c5504
+ https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5e6e9852d6f76e01b2e6803c74258afa5b432bc5
+
+Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
+---
+ src/wl/sys/wl_cfg80211_hybrid.c | 25 ++-------------------
+ src/wl/sys/wl_iw.c | 25 ++-------------------
+ src/wl/sys/wl_linux.c | 40 ++++++++++++++++++++++++++++-----
+ src/wl/sys/wl_linux.h | 2 ++
+ src/wl/sys/wlc_pub.h | 1 +
+ 5 files changed, 42 insertions(+), 51 deletions(-)
+
+diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
+index 73c4b82..2e6df32 100644
+--- a/src/wl/sys/wl_cfg80211_hybrid.c
++++ b/src/wl/sys/wl_cfg80211_hybrid.c
+@@ -38,6 +38,7 @@
+ #include <wlioctl.h>
+ #include <proto/802.11.h>
+ #include <wl_cfg80211_hybrid.h>
++#include <wl_linux.h>
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+ #include <linux/sched/signal.h>
+@@ -443,30 +444,8 @@ static void key_endian_to_host(struct wl_wsec_key *key)
+ static s32
+ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
+ {
+- struct ifreq ifr;
+- struct wl_ioctl ioc;
+- mm_segment_t fs;
+- s32 err = 0;
+-
+ BUG_ON(len < sizeof(int));
+-
+- memset(&ioc, 0, sizeof(ioc));
+- ioc.cmd = cmd;
+- ioc.buf = arg;
+- ioc.len = len;
+- strcpy(ifr.ifr_name, dev->name);
+- ifr.ifr_data = (caddr_t)&ioc;
+-
+- fs = get_fs();
+- set_fs(KERNEL_DS);
+-#if defined(WL_USE_NETDEV_OPS)
+- err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+-#else
+- err = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+-#endif
+- set_fs(fs);
+-
+- return err;
++ return wlc_ioctl_internal(dev, cmd, arg, len);
+ }
+
+ static s32
+diff --git a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
+index 9c3c74e..e346b15 100644
+--- a/src/wl/sys/wl_iw.c
++++ b/src/wl/sys/wl_iw.c
+@@ -37,6 +37,7 @@ typedef const struct si_pub si_t;
+
+ #include <wl_dbg.h>
+ #include <wl_iw.h>
++#include <wl_linux.h>
+
+ extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
+ uint32 reason, char* stringBuf, uint buflen);
+@@ -103,29 +104,7 @@ dev_wlc_ioctl(
+ int len
+ )
+ {
+- struct ifreq ifr;
+- wl_ioctl_t ioc;
+- mm_segment_t fs;
+- int ret;
+-
+- memset(&ioc, 0, sizeof(ioc));
+- ioc.cmd = cmd;
+- ioc.buf = arg;
+- ioc.len = len;
+-
+- strcpy(ifr.ifr_name, dev->name);
+- ifr.ifr_data = (caddr_t) &ioc;
+-
+- fs = get_fs();
+- set_fs(KERNEL_DS);
+-#if defined(WL_USE_NETDEV_OPS)
+- ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+-#else
+- ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+-#endif
+- set_fs(fs);
+-
+- return ret;
++ return wlc_ioctl_internal(dev, cmd, arg, len);
+ }
+
+ static int
+diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
+index cca7ee1..e491df7 100644
+--- a/src/wl/sys/wl_linux.c
++++ b/src/wl/sys/wl_linux.c
+@@ -1647,10 +1647,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+ goto done2;
+ }
+
+- if (get_fs().seg == KERNEL_DS.seg)
+- buf = ioc.buf;
+-
+- else if (ioc.buf) {
++ if (ioc.buf) {
+ if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) {
+ bcmerror = BCME_NORESOURCE;
+ goto done2;
+@@ -1671,7 +1668,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+ WL_UNLOCK(wl);
+
+ done1:
+- if (ioc.buf && (ioc.buf != buf)) {
++ if (ioc.buf) {
+ if (copy_to_user(ioc.buf, buf, ioc.len))
+ bcmerror = BCME_BADADDR;
+ MFREE(wl->osh, buf, MAX(ioc.len, WLC_IOCTL_MAXLEN));
+@@ -1684,6 +1681,39 @@ done2:
+ return (OSL_ERROR(bcmerror));
+ }
+
++int
++wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len)
++{
++ wl_info_t *wl;
++ wl_if_t *wlif;
++ int bcmerror;
++
++ if (!dev)
++ return -ENETDOWN;
++
++ wl = WL_INFO(dev);
++ wlif = WL_DEV_IF(dev);
++ if (wlif == NULL || wl == NULL || wl->dev == NULL)
++ return -ENETDOWN;
++
++ bcmerror = 0;
++
++ WL_TRACE(("wl%d: wlc_ioctl_internal: cmd 0x%x\n", wl->pub->unit, cmd));
++
++ WL_LOCK(wl);
++ if (!capable(CAP_NET_ADMIN)) {
++ bcmerror = BCME_EPERM;
++ } else {
++ bcmerror = wlc_ioctl(wl->wlc, cmd, buf, len, wlif->wlcif);
++ }
++ WL_UNLOCK(wl);
++
++ ASSERT(VALID_BCMERROR(bcmerror));
++ if (bcmerror != 0)
++ wl->pub->bcmerror = bcmerror;
++ return (OSL_ERROR(bcmerror));
++}
++
+ static struct net_device_stats*
+ wl_get_stats(struct net_device *dev)
+ {
+diff --git a/src/wl/sys/wl_linux.h b/src/wl/sys/wl_linux.h
+index 5b1048e..c8c1f41 100644
+--- a/src/wl/sys/wl_linux.h
++++ b/src/wl/sys/wl_linux.h
+@@ -22,6 +22,7 @@
+ #define _wl_linux_h_
+
+ #include <wlc_types.h>
++#include <wlc_pub.h>
+
+ typedef struct wl_timer {
+ struct timer_list timer;
+@@ -187,6 +188,7 @@ extern irqreturn_t wl_isr(int irq, void *dev_id, struct pt_regs *ptregs);
+ extern int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
+ extern void wl_free(wl_info_t *wl);
+ extern int wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
++extern int wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len);
+ extern struct net_device * wl_netdev_get(wl_info_t *wl);
+
+ #endif
+diff --git a/src/wl/sys/wlc_pub.h b/src/wl/sys/wlc_pub.h
+index 53a98b8..2b5a029 100644
+--- a/src/wl/sys/wlc_pub.h
++++ b/src/wl/sys/wlc_pub.h
+@@ -24,6 +24,7 @@
+
+ #include <wlc_types.h>
+ #include <wlc_utils.h>
++#include <siutils.h>
+ #include "proto/802.11.h"
+ #include "proto/bcmevent.h"
+
+--
+2.28.0
diff --git a/guix/nongnu/packages/patches/broadcom-sta-linux-5.6.patch b/guix/nongnu/packages/patches/broadcom-sta-linux-5.6.patch
new file mode 100644
index 0000000..df5af79
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-linux-5.6.patch
@@ -0,0 +1,87 @@
+From dd057e40a167f4febb1a7c77dd32b7d36056952c Mon Sep 17 00:00:00 2001
+From: Herman van Hazendonk <github.com@herrie.org>
+Date: Tue, 31 Mar 2020 17:09:55 +0200
+Subject: [PATCH] Add fixes for 5.6 kernel
+
+Use ioremap instead of ioremap_nocache and proc_ops instead of file_operations on Linux kernel 5.6 and above.
+
+Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
+---
+ src/shared/linux_osl.c | 6 +++++-
+ src/wl/sys/wl_linux.c | 21 ++++++++++++++++++++-
+ 2 files changed, 25 insertions(+), 2 deletions(-)
+
+diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c
+index 6157d18..dcfc075 100644
+--- a/src/shared/linux_osl.c
++++ b/src/shared/linux_osl.c
+@@ -942,7 +942,11 @@ osl_getcycles(void)
+ void *
+ osl_reg_map(uint32 pa, uint size)
+ {
+- return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++ return (ioremap((unsigned long)pa, (unsigned long)size));
++ #else
++ return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
++ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
+ }
+
+ void
+diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
+index 0d05100..6d9dd0d 100644
+--- a/src/wl/sys/wl_linux.c
++++ b/src/wl/sys/wl_linux.c
+@@ -582,10 +582,17 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
+ }
+ wl->bcm_bustype = bustype;
+
++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++ if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
++ WL_ERROR(("wl%d: ioremap() failed\n", unit));
++ goto fail;
++ }
++ #else
+ if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
+ WL_ERROR(("wl%d: ioremap() failed\n", unit));
+ goto fail;
+ }
++ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
+
+ wl->bar1_addr = bar1_addr;
+ wl->bar1_size = bar1_size;
+@@ -772,8 +779,13 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+ if ((val & 0x0000ff00) != 0)
+ pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
+ bar1_size = pci_resource_len(pdev, 2);
++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++ bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
++ bar1_size);
++ #else
+ bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
+ bar1_size);
++ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
+ wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
+ pdev->irq, bar1_addr, bar1_size);
+
+@@ -3335,12 +3347,19 @@ wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t
+ }
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++static const struct proc_ops wl_fops = {
++ .proc_read = wl_proc_read,
++ .proc_write = wl_proc_write,
++};
++#else
+ static const struct file_operations wl_fops = {
+ .owner = THIS_MODULE,
+ .read = wl_proc_read,
+ .write = wl_proc_write,
+ };
+-#endif
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
+
+ static int
+ wl_reg_proc_entry(wl_info_t *wl)
diff --git a/guix/nongnu/packages/patches/broadcom-sta-linux-5.9.patch b/guix/nongnu/packages/patches/broadcom-sta-linux-5.9.patch
new file mode 100644
index 0000000..56de11d
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-linux-5.9.patch
@@ -0,0 +1,12 @@
+diff -u -r a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
+--- a/src/wl/sys/wl_linux.c 2020-10-12 21:19:15.256305165 +0000
++++ b/src/wl/sys/wl_linux.c 2020-10-12 21:20:38.687530895 +0000
+@@ -1643,7 +1643,7 @@
+ goto done2;
+ }
+
+- if (segment_eq(get_fs(), KERNEL_DS))
++ if (get_fs().seg == KERNEL_DS.seg)
+ buf = ioc.buf;
+
+ else if (ioc.buf) {
diff --git a/guix/nongnu/packages/patches/broadcom-sta-null-pointer-fix.patch b/guix/nongnu/packages/patches/broadcom-sta-null-pointer-fix.patch
new file mode 100644
index 0000000..adef19f
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-null-pointer-fix.patch
@@ -0,0 +1,27 @@
+Description: Fixing null pointer crash
+
+Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773713
+Bug-Ubuntu: https://launchpad.net/bugs/1415880
+Last-Update: 2015-08-18
+
+---
+ src/wl/sys/wl_linux.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
+index 860b935..295156f 100644
+--- a/src/wl/sys/wl_linux.c
++++ b/src/wl/sys/wl_linux.c
+@@ -2157,8 +2157,8 @@ wl_start(struct sk_buff *skb, struct net_device *dev)
+ wlif = WL_DEV_IF(dev);
+ wl = WL_INFO(dev);
+
++ skb->prev = NULL;
+ if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) {
+- skb->prev = NULL;
+
+ TXQ_LOCK(wl);
+
+--
+1.9.1
+
diff --git a/guix/nongnu/packages/patches/broadcom-sta-rdtscl.patch b/guix/nongnu/packages/patches/broadcom-sta-rdtscl.patch
new file mode 100644
index 0000000..1b9862c
--- /dev/null
+++ b/guix/nongnu/packages/patches/broadcom-sta-rdtscl.patch
@@ -0,0 +1,22 @@
+Since Linux 4.3, rdtscl() is no longer available and native_read_tsc()
+is renamed to rdtsc(). Move the macro contents in-line and call the
+new function. References:
+
+https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=fe47ae6e1a5005b2e82f7eab57b5c3820453293a
+https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=4ea1636b04dbd66536fa387bae2eea463efc705b
+
+diff -ru a/src/shared/linux_osl.c b/src/shared/linux_osl.c
+--- a/src/shared/linux_osl.c 2015-09-19 01:47:15.000000000 +0300
++++ b/src/shared/linux_osl.c 2015-11-21 15:20:30.585902518 +0200
+@@ -932,7 +932,11 @@
+ uint cycles;
+
+ #if defined(__i386__)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
++ cycles = (u32)rdtsc();
++#else
+ rdtscl(cycles);
++#endif
+ #else
+ cycles = 0;
+ #endif
diff --git a/guix/nongnu/packages/playonlinux.scm b/guix/nongnu/packages/playonlinux.scm
new file mode 100644
index 0000000..7a7c727
--- /dev/null
+++ b/guix/nongnu/packages/playonlinux.scm
@@ -0,0 +1,124 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
+;;;
+;;; This file is not 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 (nongnu packages playonlinux)
+ #:use-module ((guix licenses) :prefix license:)
+ #:use-module (guix packages)
+ #:use-module (guix build-system python)
+ #:use-module (guix git-download)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages admin)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages curl)
+ #:use-module (gnu packages gl)
+ #:use-module (gnu packages gnupg)
+ #:use-module (gnu packages imagemagick)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages wget)
+ #:use-module (gnu packages web)
+ #:use-module (gnu packages wine)
+ #:use-module (gnu packages wxwidgets)
+ #:use-module (gnu packages xorg))
+
+(define-public playonlinux
+ (package
+ (name "playonlinux")
+ (version "4.3.4")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/PlayOnLinux/POL-POM-4")
+ (commit version)))
+ (sha256
+ (base32
+ "0xzdi6x4ksn4jiqa0z8j4rangn0aj1y7kqykan464mp2l585y76v"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:python ,python-2
+ #:tests? #f
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'build 'hardcode-paths
+ (lambda _
+ ;; Do not search for python, call it from its store path
+ (substitute* "bash/find_python"
+ (("POL_PYTHON=\"\"")
+ (string-append "POL_PYTHON=\"" (which "python") "\"")))
+ ;; Do the same for other tools
+ (substitute* "python/lib/dpiFetcher.py"
+ (("xrdb") (which "xrdb")))
+ (substitute* "lib/setupwindow.lib"
+ (("nc") (which "nc")))
+ (substitute* "python/lib/Variables.py"
+ (("curl") (which "curl"))
+ (("wget ") (string-append (which "wget") " ")))
+ (substitute* "lib/scripts.lib"
+ (("\twget") (string-append "\t" (which "wget")))
+ (("\tcabextract") (string-append "\t" (which "cabextract")))
+ (("\tconvert") (string-append "\t" (which "convert"))))
+ (substitute* "lib/playonlinux.lib"
+ (("convert") (which "convert"))
+ (("gpg ") (string-append (which "gpg") " ")))
+ (substitute* "bash/polconfigurator"
+ (("convert") (which "convert")))
+ ;; Also substitute a non essential tool, that is still
+ ;; needed to parse recipes
+ (substitute* "lib/wine.lib"
+ (("jq") (which "jq")))
+ ;; Do not warn if we can't find the tools, since they are
+ ;; called directly with their store path now.
+ (substitute* "python/mainwindow.py"
+ ((".*self.singleCheckFatal.*") "")
+ ((".*self.singleCheck\\(\"jq\", package=\"jq\"\\).*") ""))
+ #t))
+ (replace 'build
+ (lambda* (#:key outputs #:allow-other-keys)
+ (invoke "make" (string-append "PREFIX=" (assoc-ref outputs "out")))))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (invoke "make" "install" (string-append "PREFIX=" (assoc-ref outputs "out")))))
+ (add-after 'install 'symlink-locales
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (mkdir-p (string-append out "/share/playonlinux/lang"))
+ (symlink (string-append out "/share/locale")
+ (string-append out "/share/playonlinux/lang/locale")))
+ #t)))))
+ (inputs
+ `(("cabextract" ,cabextract)
+ ("curl" ,curl)
+ ("gnupg" ,gnupg)
+ ("imagemagick" ,imagemagick)
+ ("jq" ,jq)
+ ("libx11" ,libx11)
+ ("mesa" ,mesa)
+ ("netcat" ,netcat)
+ ("python2-wxpython" ,python2-wxpython)
+ ("wget" ,wget)
+ ("wine" ,wine)
+ ("xrdb" ,xrdb)))
+ (home-page "https://www.playonlinux.com/")
+ (synopsis "Easy installer for Windows games")
+ (description "PlayOnLinux is a piece of software which allows you to easily
+install and use numerous games and apps designed to run with Microsoft
+Windows. Few games are compatible with GNU/Linux at the moment and it
+certainly is a factor preventing the migration to this system. PlayOnLinux
+brings a cost-free, accessible and efficient solution to this problem.")
+ (license (list
+ license:gpl2+
+ license:gpl3+))))
diff --git a/guix/nongnu/packages/scanner.scm b/guix/nongnu/packages/scanner.scm
new file mode 100644
index 0000000..9a8b3cf
--- /dev/null
+++ b/guix/nongnu/packages/scanner.scm
@@ -0,0 +1,210 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
+;;;
+;;; This file is not 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 (nongnu packages scanner)
+ #:use-module (ice-9 match)
+ #:use-module (guix packages)
+ #:use-module (nonguix build-system binary)
+ #:use-module (guix download)
+ #:use-module (gnu packages avahi)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages cpio)
+ #:use-module (gnu packages gcc)
+ #:use-module (gnu packages glib)
+ #:use-module (gnu packages gtk)
+ #:use-module (gnu packages package-management)
+ #:use-module (nonguix licenses))
+
+;; TODO: This packaged should reproduce what NixOS does, but I couldn't get
+;; the Brother MFC-J5335DW to work. There may be something wrong with my
+;; scanner, or with Guix and Sane, or with this package.
+
+;; See https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=brscan4
+;; See https://nixos.wiki/wiki/Scanners
+
+(define brscan4-version "0.4.8")
+
+(define brscan4-i686-archive
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://download.brother.com/welcome/dlf006647/brscan4-"
+ brscan4-version "-1.i386.rpm"))
+ (sha256
+ (base32 "0amp5j1likv1slfvlj2y22dnimljp7pzzg1z94fiwhlvk98m80pz"))))
+
+(define brscan4-x86_64-archive
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://download.brother.com/welcome/dlf006648/brscan4-"
+ brscan4-version "-1.x86_64.rpm"))
+ (sha256
+ (base32 "1bfdpf8z2ijr5gk3njffpy8zxw9fvyfw30ncrz4cfk15md7vwqfd"))))
+
+(define (lib)
+ (if (string=? (or (%current-target-system) (%current-system)) "x86_64-linux")
+ "lib64" "lib"))
+
+(define-public brscan4
+ (package
+ (name "brscan4")
+ (version brscan4-version)
+ (source #f)
+ (build-system binary-build-system)
+ (arguments
+ `(#:patchelf-plan
+ `(("opt/brother/scanner/brscan4/brsaneconfig4")
+ ("opt/brother/scanner/brscan4/brscan_cnetconfig"
+ ("avahi"))
+ ("opt/brother/scanner/brscan4/brscan_gnetconfig"
+ ("avahi" "glib" "gtk")))
+ #:install-plan
+ `((,,(string-append "usr/" (lib) "/sane/libsane-brother4.so.1.0.7") "lib/sane/")
+ ("opt/brother/scanner/brscan4/" "opt/brother/scanner/brscan4/"
+ #:exclude ("setupSaneScan4" "udev_config.sh")))
+ #:modules ((guix build utils)
+ (nonguix build utils)
+ (nonguix build binary-build-system)
+ (srfi srfi-1)
+ (ice-9 regex)
+ (ice-9 textual-ports))
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'unpack
+ (lambda* (#:key inputs #:allow-other-keys)
+ (system (format #f "rpm2cpio ~a | cpio -idmv"
+ (assoc-ref inputs "archive")))
+ #t))
+ (add-after 'install 'symlink-lib
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (lib (string-append out "/lib/sane/libsane-brother4.so.1.0.7"))
+ (link (string-append out "/lib/sane/libsane-brother4.so.1.0.7")))
+ (symlink lib (string-append (dirname lib) "/libsane-brother4.so.1"))
+ (symlink lib (string-append (dirname lib) "/libsane-brother4.so")))
+ #t))
+ (add-after 'install 'set-sane-dll-conf
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (dll (string-append out "/etc/sane.d/dll.conf")))
+ (mkdir-p (dirname dll))
+ (with-output-to-file dll
+ (lambda ()
+ (display "brother4"))))
+ #t))
+ (add-after 'install 'set-udev-rules
+ (lambda* (#:key outputs #:allow-other-keys)
+ (define (file->lines file)
+ (let ((file-string (call-with-input-file file
+ (lambda (f)
+ (get-string-all f)))))
+ (delete "" (string-split file-string #\newline))))
+ (define (maybe-print-line line)
+ (when (string-count line #\,)
+ (let* ((first-word (first (delete "" (string-split line #\,))))
+ (id-match (string-match "0[xX]([[:xdigit:]]+)" first-word)))
+ (when id-match
+ (format #t
+ (string-append "ATTR{idProduct}==\"~a\", "
+ "MODE=\"0664\", GROUP=\"scanner\", "
+ "ENV{libsane_matched}=\"yes\"~%")
+ (string-downcase (regexp-substitute #f id-match 1)))))))
+ (let* ((out (assoc-ref outputs "out"))
+ (rules (string-append out "/lib/udev/rules.d/49-brother-brscan4-libsane-type1.rules")))
+ (mkdir-p (dirname rules))
+ (with-output-to-file rules
+ (lambda ()
+ (format #t "~a~%~a~%~a~%"
+ "ACTION==\"add\", ATTR{idVendor}==\"04f9\", GOTO=\"brscan4\""
+ "GOTO=\"brscan4_end\""
+ "LABEL=\"brscan4\"")
+ (for-each
+ (lambda (file)
+ (for-each
+ maybe-print-line
+ (file->lines file)))
+ (cons "opt/brother/scanner/brscan4/Brsane4.ini"
+ (find-files "opt/brother/scanner/brscan4/models4"
+ "\\.ini$")))
+ (format #t "LABEL=\"brscan4_end\"~%"))))
+ #t))
+ (add-after 'build 'build-preload
+ ;; Generate an LD_PRELOAD wrapper to redirect execvp(), open() and
+ ;; open64() calls to `/opt/brother/scanner/brscan4`.
+ (lambda* (#:key inputs outputs system #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (preload-src (assoc-ref inputs "preload"))
+ (preload (string-append
+ out "/libexec/brother/scanner/brscan4/libpreload.so")))
+ (mkdir-p (dirname preload))
+ (apply invoke "gcc"
+ (append
+ (if (string=? system "x86_64-linux")
+ ;; FIXME: For some reason glibc32 has higher
+ ;; priority than the 64-bit version.
+ (list (string-append "-L" (assoc-ref inputs "glibc64") "/lib"))
+ '())
+ (list
+ "-shared" preload-src "-o" preload "-ldl"
+ (string-append "-DOUT=\"" out "\"") "-fPIC"))))
+ #t))
+ (add-after 'build-preload 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (preload (string-append
+ out "/libexec/brother/scanner/brscan4/libpreload.so"))
+ (wrapper (string-append out "/bin/brsaneconfig4"))
+ (bin (string-append out "/opt/brother/scanner/brscan4/brsaneconfig4")))
+ (mkdir-p (dirname wrapper))
+ (make-wrapper wrapper bin
+ `("LD_PRELOAD" ":" prefix ,(list preload))))
+ #t)))))
+ (native-inputs
+ `(("rpm" ,rpm)
+ ("cpio" ,cpio)
+ ("archive"
+ ,(match (or (%current-target-system) (%current-system))
+ ("x86_64-linux" brscan4-x86_64-archive)
+ (_ brscan4-i686-archive)))
+
+ ("gcc" ,gcc)
+ ,@(if (string=? (or (%current-target-system) (%current-system)) "x86_64-linux")
+ `(("glibc64" ,glibc))
+ '())
+ ("preload"
+ ,(origin
+ (method url-fetch)
+ (uri (string-append "https://raw.githubusercontent.com/NixOS/nixpkgs/"
+ "15b3d9d2773b6ff919b324d756e23f0f8bf9fc3f" ; 2020-05-16
+ "/pkgs/applications/graphics/sane/backends"
+ "/brscan4/preload.c"))
+ (sha256
+ (base32
+ "0dgp2qy9j7qjf2ld5hh921iaizwxwyspfjfp5p8p0bd5q0n45g6k"))))))
+ (inputs
+ `(("avahi" ,avahi)
+ ("glib" ,glib)
+ ("gtk" ,gtk+-2)))
+ (home-page "http://support.brother.com/")
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (synopsis "Driver, detection and configuration tool for Brother scanners")
+ (description "Driver, detection and configuration tool for Brother
+scanners. It also supports specifying an alternate file name for
+@file{brsanenetdevice4.cfg} via the @command{BRSANENETDEVICE4_CFG_FILENAME}
+environment variable, otherwise the file is invariably created at
+@file{/etc/opt/brother/scanner/brscan4}.")
+ (license (nonfree "No URL"))))
diff --git a/guix/nongnu/packages/steam-client.scm b/guix/nongnu/packages/steam-client.scm
new file mode 100644
index 0000000..ae97ced
--- /dev/null
+++ b/guix/nongnu/packages/steam-client.scm
@@ -0,0 +1,591 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 pkill-9
+;;; Copyright © 2020, 2021 ison <ison@airmail.cc>
+;;; Copyright © 2021 pineapples
+;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
+;;; Copyright © 2021 Kozo <kozodev@runbox.com>
+;;;
+;;; This file is not 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/>.
+
+;;; The steam script provided by this package may optionally be started as
+;;; a shell instead of automatically launching Steam by setting the
+;;; environment variable DEBUG=1. If the sandbox is started this way then
+;;; Steam should subsequently be launched via fhs-internal.
+
+;;; The sandbox shell aids in debugging missing container elements. For
+;;; example a missing symlink may be created manually before launching Steam
+;;; to verify that the fix works before filing a bug report.
+
+;;; A container wrapper creates the following store items:
+;;; * Main container package [nonguix-container->package] (basically a dummy
+;;; package with symlink to wrapper script)
+;;; - Wrapper script [make-container-wrapper] (runs "guix shell")
+;;; References:
+;;; -> manifest.scm [make-container-manifest] (used by wrapper to guarantee
+;;; exact store items)
+;;; -> container-internal [make-container-internal] {inside container}
+;;; (dummy package added to container with symlink to internal-script)
+;;; - internal-script [make-internal-script] {inside container}
+;;; (script run in-container which performs additional setup before
+;;; launching the desired application)
+;;; References:
+;;; -> Wrapped package {inside container} (in this case Steam).
+
+;;; Note: The extra container-internal package is necessary because there is no
+;;; way to add the container package's own store path to its own manifest unless
+;;; the manifest is printed inside the build phases. However, the (guix gexp)
+;;; module is apparently disallowed inside build phases.
+
+(define-module (nongnu packages steam-client)
+ #:use-module ((nonguix licenses) #:prefix license:)
+ #:use-module (guix gexp)
+ #:use-module (guix packages)
+ #:use-module (guix records)
+ #:use-module (guix download)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system trivial)
+ #:use-module (guix transformations)
+ #:use-module (gnu packages audio)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages bash)
+ #:use-module (gnu packages certs)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages file)
+ #:use-module (gnu packages fonts)
+ #:use-module (gnu packages fontutils)
+ #:use-module (gnu packages gawk)
+ #:use-module (gnu packages gcc)
+ #:use-module (gnu packages gl)
+ #:use-module (gnu packages glib)
+ #:use-module (gnu packages linux)
+ #:use-module (nongnu packages nvidia)
+ #:use-module (gnu packages pulseaudio)
+ #:use-module (gnu packages python)
+ #:use-module (nonguix utils))
+
+(define-record-type* <nonguix-container>
+ nonguix-container make-nonguix-container
+ nonguix-container? this-nonguix-container
+ (name ngc-name)
+ (version ngc-version (default #f))
+ (wrap-package ngc-wrap-package)
+ (run ngc-run)
+ (wrapper-name ngc-wrapper-name (default "nonguix-container-wrapper"))
+ (manifest-name ngc-manifest-name (default "nonguix-container-manifest.scm"))
+ (internal-name ngc-internal-name (default "fhs-internal"))
+ (sandbox-home ngc-sandbox-home (default ".local/share/guix-sandbox-home"))
+ (union64 ngc-union64 (default '()))
+ (union32 ngc-union32 (default '()))
+ (preserved-env ngc-preserved-env (default '()))
+ (exposed ngc-exposed (default '()))
+ (shared ngc-shared (default '()))
+ (modules ngc-modules (default '()))
+ (packages ngc-packages (default '()))
+ (link-files ngc-link-files (default '()))
+ (home-page ngc-home-page (default #f))
+ (synopsis ngc-synopsis (default #f))
+ (description ngc-description (default #f))
+ (license ngc-license (default #f)))
+
+(define steam-client
+ (package
+ (name "steam-client")
+ (version "1.0.0.61")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "http://repo.steampowered.com/steam/archive/precise/steam_"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "0c5xy57gwr14vp3wy3jpqi5dl6y7n01p2dy4jlgl9bf9x7616r6n"))
+ (file-name (string-append name "-" version ".tar.gz"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f
+ #:make-flags
+ (list "PREFIX=" (string-append "DESTDIR=" (assoc-ref %outputs "out")))
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'configure
+ (lambda _
+ (mkdir-p "bootstrap-temp")
+ (invoke "tar" "xfa" "bootstraplinux_ubuntu12_32.tar.xz"
+ "-C" "bootstrap-temp")
+ (substitute* "bootstrap-temp/steam.sh"
+ (("export LD_LIBRARY_PATH=\"")
+ "export LD_LIBRARY_PATH=\"${LD_LIBRARY_PATH-}:"))
+ (substitute* "bootstrap-temp/ubuntu12_32/steam-runtime/run.sh"
+ (("^export LD_LIBRARY_PATH=.*")
+ "export LD_LIBRARY_PATH=\"${LD_LIBRARY_PATH-}:$steam_runtime_library_paths\""))
+ (invoke "tar" "cfJ" "bootstraplinux_ubuntu12_32.tar.xz" "-C" "bootstrap-temp"
+ "linux32" "ubuntu12_32" "steam.sh" "steamdeps.txt")
+ (delete-file-recursively "bootstrap-temp")))
+ (add-after 'unpack 'patch-startscript
+ (lambda _
+ (substitute* "steam"
+ (("/usr") (assoc-ref %outputs "out")))))
+ (add-after 'patch-dot-desktop-files 'patch-desktop-file
+ (lambda _
+ (let ((path (string-append (assoc-ref %outputs "out")
+ "/share/applications/")))
+ (substitute* (string-append path "steam.desktop")
+ (("Exec=.*/steam") "Exec=steam"))
+ (copy-file (string-append path "steam.desktop")
+ (string-append path "steam-asound32.desktop"))
+ (substitute* (string-append path "steam-asound32.desktop")
+ (("Exec=steam %U") "Exec=steam %U -- --asound32")
+ (("Name=Steam") "Name=Steam (32-bit ALSA)")))))
+ ;; Steamdeps installs missing packages, which doesn't work with Guix.
+ (add-after 'install-binaries 'post-install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref %outputs "out")))
+ ;; Steamdeps installs missing packages, which doesn't work with Guix.
+ (delete-file (string-append out "/bin/steamdeps"))
+ (wrap-program (string-append out "/bin/steam")
+ '("LD_LIBRARY_PATH" prefix
+ ("/lib"
+ "/lib/alsa-lib"
+ "/lib/dri"
+ "/lib/nss"
+ "/lib/vdpau"
+ "/lib64"
+ "/lib64/alsa-lib"
+ "/lib64/dri"
+ "/lib64/nss"
+ "/lib64/vdpau"
+ "$HOME/.local/share/Steam/ubuntu12_32/steam-runtime/lib/x86_64-linux-gnu")))
+ ;; .steam-real will fail unless it is renamed to exactly "steam".
+ (rename-file (string-append out "/bin/steam")
+ (string-append out "/bin/steam-wrapper"))
+ (rename-file (string-append out "/bin/.steam-real")
+ (string-append out "/bin/steam"))
+ (substitute* (string-append out "/bin/steam-wrapper")
+ (("\\.steam-real") "steam"))))))))
+ (home-page "https://store.steampowered.com")
+ (synopsis "Digital distribution platform for managing and playing games")
+ (description "Steam is a digital software distribution platform created by Valve.")
+ (license (license:nonfree "file:///share/doc/steam/steam_subscriber_agreement.txt"))))
+
+(define fhs-min-libs
+ `(("glibc" ,glibc)
+ ("glibc-locales" ,glibc-locales)))
+
+(define steam-client-libs
+ `(("bash" ,bash) ; Required for steam startup.
+ ("coreutils" ,coreutils)
+ ("diffutils" ,diffutils)
+ ("dbus-glib" ,dbus-glib) ; Required for steam browser.
+ ("fontconfig" ,fontconfig) ; Required for steam client.
+ ("file" ,file) ; Used for steam installation.
+ ("freetype" ,freetype) ; Required for steam login.
+ ("gawk" ,gawk)
+ ("gcc:lib" ,gcc "lib") ; Required for steam startup.
+ ("grep" ,grep)
+ ("mesa" ,mesa) ; Required for steam startup.
+ ("nss-certs" ,nss-certs) ; Required for steam login.
+ ("sed" ,sed)
+ ("tar" ,tar)
+ ("util-linux" ,util-linux) ; Required for steam login.
+ ("xz" ,xz)))
+
+(define steam-gameruntime-libs
+ `(("alsa-lib" ,alsa-lib) ; Required for audio in most games.
+ ("alsa-plugins:pulseaudio" ,alsa-plugins "pulseaudio") ; Required for audio in most games.
+ ("font-dejavu" ,font-dejavu)
+ ("font-liberation" ,font-liberation)
+ ("openal" ,openal) ; Prevents corrupt audio in Crypt of the Necrodancer.
+ ("pulseaudio" ,pulseaudio) ; Prevents corrupt audio in Sven Coop.
+ ("python" ,python))) ; Required for KillingFloor2 and Wreckfest.
+
+(define* (fhs-union inputs #:key (name "fhs-union") (version "0.0") (system "x86_64-linux"))
+ "Create a package housing the union of inputs."
+ (package
+ (name name)
+ (version version)
+ (source #f)
+ (inputs inputs)
+ (build-system trivial-build-system)
+ (arguments
+ `(#:system ,system
+ #:modules ((guix build union))
+ #:builder
+ (begin
+ (use-modules (ice-9 match)
+ (guix build union))
+ (match %build-inputs
+ (((_ . directories) ...)
+ (union-build (assoc-ref %outputs "out")
+ directories)
+ #t)))))
+ (home-page #f)
+ (synopsis "Libraries used for FHS")
+ (description "Libraries needed to build a guix container FHS.")
+ (license #f)))
+
+(define (nonguix-container->package container)
+ "Return a package with wrapper script to launch the supplied container object
+in a sandboxed FHS environment."
+ (let* ((fhs-internal (make-container-internal container))
+ (fhs-manifest (make-container-manifest container fhs-internal))
+ (fhs-wrapper (make-container-wrapper container fhs-manifest fhs-internal))
+ (pkg (ngc-wrap-package container)))
+ (package
+ (name (ngc-name container))
+ (version (or (ngc-version container)
+ (package-version pkg)))
+ (source #f)
+ (inputs `(("wrap-package" ,(ngc-wrap-package container))
+ ,@(if (null? (ngc-union64 container))
+ '()
+ `(("fhs-union-64" ,(ngc-union64 container))))
+ ,@(if (null? (ngc-union32 container))
+ '()
+ `(("fhs-union-32" ,(ngc-union32 container))))
+ ("fhs-internal" ,fhs-internal)
+ ("fhs-wrapper" ,fhs-wrapper)
+ ("fhs-manifest" ,fhs-manifest)))
+ (build-system trivial-build-system)
+ (arguments
+ `(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let* ((out (assoc-ref %outputs "out"))
+ (internal-target (string-append (assoc-ref %build-inputs "fhs-internal")
+ "/bin/" ,(ngc-internal-name container)))
+ (internal-dest (string-append out "/sbin/" ,(ngc-internal-name container)))
+ (manifest-target (assoc-ref %build-inputs "fhs-manifest"))
+ (manifest-dest (string-append out "/etc/" ,(ngc-manifest-name container)))
+ (wrapper-target (assoc-ref %build-inputs "fhs-wrapper"))
+ (wrapper-dest (string-append out "/bin/" ,(ngc-name container)))
+ (link-files ',(ngc-link-files container)))
+ (mkdir-p (string-append out "/sbin"))
+ (mkdir-p (string-append out "/etc"))
+ (mkdir-p (string-append out "/bin"))
+ (symlink internal-target internal-dest)
+ (symlink wrapper-target wrapper-dest)
+ (symlink manifest-target manifest-dest)
+ (for-each
+ (lambda (link)
+ (mkdir-p (dirname (string-append out "/" link)))
+ (symlink (string-append (assoc-ref %build-inputs "wrap-package")
+ "/" link)
+ (string-append out "/" link)))
+ link-files)))))
+ (home-page (or (ngc-home-page container)
+ (package-home-page pkg)))
+ (synopsis (or (ngc-synopsis container)
+ (package-synopsis pkg)))
+ (description (or (ngc-description container)
+ (package-description pkg)))
+ (license (or (ngc-license container)
+ (package-license pkg))))))
+
+(define (make-container-wrapper container fhs-manifest fhs-internal)
+ "Return a script file-like object that launches the supplied container object
+in a sandboxed FHS environment."
+ (program-file
+ (ngc-wrapper-name container)
+ (with-imported-modules
+ `((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+ (define (preserve-var var)
+ (string-append "--preserve=" var))
+ (define* (add-path path #:key writable?)
+ (let ((opt (if writable?
+ "--share="
+ "--expose=")))
+ (if (pair? path)
+ (string-append opt (car path) "=" (cdr path))
+ (string-append opt path))))
+ (define (exists-> file)
+ (if (and file (file-exists? file))
+ `(,file) '()))
+ (let* ((run #$(file-append fhs-internal "/bin/" (ngc-internal-name container)))
+ (manifest-file #$(file-append fhs-manifest))
+ (xdg-runtime (getenv "XDG_RUNTIME_DIR"))
+ (home (getenv "HOME"))
+ (sandbox-home (or (getenv "GUIX_SANDBOX_HOME")
+ (string-append home "/" #$(ngc-sandbox-home container))))
+ (preserved-env '("^DBUS_"
+ "^DISPLAY$"
+ "^DRI_PRIME$"
+ "_PROXY$"
+ "_proxy$"
+ "^SDL_"
+ "^STEAM_"
+ "^XAUTHORITY$"
+ ;; Matching all ^XDG_ vars causes issues
+ ;; discussed in 80decf05.
+ "^XDG_DATA_HOME$"
+ "^XDG_RUNTIME_DIR$"))
+ (expose `("/dev/dri"
+ "/dev/input" ; Needed for controller input.
+ ,@(exists-> "/etc/machine-id")
+ "/sys/class/input" ; Needed for controller input.
+ "/sys/dev"
+ ,@(exists-> "/dev/nvidia0") ; needed for nvidia proprietary driver
+ ,@(exists-> "/dev/nvidiactl")
+ ,@(exists-> "/dev/nvidia-modeset")
+ "/sys/devices"
+ ,@(exists-> "/var/run/dbus")))
+ (share `("/dev/shm"
+ ,(string-append sandbox-home "=" home)
+ ,@(exists-> (string-append home "/.config/pulse"))
+ ,@(exists-> (string-append xdg-runtime "/pulse"))
+ ,@(exists-> (string-append xdg-runtime "/bus"))
+ ,@(exists-> (getenv "XAUTHORITY"))))
+ (DEBUG (equal? (getenv "DEBUG") "1"))
+ (args (cdr (command-line)))
+ (command (if DEBUG '()
+ `("--" ,run ,@args))))
+ (format #t "\n* Launching ~a in sandbox: ~a.\n\n"
+ #$(package-name (ngc-wrap-package container)) sandbox-home)
+ (when DEBUG
+ (format #t "* DEBUG set to 1: Starting shell. Launch application manually with: ~a.\n\n"
+ #$(ngc-internal-name container)))
+ (mkdir-p sandbox-home)
+ (invoke #$(file-append pulseaudio "/bin/pulseaudio")
+ "--start"
+ "--exit-idle-time=60")
+ (apply invoke
+ `("guix" "shell"
+ "--container" "--no-cwd" "--network"
+ ,@(map preserve-var preserved-env)
+ ,@(map add-path expose)
+ ,@(map (lambda (item)
+ (add-path item #:writable? #t))
+ share)
+ "-m" ,manifest-file
+ ,@command)))))))
+
+(define (make-container-manifest container fhs-internal)
+ "Return a scheme file-like object to be used as package manifest for FHS
+containers. This manifest will use the 'modules' and 'packages' fields
+specified in the container object, and will also include the exact store paths
+of the containers 'wrap-package', 'union32', and 'union64' fields, as well as
+the exact path for the fhs-internal package."
+ (scheme-file
+ (ngc-manifest-name container)
+ #~(begin
+ (use-package-modules
+ #$@(ngc-modules container))
+ (use-modules (guix gexp)
+ (guix utils)
+ (guix profiles)
+ (guix store)
+ (guix scripts package)
+ (srfi srfi-11))
+
+ ;; Copied from guix/scripts/package.scm.
+ (define (store-item->manifest-entry item)
+ "Return a manifest entry for ITEM, a \"/gnu/store/...\" file name."
+ (let-values (((name version)
+ (package-name->name+version (store-path-package-name item)
+ #\-)))
+ (manifest-entry
+ (name name)
+ (version version)
+ (output "out") ;XXX: wild guess
+ (item item))))
+
+ (manifest-add
+ (packages->manifest (list #$@(ngc-packages container)))
+ (map store-item->manifest-entry
+ '(#$(file-append (ngc-wrap-package container))
+ #$(file-append (ngc-union64 container))
+ #$(file-append (ngc-union32 container))
+ #$(file-append fhs-internal)))))))
+
+(define (make-container-internal container)
+ "Return a dummy package housing the fhs-internal script."
+ (package
+ (name (ngc-internal-name container))
+ (version (or (ngc-version container)
+ (package-version (ngc-wrap-package container))))
+ (source #f)
+ (inputs `(("fhs-internal-script" ,(make-internal-script container))))
+ (build-system trivial-build-system)
+ (arguments
+ `(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let* ((bin (string-append (assoc-ref %outputs "out") "/bin"))
+ (internal-target (assoc-ref %build-inputs "fhs-internal-script"))
+ (internal-dest (string-append bin "/" ,(ngc-internal-name container))))
+ (mkdir-p bin)
+ (symlink internal-target internal-dest)))))
+ (home-page #f)
+ (synopsis "Script used to set up sandbox")
+ (description "Script used inside the FHS Guix container to set up the
+environment.")
+ (license #f)))
+
+(define (make-internal-script container)
+ "Return an fhs-internal script which is used to perform additional steps to
+set up the environment inside an FHS container before launching the desired
+application."
+ (let* ((pkg (ngc-wrap-package container))
+ (run (ngc-run container)))
+ (program-file
+ (ngc-internal-name container)
+ (with-imported-modules
+ `((guix build utils)
+ (ice-9 getopt-long))
+ #~(begin
+ (use-modules (guix build utils)
+ (ice-9 getopt-long))
+ (define (path->str path)
+ (if (list? path)
+ (string-join path "/")
+ path))
+ (define (new-symlink pair)
+ (let ((target (path->str (car pair)))
+ (dest (path->str (cdr pair))))
+ (unless (file-exists? dest)
+ (symlink target dest))))
+ (define (icd-symlink file)
+ (new-symlink
+ `(,file . ("/usr/share/vulkan/icd.d" ,(basename file)))))
+ (define fhs-option-spec
+ '((asound32 (value #f))))
+ (let* ((guix-env (getenv "GUIX_ENVIRONMENT"))
+ (union64 #$(file-append (ngc-union64 container)))
+ (union32 #$(file-append (ngc-union32 container)))
+ (all-args (cdr (command-line)))
+ (fhs-args (member "--" all-args))
+ (steam-args (if fhs-args
+ (reverse (cdr (member "--" (reverse all-args))))
+ all-args)))
+ (delete-file "/bin/sh")
+ (rmdir "/bin")
+ (for-each
+ mkdir-p
+ '("/run/current-system/profile/etc"
+ "/run/current-system/profile/share"
+ "/sbin"
+ "/usr/bin"
+ "/usr/share/vulkan/icd.d"))
+ (for-each
+ new-symlink
+ `(((,guix-env "etc/ssl") . "/etc/ssl")
+ ((,guix-env "etc/ssl") . "/run/current-system/profile/etc/ssl")
+ ((,union32 "lib") . "/lib")
+ ((,union32 "lib") . "/run/current-system/profile/lib")
+ ((,union64 "bin") . "/bin")
+ ((,union64 "bin/env") . "/usr/bin/env")
+ ((,union64 "lib") . "/lib64")
+ ((,union64 "lib") . "/run/current-system/profile/lib64")
+ ((,union64 "lib/locale") . "/run/current-system/locale")
+ ((,union64 "sbin/ldconfig") . "/sbin/ldconfig")
+ ((,union64 "share/drirc.d") . "/usr/share/drirc.d")
+ ((,union64 "share/fonts") . "/run/current-system/profile/share/fonts")
+ ((,union64 "share/vulkan/explicit_layer.d") .
+ "/usr/share/vulkan/explicit_layer.d")))
+ (for-each
+ icd-symlink
+ `(,@(find-files (string-append union32 "/share/vulkan/icd.d")
+ #:directories? #t)
+ ,@(find-files (string-append union64 "/share/vulkan/icd.d")
+ #:directories? #t)))
+
+ ;; Process FHS-specific command line options
+ (let* ((options (getopt-long (or fhs-args '("")) fhs-option-spec))
+ (asound32-opt (option-ref options 'asound32 #f))
+ (asound-lib (if asound32-opt "lib" "lib64")))
+ (if asound32-opt
+ (display "\n\n/etc/asound.conf configured for 32-bit.\n\n\n")
+ (display "\n\n/etc/asound.conf configured for 64-bit.\nLaunch steam with \"steam -- --asound32\" to use 32-bit instead.\n\n\n"))
+ (with-output-to-file "/etc/asound.conf"
+ (lambda _ (format (current-output-port) "# Generated by steam-client
+
+# Use PulseAudio by default
+pcm_type.pulse {
+ lib \"/~a/alsa-lib/libasound_module_pcm_pulse.so\"
+}
+
+ctl_type.pulse {
+ lib \"/~a/alsa-lib/libasound_module_ctl_pulse.so\"
+}
+
+pcm.!default {
+ type pulse
+ fallback \"sysdefault\"
+ hint {
+ show on
+ description \"Default ALSA Output (currently PulseAudio Sound Server)\"
+ }
+}
+
+ctl.!default {
+ type pulse
+ fallback \"sysdefault\"
+}\n\n" asound-lib asound-lib))))
+
+ (apply system* `(#$(file-append pkg run) ,@steam-args))))))))
+
+(define-public steam
+ (nonguix-container->package
+ (nonguix-container
+ (name "steam")
+ (wrap-package steam-client)
+ (run "/bin/steam-wrapper")
+ (union64
+ (fhs-union `(,@steam-client-libs
+ ,@steam-gameruntime-libs
+ ,@fhs-min-libs)
+ #:name "fhs-union-64"))
+ (union32
+ (fhs-union `(,@steam-client-libs
+ ,@steam-gameruntime-libs
+ ,@fhs-min-libs)
+ #:name "fhs-union-32"
+ #:system "i686-linux"))
+ (link-files '("share/applications/steam.desktop"
+ "share/applications/steam-asound32.desktop"))
+ (description "Steam is a digital software distribution platform created by
+Valve. This package provides a script for launching Steam in a Guix container
+which will use the directory @file{$HOME/.local/share/guix-sandbox-home} where
+all games will be installed."))))
+
+(define-public steam-nvidia
+ (nonguix-container->package
+ (nonguix-container
+ (name "steam-nvidia")
+ (wrap-package steam-client)
+ (run "/bin/steam-wrapper")
+ (union64
+ (replace-mesa
+ (fhs-union `(,@steam-client-libs
+ ,@steam-gameruntime-libs
+ ,@fhs-min-libs)
+ #:name "fhs-union-64")))
+ (union32
+ (replace-mesa
+ (fhs-union `(,@steam-client-libs
+ ,@steam-gameruntime-libs
+ ,@fhs-min-libs)
+ #:name "fhs-union-32"
+ #:system "i686-linux")))
+ (link-files '("share/applications/steam.desktop"
+ "share/applications/steam-asound32.desktop"))
+ (description "Steam is a digital software distribution platform created by
+Valve. This package provides a script for launching Steam in a Guix container
+which will use the directory @file{$HOME/.local/share/guix-sandbox-home} where
+all games will be installed."))))
diff --git a/guix/nongnu/packages/vpn.scm b/guix/nongnu/packages/vpn.scm
new file mode 100644
index 0000000..84ed23c
--- /dev/null
+++ b/guix/nongnu/packages/vpn.scm
@@ -0,0 +1,90 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Alexey Abramov <levenson@mmer.org>
+;;;
+;;; This file is not 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 (nongnu packages vpn)
+ #:use-module (guix build utils)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix packages)
+ #:use-module ((nonguix licenses) #:prefix license:))
+
+(define-public zerotier
+ (package
+ (name "zerotier")
+ (version "1.6.6")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/zerotier/ZeroTierOne")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0pi22252c21gxmjcgwmagkrnp5y1hhqrm9jkjj9pg1nlzzrlyrnm"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ ;; There is no ./configure
+ (delete 'configure)
+ (replace 'check
+ (lambda _
+ (invoke "make" "selftest")
+ (invoke "./zerotier-selftest")))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (sbin (string-append out "/sbin"))
+ (lib (string-append out "/lib"))
+ (man (string-append out "/share/man"))
+ (zerotier-one-lib (string-append lib "/zerotier-one")))
+ (mkdir-p sbin)
+ (install-file "zerotier-one" sbin)
+ (with-directory-excursion sbin
+ (symlink (string-append sbin "/zerotier-one") "zerotier-cli")
+ (symlink (string-append sbin "/zerotier-one") "zerotier-idtool"))
+
+ (mkdir-p zerotier-one-lib)
+ (with-directory-excursion zerotier-one-lib
+ (symlink (string-append sbin "/zerotier-one") "zerotier-one")
+ (symlink (string-append sbin "/zerotier-one") "zerotier-cli")
+ (symlink (string-append sbin "/zerotier-one") "zerotier-idtool"))
+
+ (mkdir-p (string-append man "/man8"))
+ (install-file "doc/zerotier-one.8" (string-append man "/man8"))
+
+ (mkdir-p (string-append man "/man1"))
+ (for-each (lambda (man-page)
+ (install-file man-page (string-append man "/man1")))
+ (list "doc/zerotier-cli.1"
+ "doc/zerotier-idtool.1"))
+ #t))))))
+ (home-page "https://github.com/zerotier/ZeroTierOne")
+ (synopsis "Smart programmable Ethernet switch for planet Earth")
+ (description "It allows all networked devices, virtual machines,
+containers, and applications to communicate as if they all reside in the same
+physical data center or cloud region.
+
+This is accomplished by combining a cryptographically addressed and secure
+peer to peer network (termed VL1) with an Ethernet emulation layer somewhat
+similar to VXLAN (termed VL2). Our VL2 Ethernet virtualization layer includes
+advanced enterprise SDN features like fine grained access control rules for
+network micro-segmentation and security monitoring.")
+ (license (license:nonfree "https://mariadb.com/bsl11/"))))
diff --git a/guix/nongnu/packages/wine.scm b/guix/nongnu/packages/wine.scm
new file mode 100644
index 0000000..d128119
--- /dev/null
+++ b/guix/nongnu/packages/wine.scm
@@ -0,0 +1,213 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;;
+;;; This file is not 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 (nongnu packages wine)
+ #:use-module (ice-9 match)
+ #:use-module ((guix licenses) :prefix license:)
+ #:use-module (guix packages)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system trivial)
+ #:use-module (guix build-system copy)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages bash)
+ #:use-module (gnu packages perl)
+ #:use-module (gnu packages wget)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages gnome)
+ #:use-module (gnu packages wine))
+
+(define-public winetricks
+ (package
+ (name "winetricks")
+ (version "20210206")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/Winetricks/winetricks")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0x2ykd6krk0fric45yl4gcc8cdv6j206l62rc9klw0rxfv12hz5n"))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("cabextract" ,cabextract)
+ ("p7zip" ,p7zip)
+ ("perl" ,perl)
+ ;; ("unrar" ,unrar) ; TODO: Include unrar? It is referenced in the source.
+ ("unzip" ,unzip)
+ ("wget" ,wget)
+ ("zenity" ,zenity)))
+ (arguments
+ `(#:tests? #f
+ ;; TODO: Checks need bashate, shellcheck (in Guix), and checkbashisms.
+ #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
+ "PREFIX=")
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (add-after 'install 'wrap-program
+ ;; The script relies on WINETRICKS_GUI being exactly "zenity", so
+ ;; we can't patch the path directly. Probably same for other dependencies.
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((zenity-bin (string-append (assoc-ref inputs "zenity") "/bin/"))
+ (perl-bin (string-append (assoc-ref inputs "perl") "/bin/"))
+ (winetricks (string-append (assoc-ref outputs "out")
+ "/bin/winetricks")))
+ (wrap-program winetricks
+ `("PATH" prefix (,@(map (lambda (in)
+ (string-append (assoc-ref inputs in) "/bin/"))
+ '("cabextract"
+ "p7zip"
+ "perl"
+ "unzip"
+ "wget"
+ "zenity"))))))))
+ (add-after 'install 'patch-perl-path
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((perl (string-append (assoc-ref inputs "perl") "/bin/perl"))
+ (winetricks (string-append (assoc-ref outputs "out")
+ "/bin/winetricks")))
+ (substitute* winetricks
+ (("#!/usr/bin/env perl") (string-append "#!" perl)))))))))
+ (home-page "https://github.com/Winetricks/winetricks")
+ (synopsis "Easy way to work around problems in Wine")
+ (description "Winetricks is an easy way to work around problems in Wine.
+It has a menu of supported games/apps for which it can do all the workarounds
+automatically. It also allows the installation of missing nonfree DLLs and
+tweaking of various Wine settings.")
+ (license license:lgpl2.1)))
+
+;; Upstream Guix dxvk does not build anymore because of missing mingw compiler.
+(define-public dxvk-1.7 ; TODO: Can we remove this in favour of `dxvk' without breaking `guix pull'?
+ (package
+ (name "dxvk")
+ (version "1.7.3")
+ (home-page "https://github.com/doitsujin/dxvk/")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://github.com/doitsujin/dxvk/releases/download/v"
+ version "/dxvk-" version ".tar.gz") )
+ (sha256
+ (base32
+ "185b80h7l62nv8k9rp32fkn00aglwcw9ccm6bx2n7bdpar149hp4"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan
+ `(,@,(if (string=? (or (%current-target-system) (%current-system))
+ "x86_64-linux")
+ '(list '("x64" "share/dxvk/lib"))
+ ''())
+ ("x32" ,,(if (string=? (or (%current-target-system) (%current-system))
+ "i686-linux")
+ "share/dxvk/lib"
+ "share/dxvk/lib32"))
+ ("setup_dxvk.sh" "bin/setup_dxvk"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'install 'fix-setup
+ (lambda* (#:key inputs outputs system #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (libs "../share/dxvk")
+ (wine (assoc-ref inputs "wine")))
+ (substitute* (string-append out "/bin/setup_dxvk")
+ (("wine=\"wine\"")
+ (string-append "wine=" wine "/bin/wine"))
+ (("wine64=\"wine64\"")
+ (string-append "wine64=" wine "/bin/wine64"))
+ (("wineboot=\"wineboot\"")
+ (string-append "wineboot=" wine "/bin/wineboot"))
+ (("\"\\$wine_path/\\$wine\"")
+ "\"$wine_path/wine\"")
+ (("x32") (if (string=? system "x86_64-linux")
+ (string-append libs "/lib32")
+ (string-append libs "/lib")))
+ (("x64") (string-append libs "/lib")))))))))
+ (inputs
+ `(("wine" ,(match (or (%current-target-system)
+ (%current-system))
+ ("x86_64-linux" wine64-staging)
+ (_ wine-staging)))))
+ (synopsis "Vulkan-based D3D9, D3D10 and D3D11 implementation for Wine")
+ (description "A Vulkan-based translation layer for Direct3D 9/10/11 which
+allows running complex 3D applications with high performance using Wine.
+
+Use @command{setup_dxvk} to install the required libraries to a Wine prefix.")
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (license license:zlib)))
+
+(define-public dxvk-next
+ (package
+ (name "dxvk")
+ (version "1.9")
+ (home-page "https://github.com/doitsujin/dxvk/")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://github.com/doitsujin/dxvk/releases/download/v"
+ version "/dxvk-" version ".tar.gz") )
+ (sha256
+ (base32
+ "1vd64525c6qwvxhdsqp7icbf7zsfdcyj125p0hm1k1rqg3w6hf23"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan
+ `(,@,(if (string=? (or (%current-target-system) (%current-system))
+ "x86_64-linux")
+ '(list '("x64" "share/dxvk/lib"))
+ ''())
+ ("x32" ,,(if (string=? (or (%current-target-system) (%current-system))
+ "i686-linux")
+ "share/dxvk/lib"
+ "share/dxvk/lib32"))
+ ("setup_dxvk.sh" "bin/setup_dxvk"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'install 'fix-setup
+ (lambda* (#:key inputs outputs system #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (libs "../share/dxvk")
+ (wine (assoc-ref inputs "wine")))
+ (substitute* (string-append out "/bin/setup_dxvk")
+ (("wine=\"wine\"")
+ (string-append "wine=" wine "/bin/wine"))
+ (("wine64=\"wine64\"")
+ (string-append "wine64=" wine "/bin/wine64"))
+ (("wineboot=\"wineboot\"")
+ (string-append "wineboot=" wine "/bin/wineboot"))
+ (("\"\\$wine_path/\\$wine\"")
+ "\"$wine_path/wine\"")
+ (("x32") (if (string=? system "x86_64-linux")
+ (string-append libs "/lib32")
+ (string-append libs "/lib")))
+ (("x64") (string-append libs "/lib")))))))))
+ (inputs
+ `(("wine" ,(match (or (%current-target-system)
+ (%current-system))
+ ("x86_64-linux" wine64-staging)
+ (_ wine-staging)))))
+ (synopsis "Vulkan-based D3D9, D3D10 and D3D11 implementation for Wine")
+ (description "A Vulkan-based translation layer for Direct3D 9/10/11 which
+allows running complex 3D applications with high performance using Wine.
+
+Use @command{setup_dxvk} to install the required libraries to a Wine prefix.")
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (license license:zlib)))
diff --git a/guix/nongnu/services/vpn.scm b/guix/nongnu/services/vpn.scm
new file mode 100644
index 0000000..b76cf03
--- /dev/null
+++ b/guix/nongnu/services/vpn.scm
@@ -0,0 +1,72 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Alexey Abramov <levenson@mmer.org>
+;;;
+;;; This file is not 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 (nongnu services vpn)
+ #:use-module (guix gexp)
+ #:use-module (gnu packages)
+ #:use-module (gnu services)
+ #:use-module (gnu services shepherd)
+ #:use-module (nongnu packages vpn)
+ #:export (zerotier-one-service))
+
+(define %zerotier-action-join
+ (shepherd-action
+ (name 'join)
+ (documentation "Join a network")
+ (procedure #~(lambda (running network)
+ (let* ((zerotier-cli (string-append #$zerotier "/sbin/zerotier-cli"))
+ (cmd (string-join (list zerotier-cli "join" network)))
+ (port (open-input-pipe cmd))
+ (str (get-string-all port)))
+ (display str)
+ (status:exit-val (close-pipe port)))))))
+
+(define %zerotier-action-leave
+ (shepherd-action
+ (name 'leave)
+ (documentation "Leave a network")
+ (procedure #~(lambda (running network)
+ (let* ((zerotier-cli (string-append #$zerotier "/sbin/zerotier-cli"))
+ (cmd (string-join (list zerotier-cli "leave" network)))
+ (port (open-input-pipe cmd))
+ (str (get-string-all port)))
+ (display str)
+ (status:exit-val (close-pipe port)))))))
+
+
+
+(define zerotier-one-shepherd-service
+ (lambda (config)
+ (list (shepherd-service
+ (documentation "ZeroTier One daemon.")
+ (provision '(zerotier-one))
+ (requirement '(networking))
+ (actions (list %zerotier-action-join
+ %zerotier-action-leave))
+ (start #~(make-forkexec-constructor
+ (list (string-append #$zerotier "/sbin/zerotier-one"))))
+ (stop #~(make-kill-destructor))))))
+
+(define zerotier-one-service-type
+ (service-type (name 'zerotier-one)
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ zerotier-one-shepherd-service)))))
+
+(define* (zerotier-one-service #:key (config (list)))
+ (service zerotier-one-service-type config))
diff --git a/guix/nongnu/system/install.scm b/guix/nongnu/system/install.scm
new file mode 100644
index 0000000..275bcaa
--- /dev/null
+++ b/guix/nongnu/system/install.scm
@@ -0,0 +1,32 @@
+;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;;
+;;; This program 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.
+;;;
+;;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+;; Generate a bootable image (e.g. for USB sticks, etc.) with:
+;; $ guix system disk-image nongnu/system/install.scm
+
+(define-module (nongnu system install)
+ #:use-module (gnu system)
+ #:use-module (gnu system install)
+ #:use-module (nongnu packages linux)
+ #:export (installation-os-nonfree))
+
+(define installation-os-nonfree
+ (operating-system
+ (inherit installation-os)
+ (kernel linux)
+ (firmware (list linux-firmware))))
+
+installation-os-nonfree
diff --git a/guix/nongnu/system/linux-initrd.scm b/guix/nongnu/system/linux-initrd.scm
new file mode 100644
index 0000000..5b29235
--- /dev/null
+++ b/guix/nongnu/system/linux-initrd.scm
@@ -0,0 +1,99 @@
+;;; Copyright © 2020 Alex Griffin <a@ajgrf.com>
+;;;
+;;; This program 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.
+;;;
+;;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (nongnu system linux-initrd)
+ #:use-module (gnu system linux-initrd)
+ #:use-module (guix gexp)
+ #:use-module (guix modules)
+ #:use-module (guix utils)
+ #:use-module (nongnu packages linux)
+ #:use-module (nonguix modules)
+ #:export (microcode-initrd))
+
+;; See https://www.kernel.org/doc/Documentation/x86/microcode.txt
+
+(define* (microcode-initrd file-systems
+ #:key
+ (initrd base-initrd)
+ (microcode-packages (list amd-microcode
+ intel-microcode))
+ #:allow-other-keys
+ #:rest rest)
+ "Build INITRD, extended to include x86 processor microcode from
+MICROCODE-PACKAGES."
+ (let ((args (strip-keyword-arguments '(#:initrd #:microcode-packages) rest)))
+ (combined-initrd (microcode-initrd* microcode-packages)
+ (apply initrd file-systems
+ args))))
+
+(define (microcode-initrd* microcode-packages)
+ "Build an uncompressed initrd containing x86 processor microcode from
+MICROCODE-PACKAGES, in the format expected by the kernel."
+ (define builder
+ (with-imported-modules (source-module-closure
+ '((gnu build linux-initrd)
+ (guix build utils)
+ (nonguix build utils))
+ #:select? import-nonguix-module?)
+ #~(begin
+ (use-modules (gnu build linux-initrd)
+ (guix build utils)
+ (nonguix build utils))
+
+ (let* ((initrd (string-append #$output "/initrd.cpio"))
+ (dest-dir "kernel/x86/microcode")
+ (amd-bin (string-append dest-dir "/AuthenticAMD.bin"))
+ (intel-bin (string-append dest-dir "/GenuineIntel.bin")))
+ (mkdir-p dest-dir)
+ (for-each
+ (lambda (package)
+ (let ((intel-ucode (string-append package
+ "/lib/firmware/intel-ucode"))
+ (amd-ucode (string-append package
+ "/lib/firmware/amd-ucode")))
+ (when (directory-exists? intel-ucode)
+ (concatenate-files (find-files intel-ucode ".*")
+ intel-bin))
+ (when (directory-exists? amd-ucode)
+ (concatenate-files (find-files amd-ucode
+ "^microcode_amd.*\\.bin$")
+ amd-bin))))
+ '#$microcode-packages)
+
+ (mkdir-p #$output)
+ (write-cpio-archive initrd "kernel" #:compress? #f)))))
+
+ (file-append (computed-file "microcode-initrd" builder)
+ "/initrd.cpio"))
+
+(define (combined-initrd . initrds)
+ "Return a combined initrd, the result of concatenating INITRDS."
+ (define builder
+ (with-imported-modules (source-module-closure
+ '((guix build utils)
+ (nonguix build utils))
+ #:select? import-nonguix-module?)
+ #~(begin
+ (use-modules (guix build utils)
+ (nonguix build utils))
+
+ ;; Use .img suffix since the result is no longer easily inspected by
+ ;; standard tools like cpio and gzip.
+ (let ((initrd (string-append #$output "/initrd.img")))
+ (mkdir-p #$output)
+ (concatenate-files '#$initrds initrd)))))
+
+ (file-append (computed-file "combined-initrd" builder)
+ "/initrd.img"))
diff --git a/guix/nonguix/build-system/binary.scm b/guix/nonguix/build-system/binary.scm
new file mode 100644
index 0000000..038bd89
--- /dev/null
+++ b/guix/nonguix/build-system/binary.scm
@@ -0,0 +1,162 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
+;;;
+;;; This file is not 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 (nonguix build-system binary)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (guix derivations)
+ #:use-module (guix search-paths)
+ #:use-module (guix build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system copy)
+ #:use-module (guix packages)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (nonguix utils)
+ #:export (%binary-build-system-modules
+ default-patchelf
+ default-glibc
+ lower
+ binary-build
+ binary-build-system))
+
+;; Commentary:
+;;
+;; Standard build procedure for binary packages. This is implemented as an
+;; extension of `copy-build-system'.
+;;
+;; Code:
+
+(define %binary-build-system-modules
+ ;; Build-side modules imported by default.
+ `((nonguix build binary-build-system)
+ (nonguix build utils)
+ ,@%copy-build-system-modules))
+
+(define (default-patchelf)
+ "Return the default patchelf package."
+
+ ;; Do not use `@' to avoid introducing circular dependencies.
+ (let ((module (resolve-interface '(gnu packages elf))))
+ (module-ref module 'patchelf)))
+
+(define (default-glibc)
+ "Return the default glibc package."
+ ;; Do not use `@' to avoid introducing circular dependencies.
+ (let ((module (resolve-interface '(gnu packages base))))
+ (module-ref module 'glibc)))
+
+(define* (lower name
+ #:key source inputs native-inputs outputs system target
+ (patchelf (default-patchelf))
+ (glibc (default-glibc))
+ #:allow-other-keys
+ #:rest arguments)
+ "Return a bag for NAME."
+ (define private-keywords
+ '(#:source #:target #:patchelf #:inputs #:native-inputs))
+
+ (and (not target) ;XXX: no cross-compilation
+ (bag
+ (name name)
+ (system system)
+ (host-inputs `(,@(if source
+ `(("source" ,source))
+ '())
+ ,@inputs
+ ;; Keep the standard inputs of 'gnu-build-system'.
+ ,@(standard-packages)))
+ (build-inputs `(("patchelf" ,patchelf)
+ ,@native-inputs
+ ;; If current system is i686, the *32 packages will be the
+ ;; same as the non-32, but that's OK.
+ ("libc32" ,(to32 glibc))))
+ (outputs outputs)
+ (build binary-build)
+ (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define* (binary-build store name inputs
+ #:key (guile #f)
+ (outputs '("out"))
+ (patchelf-plan ''())
+ (install-plan ''(("." "./")))
+ (search-paths '())
+ (out-of-source? #t)
+ (validate-runpath? #t)
+ (patch-shebangs? #t)
+ (strip-binaries? #t)
+ (strip-flags ''("--strip-debug"))
+ (strip-directories ''("lib" "lib64" "libexec"
+ "bin" "sbin"))
+ (phases '(@ (nonguix build binary-build-system)
+ %standard-phases))
+ (system (%current-system))
+ (imported-modules %binary-build-system-modules)
+ (modules '((nonguix build binary-build-system)
+ (guix build utils)
+ (nonguix build utils))))
+ "Build SOURCE using PATCHELF, and with INPUTS. This assumes that SOURCE
+provides its own binaries."
+ (define builder
+ `(begin
+ (use-modules ,@modules)
+ (binary-build #:source ,(match (assoc-ref inputs "source")
+ (((? derivation? source))
+ (derivation->output-path source))
+ ((source)
+ source)
+ (source
+ source))
+ #:system ,system
+ #:outputs %outputs
+ #:inputs %build-inputs
+ #:patchelf-plan ,patchelf-plan
+ #:install-plan ,install-plan
+ #:search-paths ',(map search-path-specification->sexp
+ search-paths)
+ #:phases ,phases
+ #:out-of-source? ,out-of-source?
+ #:validate-runpath? ,validate-runpath?
+ #:patch-shebangs? ,patch-shebangs?
+ #:strip-binaries? ,strip-binaries?
+ #:strip-flags ,strip-flags
+ #:strip-directories ,strip-directories)))
+
+ (define guile-for-build
+ (match guile
+ ((? package?)
+ (package-derivation store guile system #:graft? #f))
+ (#f ; the default
+ (let* ((distro (resolve-interface '(gnu packages commencement)))
+ (guile (module-ref distro 'guile-final)))
+ (package-derivation store guile system #:graft? #f)))))
+
+ (build-expression->derivation store name builder
+ #:system system
+ #:inputs inputs
+ #:modules imported-modules
+ #:outputs outputs
+ #:guile-for-build guile-for-build))
+
+(define binary-build-system
+ (build-system
+ (name 'binary)
+ (description "The standard binary build system")
+ (lower lower)))
+
+;;; binary.scm ends here
diff --git a/guix/nonguix/build/binary-build-system.scm b/guix/nonguix/build/binary-build-system.scm
new file mode 100644
index 0000000..6a676ae
--- /dev/null
+++ b/guix/nonguix/build/binary-build-system.scm
@@ -0,0 +1,155 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
+;;;
+;;; This file is not 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 (nonguix build binary-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (nonguix build utils)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 match)
+ #:export (%standard-phases
+ binary-build))
+
+;; Commentary:
+;;
+;; Builder-side code of the standard binary build procedure.
+;;
+;; Code:
+
+(define (new-install)
+ "Return the copy-build-system `install' procedure."
+ (@@ (guix build copy-build-system) install))
+
+(define* (old-install #:key install-plan outputs #:allow-other-keys)
+ "Copy files from the \"source\" build input to the \"out\" output according to INSTALL-PLAN.
+
+An INSTALL-PLAN is made of three elements:
+
+- A source path which is a file or directory from the \"source\" build input.
+- Patterns of the files to copy (only useful if the source path is a directory).
+- The target destination.
+
+If the target ends with a slash, it represents the target directory. If not, it
+represent the target full path, which only makes sense for single files."
+ (define (install-file file target)
+ (let ((target (string-append (assoc-ref outputs "out")
+ "/" target
+ (if (string-suffix? "/" target)
+ (string-append "/" file)
+ ""))))
+ (mkdir-p (dirname target))
+ (copy-file file target)))
+
+ (define (install-file-pattern pattern target)
+ (for-each
+ (lambda (file)
+ (install-file file target))
+ (find-files "." pattern)))
+
+ (define (install plan)
+ (match plan
+ ((file-or-directory files target)
+ (if (file-is-directory? file-or-directory)
+ (with-directory-excursion file-or-directory
+ (for-each
+ (lambda (pattern)
+ (install-file-pattern pattern target))
+ files))
+ (install-file file-or-directory target)))))
+
+ (for-each install install-plan)
+ #t)
+
+(define* (install #:key install-plan outputs #:allow-other-keys)
+ (define (install-old-format)
+ (warn "Install-plan format deprecated.
+Please update to the format of the copy-build-system.")
+ (old-install #:install-plan install-plan #:outputs outputs))
+ (match (car install-plan)
+ ((source (. matches) target)
+ (install-old-format))
+ ((source #f target)
+ (install-old-format))
+ (_ ((new-install) #:install-plan install-plan #:outputs outputs))))
+
+(define* (patchelf #:key inputs outputs patchelf-plan #:allow-other-keys)
+ "Set the interpreter and the RPATH of files as per the PATCHELF-PLAN.
+
+The PATCHELF-PLAN elements are lists of:
+
+- The file to patch.
+- The inputs (as strings) to include in the rpath, e.g. \"mesa\".
+
+Both executables and dynamic libraries are accepted.
+The inputs are optional when the file is an executable."
+ (define (binary-patch binary interpreter runpath)
+ (unless (string-contains binary ".so")
+ ;; Use `system*' and not `invoke' since this may raise an error if
+ ;; library does not end with .so.
+ (system* "patchelf" "--set-interpreter" interpreter binary))
+ (when runpath
+ (let ((rpath (string-join
+ (map
+ (lambda (input-or-output)
+ (cond
+ ((assoc-ref outputs input-or-output)
+ (string-append (assoc-ref outputs input-or-output) "/lib"))
+ ((assoc-ref inputs input-or-output)
+ (string-append (assoc-ref inputs input-or-output) "/lib"))
+ (else (error (format #f "`~a' not found among the inputs nor the outputs." input-or-output)))))
+ runpath)
+ ":")))
+ (invoke "patchelf" "--set-rpath" rpath binary)))
+ #t)
+
+ (when (and patchelf-plan
+ (not (null? patchelf-plan)))
+ (let ((interpreter (car (find-files (assoc-ref inputs "libc") "ld-linux.*\\.so")))
+ (interpreter32 (car (find-files (assoc-ref inputs "libc32") "ld-linux.*\\.so"))))
+ (for-each
+ (lambda (plan)
+ (match plan
+ ((binary runpath)
+ (binary-patch binary (if (64-bit? binary)
+ interpreter
+ interpreter32)
+ runpath))
+ ((binary)
+ (binary-patch binary (if (64-bit? binary)
+ interpreter
+ interpreter32)
+ #f))))
+ patchelf-plan)))
+ #t)
+
+(define %standard-phases
+ ;; Everything is as with the GNU Build System except for the `configure'
+ ;; , `build', `check' and `install' phases.
+ (modify-phases gnu:%standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (delete 'build)
+ (delete 'check)
+ (add-before 'install 'patchelf patchelf)
+ (replace 'install install)))
+
+(define* (binary-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given package, applying all of PHASES in order."
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; binary-build-system.scm ends here
diff --git a/guix/nonguix/build/utils.scm b/guix/nonguix/build/utils.scm
new file mode 100644
index 0000000..ab437f2
--- /dev/null
+++ b/guix/nonguix/build/utils.scm
@@ -0,0 +1,111 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2020 Alex Griffin <a@ajgrf.com>
+;;;
+;;; This file is not 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 (nonguix build utils)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 binary-ports)
+ #:use-module (guix build utils)
+ #:use-module (srfi srfi-26)
+ #:export (64-bit?
+ make-wrapper
+ concatenate-files))
+
+(define (64-bit? file)
+ "Return true if ELF file is in 64-bit format, false otherwise.
+See https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header."
+ (with-input-from-file file
+ (lambda ()
+ (= 2
+ (array-ref (get-bytevector-n (current-input-port) 5) 4)))
+ #:binary #t))
+
+(define* (make-wrapper wrapper real-file #:key (skip-argument-0? #f) #:rest vars)
+ "Like `wrap-program' but create WRAPPER around REAL-FILE.
+The wrapper automatically changes directory to that of REAL-FILE.
+
+Example:
+
+ (make-wrapper \"bin/foo\" \"sub-dir/original-foo\"
+ '(\"PATH\" \":\" = (\"/gnu/.../bar/bin\"))
+ '(\"CERT_PATH\" suffix (\"/gnu/.../baz/certs\"
+ \"/qux/certs\")))
+
+will create 'bin/foo' with the following
+contents:
+
+ #!location/of/bin/bash
+ export PATH=\"/gnu/.../bar/bin\"
+ export CERT_PATH=\"$CERT_PATH${CERT_PATH:+:}/gnu/.../baz/certs:/qux/certs\"
+ cd sub-dir
+ exec -a $0 sub-dir/original-foo \"$@\"."
+ (define (export-variable lst)
+ ;; Return a string that exports an environment variable.
+ (match lst
+ ((var sep '= rest)
+ (format #f "export ~a=\"~a\""
+ var (string-join rest sep)))
+ ((var sep 'prefix rest)
+ (format #f "export ~a=\"~a${~a:+~a}$~a\""
+ var (string-join rest sep) var sep var))
+ ((var sep 'suffix rest)
+ (format #f "export ~a=\"$~a${~a+~a}~a\""
+ var var var sep (string-join rest sep)))
+ ((var '= rest)
+ (format #f "export ~a=\"~a\""
+ var (string-join rest ":")))
+ ((var 'prefix rest)
+ (format #f "export ~a=\"~a${~a:+:}$~a\""
+ var (string-join rest ":") var var))
+ ((var 'suffix rest)
+ (format #f "export ~a=\"$~a${~a:+:}~a\""
+ var var var (string-join rest ":")))))
+
+ (define (remove-keyword-arguments lst)
+ (match lst
+ (() '())
+ (((? keyword? _) _ lst ...)
+ (remove-keyword-arguments lst))
+ (_ lst)))
+
+ (mkdir-p (dirname wrapper))
+ (call-with-output-file wrapper
+ (lambda (port)
+ (format port
+ (if skip-argument-0?
+ "#!~a~%~a~%cd \"~a\"~%exec \"~a\" \"$@\"~%"
+ "#!~a~%~a~%cd \"~a\"~%exec -a \"$0\" \"~a\" \"$@\"~%")
+ (which "bash")
+ (string-join
+ (map export-variable (remove-keyword-arguments vars))
+ "\n")
+ (dirname real-file)
+ (canonicalize-path real-file))))
+ (chmod wrapper #o755))
+
+(define (concatenate-files files result)
+ "Make RESULT the concatenation of all of FILES."
+ (define (dump file port)
+ (put-bytevector
+ port
+ (call-with-input-file file
+ get-bytevector-all)))
+
+ (call-with-output-file result
+ (lambda (port)
+ (for-each (cut dump <> port) files))))
diff --git a/guix/nonguix/download.scm b/guix/nonguix/download.scm
new file mode 100644
index 0000000..11087ff
--- /dev/null
+++ b/guix/nonguix/download.scm
@@ -0,0 +1,62 @@
+;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
+;;;
+;;; This program 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.
+;;;
+;;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (nonguix download)
+ #:use-module (guix derivations)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix store)
+ #:use-module (ice-9 match)
+ #:export (unredistributable-url-fetch))
+
+(define* (unredistributable-url-fetch url hash-algo hash
+ #:optional name
+ #:key (system (%current-system))
+ (guile (default-guile)))
+ "Return a fixed-output derivation that fetches URL (a string) which is expected
+to have HASH of type HASH-ALGO (a symbol). By default, the file name is the base
+name of URL; optionally, NAME can specify a different file name.
+
+This is a simpler version of url-fetch from Guix, that doesn't support mirror://
+or file:// uris. It is specifically designed to prevent substitution of the
+source, for the purpose of downloading copyrighted content you have access to,
+but you don't have the right to redistribute. By marking the derivation as non
+substitutable, this fetch prevents you from giving others access to the source
+if you run a substitute server on your machine."
+ (define file-name
+ (match url
+ ((head _ ...)
+ (basename head))
+ (_
+ (basename url))))
+
+ (mlet %store-monad ()
+ (raw-derivation (or name file-name) "builtin:download" '()
+ #:system system
+ #:hash-algo hash-algo
+ #:hash hash
+
+ ;; Honor the user's proxy and locale settings.
+ #:leaked-env-vars '("http_proxy" "https_proxy"
+ "LC_ALL" "LC_MESSAGES" "LANG"
+ "COLUMNS")
+ #:env-vars `(("url" . ,(object->string url)))
+
+ ;; Do not offload because the remote daemon may not support
+ ;; the 'download' builtin.
+ #:local-build? #t
+
+ ;; Do not substitute copyrighted material
+ #:substitutable? #f)))
diff --git a/guix/nonguix/licenses.scm b/guix/nonguix/licenses.scm
new file mode 100644
index 0000000..84d2346
--- /dev/null
+++ b/guix/nonguix/licenses.scm
@@ -0,0 +1,41 @@
+;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
+;;;
+;;; This program 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.
+;;;
+;;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (nonguix licenses)
+ #:use-module (guix licenses)
+ #:export (nonfree
+ undistributable))
+
+(define license (@@ (guix licenses) license))
+
+(define* (nonfree uri #:optional (comment ""))
+ "Return a nonfree license, whose full text can be found
+at URI, which may be a file:// URI pointing the package's tree."
+ (license "Nonfree"
+ uri
+ (string-append
+ "This a nonfree license. Check the URI for details. "
+ comment)))
+
+(define* (undistributable uri #:optional (comment ""))
+ "Return a nonfree license for packages which may not be redistributed, whose
+full text can be found at URI, which may be a file:// URI pointing the
+package's tree."
+ (license "Nonfree Undistributable"
+ uri
+ (string-append
+ "This a nonfree license. This package may NOT be redistributed "
+ "in prebuilt form. Check the URI for details. "
+ comment)))
diff --git a/guix/nonguix/modules.scm b/guix/nonguix/modules.scm
new file mode 100644
index 0000000..24d4267
--- /dev/null
+++ b/guix/nonguix/modules.scm
@@ -0,0 +1,35 @@
+;;; Copyright © 2020 Alex Griffin <a@ajgrf.com>
+;;;
+;;; This program 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.
+;;;
+;;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (nonguix modules)
+ #:use-module (ice-9 match)
+ #:export (import-nonguix-module?))
+
+(define (nonguix-module-name? name)
+ "Return true if NAME (a list of symbols) denotes a Guix or Nonguix module."
+ (match name
+ (('guix _ ...) #t)
+ (('gnu _ ...) #t)
+ (('nonguix _ ...) #t)
+ (('nongnu _ ...) #t)
+ (_ #f)))
+
+;; Since we don't use deduplication support in 'populate-store', don't
+;; import (guix store deduplication) and its dependencies, which
+;; includes Guile-Gcrypt.
+(define (import-nonguix-module? module)
+ "Return true if MODULE is not (guix store deduplication)"
+ (and (nonguix-module-name? module)
+ (not (equal? module '(guix store deduplication)))))
diff --git a/guix/nonguix/utils.scm b/guix/nonguix/utils.scm
new file mode 100644
index 0000000..7611a47
--- /dev/null
+++ b/guix/nonguix/utils.scm
@@ -0,0 +1,38 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;;
+;;; This file is not 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 (nonguix utils)
+ #:use-module (srfi srfi-26)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 textual-ports)
+ #:use-module (ice-9 popen)
+ #:use-module (guix utils)
+ #:use-module (guix packages))
+
+(define-public (to32 package64)
+ "Build package for i686-linux.
+Only x86_64-linux and i686-linux are supported.
+- If i686-linux, return the package unchanged.
+- If x86_64-linux, return the 32-bit version of the package."
+ (match (%current-system)
+ ("x86_64-linux"
+ (package
+ (inherit package64)
+ (arguments `(#:system "i686-linux"
+ ,@(package-arguments package64)))))
+ (_ package64)))