summaryrefslogtreecommitdiff
path: root/gnu/system
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/hurd.scm2
-rw-r--r--gnu/system/image.scm100
-rw-r--r--gnu/system/images/hurd.scm89
-rw-r--r--gnu/system/mapped-devices.scm3
-rw-r--r--gnu/system/vm.scm1
5 files changed, 132 insertions, 63 deletions
diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm
index 43d98cc8c2..80fffe8e45 100644
--- a/gnu/system/hurd.scm
+++ b/gnu/system/hurd.scm
@@ -94,7 +94,7 @@
(bootloader (bootloader-configuration
(bootloader grub-minimal-bootloader)
(target "/dev/vda")))
- (initrd (lambda _ '()))
+ (initrd #f)
(initrd-modules (lambda _ '()))
(firmware '())
(host-name "guixygnu")
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index 26ffa028fe..36f56e237d 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -53,10 +53,12 @@
#:use-module (srfi srfi-35)
#:use-module (rnrs bytevectors)
#:use-module (ice-9 match)
- #:export (esp-partition
+ #:export (root-offset
+ root-label
+
+ esp-partition
root-partition
- hurd-disk-image
efi-disk-image
iso9660-image
@@ -94,27 +96,6 @@
(flags '(boot))
(initializer (gexp initialize-root-partition))))
-(define hurd-initialize-root-partition
- #~(lambda* (#:rest args)
- (apply initialize-root-partition
- (append args
- (list #:make-device-nodes
- make-hurd-device-nodes)))))
-
-(define hurd-disk-image
- (image
- (format 'disk-image)
- (target "i586-pc-gnu")
- (partitions
- (list (partition
- (size 'guess)
- (offset root-offset)
- (label root-label)
- (file-system "ext2")
- (file-system-options '("-o" "hurd" "-O" "ext_attr"))
- (flags '(boot))
- (initializer hurd-initialize-root-partition))))))
-
(define efi-disk-image
(image
(format 'disk-image)
@@ -127,9 +108,7 @@
(list (partition
(size 'guess)
(label "GUIX_IMAGE")
- (flags '(boot)))))
- ;; XXX: Temporarily disable compression to speed-up the tests.
- (compression? #f)))
+ (flags '(boot)))))))
;;
@@ -255,18 +234,23 @@ used in the image."
(graph (match inputs
(((names . _) ...)
names)))
- (root-builder
+ (type (partition-file-system partition))
+ (image-builder
(with-imported-modules*
- (let* ((initializer #$(partition-initializer partition)))
+ (let ((initializer #$(partition-initializer partition))
+ (inputs '#+(list e2fsprogs fakeroot dosfstools mtools))
+ (image-root "tmp-root"))
(sql-schema #$schema)
+ (set-path-environment-variable "PATH" '("bin" "sbin") inputs)
+
;; Allow non-ASCII file names--e.g., 'nss-certs'--to be
;; decoded.
(setenv "GUIX_LOCPATH"
#+(file-append glibc-utf8-locales "/lib/locale"))
(setlocale LC_ALL "en_US.utf8")
- (initializer #$output
+ (initializer image-root
#:references-graphs '#$graph
#:deduplicate? #f
#:system-directory #$os
@@ -277,19 +261,12 @@ used in the image."
#+(bootloader-installer bootloader)
#:bootcfg #$bootcfg
#:bootcfg-location
- #$(bootloader-configuration-file bootloader)))))
- (image-root
- (computed-file "partition-image-root" root-builder
- #:options `(#:references-graphs ,inputs)))
- (type (partition-file-system partition))
- (image-builder
- (with-imported-modules*
- (let ((inputs '#+(list e2fsprogs dosfstools mtools)))
- (set-path-environment-variable "PATH" '("bin" "sbin") inputs)
+ #$(bootloader-configuration-file bootloader))
(make-partition-image #$(partition->gexp partition)
#$output
- #$image-root)))))
- (computed-file "partition.img" image-builder)))
+ image-root)))))
+ (computed-file "partition.img" image-builder
+ #:options `(#:references-graphs ,inputs))))
(define (partition->config partition)
;; Return the genimage partition configuration for PARTITION.
@@ -324,7 +301,11 @@ image ~a {
}~%" #$genimage-name #$image-type (list #$@partitions-config))))))))
(computed-file "genimage.cfg" builder)))
- (let* ((substitutable? (image-substitutable? image))
+ (let* ((image-name (image-name image))
+ (name (if image-name
+ (symbol->string image-name)
+ name))
+ (substitutable? (image-substitutable? image))
(builder
(with-imported-modules*
(let ((inputs '#+(list genimage coreutils findutils))
@@ -388,33 +369,31 @@ used in the image. "
(graph (match inputs
(((names . _) ...)
names)))
- (root-builder
- (with-imported-modules*
- (sql-schema #$schema)
-
- ;; Allow non-ASCII file names--e.g., 'nss-certs'--to be decoded.
- (setenv "GUIX_LOCPATH"
- #+(file-append glibc-utf8-locales "/lib/locale"))
- (setlocale LC_ALL "en_US.utf8")
-
- (initialize-root-partition #$output
- #:references-graphs '#$graph
- #:deduplicate? #f
- #:system-directory #$os)))
- (image-root
- (computed-file "image-root" root-builder
- #:options `(#:references-graphs ,inputs)))
(builder
(with-imported-modules*
(let* ((inputs '#$(list parted e2fsprogs dosfstools xorriso
- sed grep coreutils findutils gawk)))
+ sed grep coreutils findutils gawk))
+ (image-root "tmp-root"))
+ (sql-schema #$schema)
+
+ ;; Allow non-ASCII file names--e.g., 'nss-certs'--to be decoded.
+ (setenv "GUIX_LOCPATH"
+ #+(file-append glibc-utf8-locales "/lib/locale"))
+
+ (setlocale LC_ALL "en_US.utf8")
+
(set-path-environment-variable "PATH" '("bin" "sbin") inputs)
+
+ (initialize-root-partition image-root
+ #:references-graphs '#$graph
+ #:deduplicate? #f
+ #:system-directory #$os)
(make-iso9660-image #$xorriso
'#$grub-mkrescue-environment
#$bootloader
#$bootcfg
#$os
- #$image-root
+ image-root
#$output
#:references-graphs '#$graph
#:register-closures? #$register-closures?
@@ -569,7 +548,8 @@ addition of the <image> record."
(_ (cond
((and target
(hurd-triplet? target))
- hurd-disk-image)
+ (module-ref (resolve-interface '(gnu system images hurd))
+ 'hurd-disk-image))
(else
efi-disk-image)))))
diff --git a/gnu/system/images/hurd.scm b/gnu/system/images/hurd.scm
new file mode 100644
index 0000000000..d87640e8e3
--- /dev/null
+++ b/gnu/system/images/hurd.scm
@@ -0,0 +1,89 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@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 system images hurd)
+ #:use-module (guix gexp)
+ #:use-module (gnu bootloader)
+ #:use-module (gnu bootloader grub)
+ #:use-module (gnu image)
+ #:use-module (gnu packages ssh)
+ #:use-module (gnu services)
+ #:use-module (gnu services ssh)
+ #:use-module (gnu system)
+ #:use-module (gnu system file-systems)
+ #:use-module (gnu system hurd)
+ #:use-module (gnu system image)
+ #:export (hurd-barebones-os
+ hurd-disk-image
+ hurd-barebones-disk-image))
+
+(define hurd-barebones-os
+ (operating-system
+ (inherit %hurd-default-operating-system)
+ (bootloader (bootloader-configuration
+ (bootloader grub-minimal-bootloader)
+ (target "/dev/sdX")))
+ (file-systems (cons (file-system
+ (device (file-system-label "my-root"))
+ (mount-point "/")
+ (type "ext2"))
+ %base-file-systems))
+ (host-name "guixygnu")
+ (timezone "Europe/Amsterdam")
+ (packages (cons openssh-sans-x %base-packages/hurd))
+ (services (cons (service openssh-service-type
+ (openssh-configuration
+ (openssh openssh-sans-x)
+ (use-pam? #f)
+ (port-number 2222)
+ (permit-root-login #t)
+ (allow-empty-passwords? #t)
+ (password-authentication? #t)))
+ %base-services/hurd))))
+
+(define hurd-initialize-root-partition
+ #~(lambda* (#:rest args)
+ (apply initialize-root-partition
+ (append args
+ (list #:make-device-nodes make-hurd-device-nodes
+ ;; XXX Creating a db.sqlite with journal_mode=WAL
+ ;; yields "unable to open database file" on GNU/Hurd
+ ;; for an sqlite with the hurd-locking-mode.patch;
+ ;; see <https://bugs.gnu.org/42151>.
+ #:wal-mode? #f)))))
+
+(define hurd-disk-image
+ (image
+ (format 'disk-image)
+ (target "i586-pc-gnu")
+ (partitions
+ (list (partition
+ (size 'guess)
+ (offset root-offset)
+ (label root-label)
+ (file-system "ext2")
+ (file-system-options '("-o" "hurd" "-O" "ext_attr"))
+ (flags '(boot))
+ (initializer hurd-initialize-root-partition))))))
+
+(define hurd-barebones-disk-image
+ (image
+ (inherit hurd-disk-image)
+ (name 'hurd-barebones-disk-image)
+ (operating-system hurd-barebones-os)))
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index 7c58f876a3..c3f98302ad 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2017, 2018 Mark H Weaver <mhw@netris.org>
;;;
@@ -40,6 +40,7 @@
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (ice-9 match)
+ #:use-module (ice-9 format)
#:export (mapped-device
mapped-device?
mapped-device-source
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index f2b6b71b4d..861f2a427a 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -819,7 +819,6 @@ with '-virtfs' options for the host file systems listed in SHARED-FS."
'())
"-no-reboot"
- "-nic" "user,model=virtio-net-pci"
"-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng"
"-device" "virtio-rng-pci,rng=guixsd-vm-rng"