aboutsummaryrefslogtreecommitdiff
path: root/gnu/installer/newt/ethernet.scm
blob: ba5e222a3721a556400682f933e4fde4c3de32b3 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu installer newt ethernet)
  #:use-module (gnu installer connman)
  #:use-module (gnu installer steps)
  #:use-module (gnu installer newt utils)
  #:use-module (gnu installer newt page)
  #:use-module (guix i18n)
  #:use-module (ice-9 format)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-34)
  #:use-module (srfi srfi-35)
  #:use-module (newt)
  #:export (run-ethernet-page))

(define (ethernet-services)
  "Return all the connman services of ethernet type."
  (let ((services (connman-services)))
    (filter (lambda (service)
              (and (string=? (service-type service) "ethernet")
                   (not (string-null? (service-name service)))))
            services)))

(define (ethernet-service->text service)
  "Return a string describing the given ethernet SERVICE."
  (let* ((name (service-name service))
         (path (service-path service))
         (full-name (string-append name "-" path))
         (state (service-state service))
         (connected? (or (string=? state "online")
                         (string=? state "ready"))))
    (format #f "~c ~a~%"
            (if connected? #\* #\ )
            full-name)))

(define (connect-ethernet-service service)
  "Connect to the given ethernet SERVICE. Display a connecting page while the
connection is pending."
  (let* ((service-name (service-name service))
         (form (draw-connecting-page service-name)))
    (connman-connect service)
    (destroy-form-and-pop form)
    service))

(define (run-ethernet-page)
  (match (ethernet-services)
    (()
     (run-error-page
      (G_ "No ethernet service available, please try again.")
      (G_ "No service"))
     (raise
      (condition
       (&installer-step-abort))))
    ((service)
     ;; Only one service is available so return it directly.
     service)
    ((services ...)
     (run-listbox-selection-page
      #:info-text (G_ "Please select an ethernet network.")
      #:title (G_ "Ethernet connection")
      #:listbox-items services
      #:listbox-item->text ethernet-service->text
      #:listbox-height (min (+ (length services) 2) 10)
      #:button-text (G_ "Exit")
      #:button-callback-procedure
      (lambda _
        (raise
         (condition
          (&installer-step-abort))))
      #:listbox-callback-procedure connect-ethernet-service))))
99.8%;'/> -rw-r--r--gnu/packages/check.scm4
-rw-r--r--gnu/packages/chromium.scm4
-rw-r--r--gnu/packages/cmake.scm2
-rw-r--r--gnu/packages/compression.scm2
-rw-r--r--gnu/packages/databases.scm65
-rw-r--r--gnu/packages/dbm.scm8
-rw-r--r--gnu/packages/disk.scm4
-rw-r--r--gnu/packages/docbook.scm12
-rw-r--r--gnu/packages/education.scm4
-rw-r--r--gnu/packages/emacs-xyz.scm85
-rw-r--r--gnu/packages/embedded.scm20
-rw-r--r--gnu/packages/enchant.scm4
-rw-r--r--gnu/packages/engineering.scm8
-rw-r--r--gnu/packages/finance.scm4
-rw-r--r--gnu/packages/fontutils.scm5
-rw-r--r--gnu/packages/games.scm8
-rw-r--r--gnu/packages/gnome.scm70
-rw-r--r--gnu/packages/gnucash.scm21
-rw-r--r--gnu/packages/gnupg.scm1
-rw-r--r--gnu/packages/gnuzilla.scm21
-rw-r--r--gnu/packages/guile-xyz.scm15
-rw-r--r--gnu/packages/haskell-apps.scm4
-rw-r--r--gnu/packages/linux.scm11
-rw-r--r--gnu/packages/lisp-xyz.scm348
-rw-r--r--gnu/packages/mail.scm5
-rw-r--r--gnu/packages/music.scm23
-rw-r--r--gnu/packages/ocaml.scm112
-rw-r--r--gnu/packages/patches/sdcc-disable-non-free-code.patch3643
-rw-r--r--gnu/packages/piet.scm121
-rw-r--r--gnu/packages/python-check.scm34
-rw-r--r--gnu/packages/python-crypto.scm4
-rw-r--r--gnu/packages/python-web.scm2
-rw-r--r--gnu/packages/python-xyz.scm16
-rw-r--r--gnu/packages/radio.scm10
-rw-r--r--gnu/packages/ruby.scm12
-rw-r--r--gnu/packages/scheme.scm6
-rw-r--r--gnu/packages/sdcc.scm10
-rw-r--r--gnu/packages/shells.scm4
-rw-r--r--gnu/packages/storage.scm4
-rw-r--r--gnu/packages/tls.scm50
-rw-r--r--gnu/packages/version-control.scm17
-rw-r--r--gnu/packages/video.scm38
-rw-r--r--gnu/packages/vpn.scm8
-rw-r--r--gnu/packages/web.scm29
-rw-r--r--gnu/packages/xdisorg.scm4
-rw-r--r--gnu/packages/xfce.scm8
-rw-r--r--gnu/packages/xml.scm4
-rw-r--r--gnu/services/guix.scm11
-rw-r--r--gnu/services/web.scm6
-rw-r--r--gnu/system/image.scm1
64 files changed, 5200 insertions, 286 deletions
diff --git a/gnu/build/chromium-extension.scm b/gnu/build/chromium-extension.scm
new file mode 100644
index 0000000000..d65df09f37
--- /dev/null
+++ b/gnu/build/chromium-extension.scm
@@ -0,0 +1,192 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu build chromium-extension)
+ #:use-module (gcrypt base16)
+ #:use-module ((gcrypt hash) #:prefix hash:)
+ #:use-module (ice-9 iconv)
+ #:use-module (guix gexp)
+ #:use-module (guix packages)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages check)
+ #:use-module (gnu packages chromium)
+ #:use-module (gnu packages gnupg)
+ #:use-module (gnu packages tls)
+ #:use-module (gnu packages xorg)
+ #:use-module (guix build-system trivial)
+ #:export (make-chromium-extension))
+
+;;; Commentary:
+;;;
+;;; Tools to deal with Chromium extensions.
+;;;
+;;; Code:
+
+(define (make-signing-key seed)
+ "Return a derivation for a deterministic PKCS #8 private key using SEED."
+
+ (define sha256sum
+ (bytevector->base16-string (hash:sha256 (string->bytevector seed "UTF-8"))))
+
+ ;; certtool.c wants a 56 byte seed for a 2048 bit key.
+ (define size 2048)
+ (define normalized-seed (string-take sha256sum 56))
+
+ (computed-file (string-append seed "-signing-key.pem")
+ #~(system* #$(file-append gnutls "/bin/certtool")
+ "--generate-privkey"
+ "--key-type=rsa"
+ "--pkcs8"
+ ;; Use the provable FIPS-PUB186-4 algorithm for
+ ;; deterministic results.
+ "--provable"
+ "--password="
+ "--no-text"
+ (string-append "--bits=" #$(number->string size))
+ (string-append "--seed=" #$normalized-seed)
+ "--outfile" #$output)
+ #:local-build? #t))
+
+(define* (make-crx signing-key package #:optional (package-output "out"))
+ "Create a signed \".crx\" file from the unpacked Chromium extension residing
+in PACKAGE-OUTPUT of PACKAGE. The extension will be signed with SIGNING-KEY."
+ (define name (package-name package))
+ (define version (package-version package))
+
+ (with-imported-modules '((guix build utils))
+ (computed-file
+ (string-append name "-" version ".crx")
+ #~(begin
+ ;; This is not great. We pull Xorg and Chromium just to Zip and
+ ;; sign an extension. This should be implemented with something
+ ;; lighter. (TODO: where is the CRXv3 documentation..?)
+ (use-modules (guix build utils))
+ (let ((chromium #$(file-append ungoogled-chromium "/bin/chromium"))
+ (xvfb #$(file-append xorg-server "/bin/Xvfb"))
+ (packdir "/tmp/extension"))
+ (mkdir-p (dirname packdir))
+ (copy-recursively (ungexp package package-output) packdir)
+ (system (string-append xvfb " :1 &"))
+ (setenv "DISPLAY" ":1")
+ (sleep 2) ;give Xorg some time to initialize...
+ ;; Chromium stores the current time in the .crx Zip archive.
+ ;; Use a fixed timestamp for deterministic behavior.
+ ;; FIXME (core-updates): faketime is missing an absolute reference
+ ;; to 'date', hence the need to set PATH.
+ (setenv "PATH" #$(file-append coreutils "/bin"))
+ (invoke #$(file-append libfaketime "/bin/faketime")
+ "2000-01-01 00:00:00"
+ chromium
+ "--user-data-dir=/tmp/signing-profile"
+ (string-append "--pack-extension=" packdir)
+ (string-append "--pack-extension-key=" #$signing-key))
+ (copy-file (string-append packdir ".crx") #$output)))
+ #:local-build? #t)))
+
+(define* (crx->chromium-json crx version)
+ "Return a derivation that creates a Chromium JSON settings file for the
+extension given as CRX. VERSION is used to signify the CRX version, and
+must match the version listed in the extension manifest.json."
+ ;; See chrome/browser/extensions/external_provider_impl.cc and
+ ;; extensions/common/extension.h for documentation on the JSON format.
+ (computed-file "extension.json"
+ #~(call-with-output-file #$output
+ (lambda (port)
+ (format port "{
+ \"external_crx\": \"~a\",
+ \"external_version\": \"~a\"
+}
+"
+ #$crx #$version)))
+ #:local-build? #t))
+
+
+(define (signing-key->public-der key)
+ "Return a derivation for a file containing the public key of KEY in DER
+format."
+ (computed-file "der"
+ #~(system* #$(file-append gnutls "/bin/certtool")
+ "--load-privkey" #$key
+ "--pubkey-info"
+ "--outfile" #$output
+ "--outder")
+ #:local-build? #t))
+
+(define (chromium-json->profile-object json signing-key)
+ "Return a derivation that installs JSON to the directory searched by
+Chromium, using a file name (aka extension ID) derived from SIGNING-KEY."
+ (define der (signing-key->public-der signing-key))
+
+ (with-extensions (list guile-gcrypt)
+ (with-imported-modules '((guix build utils))
+ (computed-file
+ "chromium-extension"
+ #~(begin
+ (use-modules (guix build utils)
+ (gcrypt base16)
+ (gcrypt hash))
+ (define (base16-string->chromium-base16 str)
+ ;; Translate STR, a hexadecimal string, to a Chromium-style
+ ;; representation using the letters a-p (where a=0, p=15).
+ (define s1 "0123456789abcdef")
+ (define s2 "abcdefghijklmnop")
+ (let loop ((chars (string->list str))
+ (converted '()))
+ (if (null? chars)
+ (list->string (reverse converted))
+ (loop (cdr chars)
+ (cons (string-ref s2 (string-index s1 (car chars)))
+ converted)))))
+
+ (let* ((checksum (bytevector->base16-string (file-sha256 #$der)))
+ (file-name (base16-string->chromium-base16
+ (string-take checksum 32)))
+ (extension-directory (string-append #$output
+ "/share/chromium/extensions")))
+ (mkdir-p extension-directory)
+ (symlink #$json (string-append extension-directory "/"
+ file-name ".json"))))
+ #:local-build? #t))))
+
+(define* (make-chromium-extension p #:optional (output "out"))
+ "Create a Chromium extension from package P and return a package that,
+when installed, will make the extension contained in P available as a
+Chromium browser extension. OUTPUT specifies which output of P to use."
+ (let* ((pname (package-name p))
+ (version (package-version p))
+ (signing-key (make-signing-key pname)))
+ (package
+ (inherit p)
+ (name (string-append pname "-chromium"))
+ (source #f)
+ (build-system trivial-build-system)
+ (native-inputs '())
+ (inputs
+ `(("extension" ,(chromium-json->profile-object
+ (crx->chromium-json (make-crx signing-key p output)
+ version)
+ signing-key))))
+ (propagated-inputs '())
+ (outputs '("out"))
+ (arguments
+ '(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (copy-recursively (assoc-ref %build-inputs "extension")
+ (assoc-ref %outputs "out"))))))))
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index f2352c5779..f592d315f5 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -758,11 +758,33 @@ cause them to cross."
dev-constraint))
(no-constraint (constraint-any device))
;; Try to create a partition with an optimal alignment
- ;; constraint. If it fails, fallback to creating a partition with
- ;; no specific constraint.
+ ;; constraint. If it fails, fallback to creating a partition
+ ;; with no specific constraint.
+ (partition-constraint-ok?
+ (disk-add-partition disk partition final-constraint))
+ (partition-no-contraint-ok?
+ (or partition-constraint-ok?
+ (disk-add-partition disk partition no-constraint)))
(partition-ok?
- (or (disk-add-partition disk partition final-constraint)
- (disk-add-partition disk partition no-constraint))))
+ (or partition-constraint-ok? partition-no-contraint-ok?)))
+ (syslog "Creating partition:
+~/type: ~a
+~/filesystem-type: ~a
+~/start: ~a
+~/end: ~a
+~/start-range: [~a, ~a]
+~/end-range: [~a, ~a]
+~/constraint: ~a
+~/no-constraint: ~a
+"
+ partition-type
+ (filesystem-type-name filesystem-type)
+ start-sector*
+ end-sector
+ (geometry-start start-range) (geometry-end start-range)
+ (geometry-start end-range) (geometry-end end-range)
+ partition-constraint-ok?
+ partition-no-contraint-ok?)
;; Set the partition name if supported.
(when (and partition-ok? has-name? name)
(partition-set-name partition name))
diff --git a/gnu/local.mk b/gnu/local.mk
index ac6eeba935..8705a72d53 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -111,6 +111,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/boost.scm \
%D%/packages/bootloaders.scm \
%D%/packages/bootstrap.scm \
+ %D%/packages/browser-extensions.scm \
%D%/packages/build-tools.scm \
%D%/packages/busybox.scm \
%D%/packages/c.scm \
@@ -657,6 +658,7 @@ GNU_SYSTEM_MODULES = \
%D%/build/accounts.scm \
%D%/build/activation.scm \
%D%/build/bootloader.scm \
+ %D%/build/chromium-extension.scm \
%D%/build/cross-toolchain.scm \
%D%/build/image.scm \
%D%/build/file-systems.scm \
@@ -1424,6 +1426,7 @@ dist_patch_DATA = \
%D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \
%D%/packages/patches/ppsspp-disable-upgrade-and-gold.patch \
%D%/packages/patches/samba-fix-fcntl-hint-detection.patch \
+ %D%/packages/patches/sdcc-disable-non-free-code.patch \
%D%/packages/patches/sdl-pango-api_additions.patch \
%D%/packages/patches/sdl-pango-blit_overflow.patch \
%D%/packages/patches/sdl-pango-fillrect_crash.patch \
diff --git a/gnu/packages/ada.scm b/gnu/packages/ada.scm
index e58b0d7754..d24aa2b168 100644
--- a/gnu/packages/ada.scm
+++ b/gnu/packages/ada.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
+;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -24,10 +25,126 @@
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (gnu packages)
+ #:use-module (gnu packages base)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
#:use-module (gnu packages python)
- #:use-module (gnu packages python-xyz))
+ #:use-module (gnu packages python-xyz)
+ #:use-module (ice-9 match))
+
+(define-public ada/ed
+ (package
+ (name "ada-ed")
+ (version "1.11.2")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ ;; The HOME-PAGE sources, mirrored by one of the original authors.
+ (url "https://github.com/daveshields/AdaEd")
+ (commit "57daecfb7ccadfd9aaf13b4d54f51065affbe599")))
+ (sha256
+ (base32 "1k97a8nqsvbsadizrmhhypcx758sxqkai8wq3ckk853qxvzaasd8"))
+ (file-name (git-file-name name version))))
+ (build-system gnu-build-system)
+ (supported-systems (list "i686-linux" "x86_64-linux"
+ "armhf-linux" "aarch64-linux"))
+ (outputs (list "out" "debug"))
+ (arguments
+ `(#:system
+ ,@(match (%current-system)
+ ;; This package predates 64-bit PCs: a ‘64-bit’ adaexec segfaults.
+ ;; Force a 32-bit build targeting a similar architecture.
+ ((or "armhf-linux" "aarch64-linux")
+ `("armhf-linux"))
+ (_
+ `("i686-linux")))
+ #:make-flags
+ (let ((out (assoc-ref %outputs "out")))
+ (list (string-append
+ "CFLAGS=-g" ; compile with :debug symbols
+ " -DOP_SYS='\"GNU\"'" ; sic; quoting gets mangled somewhere
+ " -DSYSTEM_V" ; closest to modern GNU
+ " -DWORDSIZE32"
+ " -DALIGN4") ; suffices on both x86 and ARM
+ "LFLAGS=" ; don't link against -lg
+ (string-append "BINDIR=" out "/bin")
+ (string-append "LIBDIR=" out "/lib")
+ (string-append "MANDIR=" out "/share/man")))
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-26))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-sources
+ (lambda _
+ ;; Rename the custom (and incompatible) getline() implementation.
+ (substitute* "adalex.c"
+ (("getline") "adaed_getline"))
+ ;; Work around ‘error: initializer element is not constant’ by not
+ ;; initialising MSGFILE.
+ (substitute* "vars.ch"
+ (("INIT\\(stdout\\)") ""))
+ #t))
+ (delete 'configure) ; no configure script
+ (add-before 'build 'find-build-scripts
+ (lambda _
+ (setenv "PATH" (string-append ".:" (getenv "PATH")))
+ #t))
+ (add-after 'build 'build-predef
+ (lambda* (#:key make-flags #:allow-other-keys)
+ ;; These aren't otherwise compiled until the ‘install’ phase.
+ (apply invoke "make" "predef" make-flags)
+ #t))
+ (delete 'check) ; no test suite; run our own below
+ (add-before 'install 'create-output-directories
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (mkdir-p (string-append out "/share/man/manl"))
+ #t)))
+ (add-after 'install 'check
+ ;; Run most of the included demos as our own ‘test suite’.
+ (lambda* (#:key outputs tests? #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (when tests?
+ (setenv "ADAED" (string-append out "/lib"))
+ (setenv "PATH" (string-append out "/bin:" (getenv "PATH")))
+ (with-directory-excursion "demos" ; won't run outside of it
+ (for-each
+ delete-file
+ '("runc" ; ‘invalid data. Please make it a positive no.’
+ "rund" ; deadlocks by design
+ "rune" ; ‘dining2.ada: No such file or directory’
+ "rung")) ; ‘mathlib cannot be used as a library’ (!)
+ (for-each (lambda (script)
+ (format #t "\n=== Invoking ~a ===\n" script)
+ (invoke script))
+ (find-files "." "^run")))))))
+ (add-after 'install 'clean-up-output
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (with-directory-excursion out
+ ;; These needn't be executable.
+ (for-each (cut chmod <> #o644)
+ (append (find-files "lib" "\\....$")
+ (find-files "share" ".")))
+ #t)))))))
+ (native-inputs
+ `(("sed" ,sed)))
+ (home-page (string-append "https://web.archive.org/web/20140902150609/"
+ "http://www2.informatik.uni-stuttgart.de/iste/ps/"
+ "ada-software/html/dos_ada.html"))
+ (synopsis "Ada 83 interpreter")
+ (description "Ada/Ed is a translator-interpreter for Ada 83. It's intended
+primarily as a teaching tool and lacks the capacity, performance, and robustness
+of other contemporary or modern-day Ada compilers.
+
+Ada/Ed was the first Ada compiler to pass the @acronym{ACVC, Ada Compiler
+Validation Suite} version 1.7 but fails many newer tests and is not a validated
+Ada system. Being an interpreter, it does not implement most representation
+clauses, and thus does not support systems programming close to the machine
+level.")
+ (license license:gpl2+)))
(define-public python2-langkit
(let ((commit "fe0bc8bf60dbd2937759810df76ac420d99fc15f")
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index 2dca86cbec..56d1d32ec7 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm