From 2576c66e4725d6829e602c15f8f95861a36fe383 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Mon, 1 Dec 2025 08:00:00 +0100 Subject: image: operating-system-for-image: Support AArch64 iso. Let the user decide for grub/grub-efi in cases where grub-hybrid is unsupported. This is the case on aarch64, where grub-pc is not supported, so only grub-efi can be used. * gnu/system/image.scm (operating-system-for-image): Do not replace bootloader with grub-mkrescue-bootloader for iso9660 when grub-hybrid is not supported. Change-Id: Icd2b68155935b1d9599c1b0df22f0c80a2e36d6a Signed-off-by: Rutherther --- gnu/system/image.scm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'gnu') diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 0101fe3d6e..9e9b7cbba4 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -985,11 +985,16 @@ it can be used for bootloading." file-systems #:volatile-root? volatile-root? rest))) - (bootloader (if (eq? format 'iso9660) + ;; Only replace with grub-mkrescue-bootloader if grub-pc + ;; is supported. AArch64 doesn't support it. In such + ;; cases, respect bootloader of the system. Still, + ;; for now make-iso9660-image installs only GRUB. + (bootloader (if (and (eq? format 'iso9660) + (supported-package? grub-hybrid)) (bootloader-configuration - (inherit - (operating-system-bootloader base-os)) - (bootloader grub-mkrescue-bootloader)) + (inherit + (operating-system-bootloader base-os)) + (bootloader grub-mkrescue-bootloader)) (operating-system-bootloader base-os))) (file-systems (cons (file-system (mount-point "/") -- cgit v1.3 From 20157dae27d3ed2c754a5c15aa001f6c268366c3 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Mon, 1 Dec 2025 08:02:24 +0100 Subject: image: Add qcow2-gpt image type. qcow2 is a mbr-hybrid image. But on aarch64, we have to use grub-efi bootloader. For that bootloader, gpt should be used and Guix errors if it isn't (due to failed check in Guix code). So it's impossible to generate qcow2 type aarch64 image without using customized bootloader. One would have to define their own image instead of using the ones pre-defined. * gnu/system/system.scm (qcow2-gpt-image-type): New variable. * doc/guix.texi: Document qcow2-gpt and its use. Change-Id: I93f0880c7ca2d3f934067c12dd1143ad20828333 Signed-off-by: Rutherther --- doc/guix.texi | 17 +++++++++++++++-- gnu/system/image.scm | 11 +++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'gnu') diff --git a/doc/guix.texi b/doc/guix.texi index fc25b653f3..55d3af1642 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -47841,7 +47841,9 @@ machine. The @code{grub-bootloader} bootloader is always used independently of what is declared in the @code{operating-system} file passed as argument. This is to make it easier to work with QEMU, which uses the SeaBIOS BIOS by default, expecting a bootloader to be installed -in the Master Boot Record (MBR). +in the Master Boot Record (MBR). In case the virtual machine is +going to be AArch64, you might want to take a look at @code{qcow2-gpt} +image type that installs bootloader only in EFI. @cindex docker-image, creating docker images When using the @code{docker} image type, a Docker image is produced. @@ -54765,7 +54767,18 @@ Build an image based on the @code{efi32-disk-image} image. @defvar qcow2-image-type Build an image based on the @code{mbr-disk-image} image but with the -@code{compressed-qcow2} image format. +@code{compressed-qcow2} image format. The resulting image will have +an MBR embedded bootloader as well as an EFI bootloader. This image +is not suitable for architectures that do not support `grub-pc`, +such as AArch64. See @code{qcow2-gpt-image-type} for an alternative. +@end defvar + +@defvar qcow2-gpt-image-type +Build an image based on the @code{efi-disk-image} image but with the +@code{compressed-qcow2} image format. The resulting image will have +only EFI bootloader, unlike @code{qcow2-image-type}. This image +is suitable for architectures that do not support `grub-pc`, such +as AArch64. @end defvar @defvar iso-image-type diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 9e9b7cbba4..de975360ae 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -98,6 +98,7 @@ efi-raw-image-type efi32-raw-image-type qcow2-image-type + qcow2-gpt-image-type iso-image-type uncompressed-iso-image-type docker-image-type @@ -265,6 +266,16 @@ set to the given OS." (format 'compressed-qcow2)) <>)))) +(define qcow2-gpt-image-type + (image-type + (name 'qcow2-gpt) + (constructor (cut image-with-os + (image + (inherit efi-disk-image) + (name 'image.qcow2) + (format 'compressed-qcow2)) + <>)))) + (define iso-image-type (image-type (name 'iso9660) -- cgit v1.3 From efc32c6684f75531cfd600874ba5d23a0bd643b9 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Thu, 18 Dec 2025 19:10:02 +0100 Subject: image: Add /boot/efi filesystem if operating-system specifies it. Instead of forgetting about the /boot/efi system completely, re-add it with proper label. This way lightweight.tmpl, desktop.tmpl still boot when supplied to guix system image. That was the reason for removing /boot/efi file-system in the first place. Removing it however means the target system cannot be reconfigured by default, as the esp is not mounted. * gnu/system/image.scm (partition-has-flag?): New variable. (root-partition?): Use it. (find-partition-with-flag): New variable. (find-root-partition): Use it. (find-esp-partition): New variable. (operating-system-for-image): Add /boot/efi file-system with proper label instead of removing it completely. Change-Id: I3ef2120059d8bbf76170d10ae718cb0de637f453 Signed-off-by: Rutherther --- gnu/system/image.scm | 57 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 15 deletions(-) (limited to 'gnu') diff --git a/gnu/system/image.scm b/gnu/system/image.scm index de975360ae..df7fa2c390 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -363,16 +363,27 @@ set to the given OS." (guix build utils)) gexp* ...)))) +(define (partition-has-flag? partition flag) + "Return true if PARTITION's flags include FLAG." + (member flag (partition-flags partition))) + +(define (find-partition-with-flag image flag) + "Return partition of the given IMAGE that has FLAG, or #f if not found." + (srfi-1:find (cut partition-has-flag? <> flag) + (image-partitions image))) + (define (root-partition? partition) "Return true if PARTITION is the root partition, false otherwise." - (member 'boot (partition-flags partition))) + (partition-has-flag? partition 'boot)) (define (find-root-partition image) - "Return the root partition of the given IMAGE." - (or (srfi-1:find root-partition? (image-partitions image)) + (or (find-partition-with-flag image 'boot) (raise (formatted-message (G_ "image lacks a partition with the 'boot' flag"))))) +(define (find-esp-partition image) + (find-partition-with-flag image 'esp)) + (define (root-partition-index image) "Return the index of the root partition of the given IMAGE." (1+ (srfi-1:list-index root-partition? (image-partitions image)))) @@ -980,6 +991,19 @@ it can be used for bootloading." (let* ((root-file-system-type (image->root-file-system image)) (base-os (image-operating-system image)) + (esp-partition (find-esp-partition image)) + ;; In case the user has added /boot/efi file-system, + ;; try to respect it and add a file-system pointing + ;; to the correct esp. + (wants-boot-efi? (and + (srfi-1:any + (lambda (fs) + (let ((mount-point (file-system-mount-point fs))) + (string=? mount-point "/boot/efi"))) + (operating-system-file-systems base-os)) + esp-partition)) + ;; Replace root file system with one with proper UUID that the + ;; target image will have. Similarly for /boot/efi. (file-systems-to-keep (srfi-1:remove (lambda (fs) @@ -1006,19 +1030,22 @@ it can be used for bootloading." (inherit (operating-system-bootloader base-os)) (bootloader grub-mkrescue-bootloader)) - (operating-system-bootloader base-os))) - (file-systems (cons (file-system - (mount-point "/") - (device "/dev/placeholder") - (type root-file-system-type)) - file-systems-to-keep)))) + (operating-system-bootloader base-os))))) (uuid (root-uuid os))) - (operating-system - (inherit os) - (file-systems (cons (file-system - (mount-point "/") - (device uuid) - (type root-file-system-type)) + (operating-system + (inherit os) + (file-systems (append + (list (file-system + (mount-point "/") + (device uuid) + (type root-file-system-type))) + (if wants-boot-efi? + (list (file-system + (mount-point "/boot/efi") + (type "vfat") + (device (file-system-label + (partition-label esp-partition))))) + '()) file-systems-to-keep))))) (define* (system-image image) -- cgit v1.3 From 5623e6331342c232a6816073bae9e3d9928ac884 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Mon, 1 Dec 2025 08:15:13 +0100 Subject: system: installation-os: Support efi-only. Aarch64 doesn't support grub-pc, so we cannot use the regular grub-bootloader, grub-efi-bootloader has to be used. Since neither packages nor bootloader are thunked, there seems to be no other choice than using something from the outside environment, such as an environment variable to decide what bootloader to use. For convenience, a procedure is made to be used from other Guile code, instead of relying on environment variables. * gnu/system/install.scm (make-installation-os): New variable; Use grub-efi-bootloader when efi-only? is #t; Use bootloader package in packages instead of grub-pc. (installation-os): Replace with call of make-installation-os with default arguments. Change-Id: I34ec8da6079617f39805b3e1168bad4a42d84cab Signed-off-by: Rutherther --- gnu/installer.scm | 4 +- gnu/system/install.scm | 139 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 94 insertions(+), 49 deletions(-) (limited to 'gnu') diff --git a/gnu/installer.scm b/gnu/installer.scm index 4acad60f21..d905ffa795 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -374,7 +374,7 @@ purposes." `(channel ,(channel-name channel) ,url ,(channel-commit channel)))) channels)))) -(define* (installer-program #:key dry-run?) +(define* (installer-program #:key dry-run? (guix-for-installer (current-guix))) "Return a file-like object that runs the given INSTALLER." (define init-gettext ;; Initialize gettext support, so that installer messages can be @@ -423,7 +423,7 @@ purposes." guile-gnutls guile-zlib ;for (gnu build linux-modules) guile-zstd ;for (gnu build linux-modules) - (current-guix)) + guix-for-installer) (with-imported-modules `(,@(source-module-closure `(,@modules (gnu services herd) diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 5041dadf15..06fed8cae9 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -28,6 +28,7 @@ #:use-module (gnu) #:use-module (gnu system) #:use-module (gnu system privilege) + #:use-module (gnu bootloader) #:use-module (gnu bootloader u-boot) #:use-module (guix gexp) #:use-module (guix store) @@ -64,6 +65,7 @@ #:use-module (gnu packages xorg) #:use-module (ice-9 match) #:export (installation-os + make-installation-os a20-olinuxino-lime-installation-os a20-olinuxino-lime2-emmc-installation-os a20-olinuxino-micro-installation-os @@ -334,10 +336,29 @@ templates under @file{/etc/configuration}."))) "Load the @code{uvesafb} kernel module with the right options.") (default-value #t))) -(define* (%installation-services #:key (system (or (and=> - (%current-target-system) - platform-target->system) - (%current-system)))) +(define (guix-package-commit guix) + ;; Extract the commit of the GUIX package. + (match (package-source guix) + ((? channel? source) + (channel-commit source)) + (_ + (apply (lambda* (#:key commit #:allow-other-keys) commit) + (package-arguments guix))))) + +(define* (%installation-services + #:key + (system (or (and=> + (%current-target-system) + platform-target->system) + (%current-system))) + (guix-for-system + (let ((guix (current-guix))) + (package + (inherit guix) + ;; Do not leak the local checkout URL. + (source (channel + (inherit %default-guix-channel) + (commit (guix-package-commit guix)))))))) ;; List of services of the installation system. (let ((motd (plain-file "motd" " \x1b[1;37mWelcome to the installation of GNU Guix!\x1b[0m @@ -355,15 +376,6 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m (define bare-bones-os (load "examples/bare-bones.tmpl")) - (define (guix-package-commit guix) - ;; Extract the commit of the GUIX package. - (match (package-source guix) - ((? channel? source) - (channel-commit source)) - (_ - (apply (lambda* (#:key commit #:allow-other-keys) commit) - (package-arguments guix))))) - (append ;; Generic services (list (service virtual-terminal-service-type) @@ -371,7 +383,8 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m (service kmscon-service-type (kmscon-configuration (virtual-terminal "tty1") - (login-program (installer-program)))) + (login-program (installer-program + #:guix-for-installer guix-for-system)))) (service login-service-type (login-configuration @@ -408,13 +421,7 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m ;; Install and run the current Guix rather than an older ;; snapshot. - (guix (let ((guix (current-guix))) - (package - (inherit guix) - ;; Do not leak the local checkout URL. - (source (channel - (inherit %default-guix-channel) - (commit (guix-package-commit guix))))))))) + (guix guix-for-system))) ;; Start udev so that useful device nodes are available. ;; Use device-mapper rules for cryptsetup & co; enable the CRDA for @@ -525,19 +532,52 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m jfsutils xfsprogs)) -(define installation-os +(define* (%installation-initrd-modules + #:key + (system (or (and=> + (%current-target-system) + platform-target->system) + (%current-system)))) + ;; AArch64 currently lacks a lot of modules necessary + ;; for booting from USB sticks, hard disks or + ;; CDROMs. Those are built-in in x86_64 kernel. + `(,@(if (target-aarch64? system) + '("sr_mod" "sd_mod" + "usb_common" "usbcore" + ;; USB 3.0 + "xhci_pci" "xhci_hcd" + ;; embedded USB 3.0 + "xhci_plat_hcd" + ;; USB 2.0 + "ehci_pci" "ehci_hcd") + '()) + ,@%base-initrd-modules)) + +(define* (make-installation-os #:key + ;; Version displayed in the GRUB entry name. + (grub-displayed-version + (package-version guix)) + ;; Whether to use efi-only installation. + ;; When #f, use hybrid grub that sets up + ;; both legacy boot and efi. + (efi-only? #f)) ;; The operating system used on installation images for USB sticks etc. (operating-system (host-name "gnu") (timezone "Europe/Paris") (locale "en_US.utf8") (name-service-switch %mdns-host-lookup-nss) - (bootloader (bootloader-configuration - (bootloader grub-bootloader) - (targets '("/dev/sda")))) - (label (string-append "GNU Guix installation " - (or (getenv "GUIX_DISPLAYED_VERSION") - (package-version guix)))) + + (initrd-modules (%installation-initrd-modules)) + + (bootloader (if efi-only? + (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets '("/boot/efi"))) + (bootloader-configuration + (bootloader grub-bootloader) + (targets '("/dev/sda"))))) + (label (string-append "GNU Guix installation " grub-displayed-version)) ;; XXX: The AMD Radeon driver is reportedly broken, which makes kmscon ;; non-functional: @@ -550,19 +590,19 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m ;; the appropriate one. (append %base-live-file-systems - ;; XXX: This should be %BASE-FILE-SYSTEMS but we don't need - ;; elogind's cgroup file systems. - (list %pseudo-terminal-file-system - %shared-memory-file-system - %efivars-file-system - %immutable-store))) + ;; XXX: This should be %BASE-FILE-SYSTEMS but we don't need + ;; elogind's cgroup file systems. + (list %pseudo-terminal-file-system + %shared-memory-file-system + %efivars-file-system + %immutable-store))) (users (list (user-account - (name "guest") - (group "users") - (supplementary-groups '("wheel")) ; allow use of sudo - (password "") - (comment "Guest of GNU")))) + (name "guest") + (group "users") + (supplementary-groups '("wheel")) ; allow use of sudo + (password "") + (comment "Guest of GNU")))) (issue %issue) (services (%installation-services)) @@ -570,20 +610,25 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m ;; We don't need setuid programs, except for 'passwd', which can be handy ;; if one is to allow remote SSH login to the machine being installed. (privileged-programs (list (privileged-program - (program (file-append shadow "/bin/passwd")) - (setuid? #t)))) + (program (file-append shadow "/bin/passwd")) + (setuid? #t)))) (pam-services ;; Explicitly allow for empty passwords. (base-pam-services #:allow-empty-passwords? #t)) (packages (append - (list glibc ; for 'tzselect' & co. - fontconfig - font-dejavu font-gnu-unifont - grub) ; mostly so xrefs to its manual work - %installer-disk-utilities - %base-packages)))) + (list glibc ; for 'tzselect' & co. + fontconfig + font-dejavu font-gnu-unifont + + ;; Mostly so xrefs to its manual work. + (bootloader-package + (bootloader-configuration-bootloader bootloader))) + %installer-disk-utilities + %base-packages)))) + +(define installation-os (make-installation-os)) (define* (os-with-u-boot os board #:key (bootloader-target "/dev/mmcblk0") (triplet "arm-linux-gnueabihf")) -- cgit v1.3 From 08016049908b732c1b26922fe47bd3c2755100f6 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Mon, 1 Dec 2025 19:39:53 +0100 Subject: gnu: make-iso9660-image: Do not compress any kernel, compress man pages. Because the linux image is called differently based on the architectures, see system-linu/-image-file-name from gnu/system.scm, the kernel image on aarch64, mips and armhf has still been compressed. This means that grub cannot boot. Man pages have moved from gz to zst, so compress them as well. * gnu/build/image.scm (make-iso9660-image): Do not compress Image, vmlinuz and zImage; Compress all man pages. Change-Id: I68b35f383c84ff231865d580aa9e79d9fd88ace1 Signed-off-by: Rutherther --- gnu/build/image.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gnu') diff --git a/gnu/build/image.scm b/gnu/build/image.scm index d68fb29e05..53c75839ba 100644 --- a/gnu/build/image.scm +++ b/gnu/build/image.scm @@ -428,7 +428,11 @@ GRUB configuration and OS-DRV as the stuff in it." "-not" "-wholename" "/System/*" "-not" "-name" "unicode.pf2" "-not" "-name" "bzImage" - "-not" "-name" "*.gz" ; initrd & all man pages + "-not" "-name" "zImage" + "-not" "-name" "Image" + "-not" "-name" "vmlinuz" + "-not" "-name" "*.gz" ; initrd + "-not" "-name" "*.zst" ; all man pages "-not" "-name" "*.png" ; includes grub-image.png "-exec" "set_filter" "--zisofs" "--") -- cgit v1.3 From 9e7e40b8bd1410dfcad6cbface22b1c31e665401 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Mon, 22 Dec 2025 09:10:41 +0100 Subject: services: xorg: Return only supported packages in %default-xorg-modules. The xorg modules are used inside of services that's thunked. So we can make them depend on the %current-system. * gnu/services/xorg.scm (default-xorg-modules): New variable. (%default-xorg-modules): Return result of (default-xorg-modules). Change-Id: I10f722e52d598ce3e83ef3f200b3bd953bc08e17 Signed-off-by: Rutherther --- etc/manifests/cross-compile.scm | 14 +++++++----- gnu/services/xorg.scm | 50 +++++++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 24 deletions(-) (limited to 'gnu') diff --git a/etc/manifests/cross-compile.scm b/etc/manifests/cross-compile.scm index 44a6407b0c..776da581cf 100644 --- a/etc/manifests/cross-compile.scm +++ b/etc/manifests/cross-compile.scm @@ -71,18 +71,21 @@ TARGET." "connman" "network-manager" "wpa-supplicant" "isc-dhcp" "cups" "linux-libre" "grub-hybrid"))) -(define %system-gui-packages +(define (%system-gui-packages target) ;; Key packages proposed by the Guix System installer. (append (map specification->package '(;; build system `python' does not support cross builds - ;"gnome" "xfce" "mate" "openbox" + ;"gnome" "xfce" "mate" "openbox" "awesome" "i3-wm" "i3status" "dmenu" "st" "ratpoison" "xterm" ;; build system `emacs' does not support cross builds - ;"emacs-exwm" "emacs-desktop-environment" + ;"emacs-exwm" "emacs-desktop-environment" "emacs")) - %default-xorg-modules)) + ;; NOTE: %default-xorg-modules depends on system. + (parameterize + ((%current-target-system target)) + %default-xorg-modules))) (define %packages-to-cross-build ;; Packages that must be cross-buildable from x86_64-linux. @@ -151,7 +154,8 @@ TARGET." ;; With a graphical environment: (if (or (target-x86-32? target) (target-aarch64? target)) - %system-gui-packages + ;; %system-gui-packages depends on the system. + (%system-gui-packages target) '())))) (fold delete (map platform-system->target (systems)) '(;; Disable cross-compilation to self: diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index b32a960bcf..25f44566be 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -64,6 +64,7 @@ #:use-module ((guix modules) #:select (source-module-closure)) #:use-module (guix packages) #:use-module (guix derivations) + #:use-module (guix platform) #:use-module (guix records) #:use-module (guix deprecation) #:use-module (guix utils) @@ -148,25 +149,36 @@ ;;; ;;; Code: -(define %default-xorg-modules - ;; Default list of modules loaded by the server. When multiple drivers - ;; match, the first one in the list is loaded. - (list xf86-video-vesa - xf86-video-fbdev - xf86-video-amdgpu - xf86-video-ati - xf86-video-cirrus - xf86-video-intel - xf86-video-mach64 - xf86-video-nouveau - xf86-video-nv - xf86-video-sis - - ;; Libinput is the new thing and is recommended over evdev/synaptics: - ;; . - xf86-input-libinput - xf86-input-evdev - xf86-input-mouse)) +(define* (default-xorg-modules + #:optional + (system (or (and=> + (%current-target-system) + platform-target->system) + (%current-system)))) + "Default list of modules loaded by the server. When multiple drivers match, +the first one in the list is loaded." + ;; Return only supported packages, because some aren't supported + ;; on all architectures. + (filter (cut supported-package? <> system) + (list xf86-video-vesa + xf86-video-fbdev + xf86-video-amdgpu + xf86-video-ati + xf86-video-cirrus + xf86-video-intel + xf86-video-mach64 + xf86-video-nouveau + xf86-video-nv + xf86-video-sis + + ;; Libinput is the new thing and is recommended over evdev/synaptics: + ;; . + xf86-input-libinput + xf86-input-evdev + xf86-input-mouse))) + +(define-syntax %default-xorg-modules + (identifier-syntax (default-xorg-modules))) (define %default-xorg-fonts ;; Default list of fonts available to the X server. -- cgit v1.3 From b7a12230525bb0a0481279d7d7c4447f8d01bf13 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Mon, 1 Dec 2025 08:09:03 +0100 Subject: system: vm-image-efi.tmpl: Add example efi vm image. This is a copy of vm-image.tmpl, but with efi bootloader. Since user ends up with this config in their /run/current-user/configuration.scm and the regular way to continue is to copy that file and reconfigure off of it, it seems better to just keep distinct configuration. Moreover xf86-video-intel is removed, because it doesn't compile on aarch64. * gnu/system/examples/vm-image-efi.tmpl Change-Id: I0f72ac5a775339ee84cb1a4046ca5a8deca0e2ea Signed-off-by: Rutherther --- gnu/system/examples/vm-image-efi.tmpl | 161 ++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 gnu/system/examples/vm-image-efi.tmpl (limited to 'gnu') diff --git a/gnu/system/examples/vm-image-efi.tmpl b/gnu/system/examples/vm-image-efi.tmpl new file mode 100644 index 0000000000..1bde66c2dd --- /dev/null +++ b/gnu/system/examples/vm-image-efi.tmpl @@ -0,0 +1,161 @@ +;; -*- mode: scheme; -*- +;; This is an operating system configuration for a VM image. +;; Modify it as you see fit and instantiate the changes by running: +;; +;; guix system reconfigure /etc/config.scm +;; + +(use-modules (gnu) + (guix) + (srfi srfi-1) + (ice-9 match) + (guix channels) + (gnu system image)) +(use-service-modules desktop mcron networking spice ssh xorg sddm) +(use-package-modules bootloaders fonts + package-management xdisorg xorg) + +(define vm-image-motd (plain-file "motd" " +\x1b[1;37mThis is the GNU system. Welcome!\x1b[0m + +This instance of Guix is a template for virtualized environments. +You can reconfigure the whole system by adjusting /etc/config.scm +and running: + + guix system reconfigure /etc/config.scm + +Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation. + +\x1b[1;33mConsider setting a password for the 'root' and 'guest' \ +accounts.\x1b[0m +")) + +(define (guix-package-commit guix) + ;; Extract the commit of the GUIX package. + (match (package-source guix) + ((? channel? source) + (channel-commit source)) + (_ + (apply (lambda* (#:key commit #:allow-other-keys) commit) + (package-arguments guix))))) + +(operating-system + (host-name "gnu") + (timezone "Etc/UTC") + (locale "en_US.utf8") + (keyboard-layout (keyboard-layout "us" "altgr-intl")) + + ;; Label for the GRUB boot menu. + (label (string-append "GNU Guix " + (or (getenv "GUIX_DISPLAYED_VERSION") + (package-version guix)))) + + (firmware '()) + + ;; On AArch64, support SCSI CDROMs and HDs. + (initrd-modules (cons* "sd_mod" "sr_mod" + %base-initrd-modules)) + + (bootloader + (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets '("/boot/efi")) + (terminal-outputs '(console)))) + (file-systems (cons* (file-system + (mount-point "/") + (device (file-system-label root-label)) + (type "ext4")) + (file-system + (mount-point "/boot/efi") + (device (file-system-label "GNU-ESP")) + (type "vfat")) + %base-file-systems)) + + (users (cons (user-account + (name "guest") + (comment "GNU Guix Live") + (password "") ;no password + (group "users") + (supplementary-groups '("wheel" "netdev" + "audio" "video"))) + %base-user-accounts)) + + ;; Our /etc/sudoers file. Since 'guest' initially has an empty password, + ;; allow for password-less sudo. + (sudoers-file (plain-file "sudoers" "\ +root ALL=(ALL) ALL +%wheel ALL=NOPASSWD: ALL\n")) + + (pam-services + ;; Explicitly allow for empty passwords. + (base-pam-services #:allow-empty-passwords? #t)) + + (packages + (append (list font-bitstream-vera + ;; Auto-started script providing SPICE dynamic resizing for + ;; Xfce (see: + ;; https://gitlab.xfce.org/xfce/xfce4-settings/-/issues/142). + x-resize) + %base-packages)) + + (services + (append (list (service xfce-desktop-service-type) + + ;; Choose SLiM, which is lighter than the default GDM. + (service slim-service-type + (slim-configuration + (auto-login? #t) + (default-user "guest") + (xorg-configuration + (xorg-configuration + ;; The QXL virtual GPU driver is added to provide + ;; a better SPICE experience. + (modules (cons xf86-video-qxl + %default-xorg-modules)) + (keyboard-layout keyboard-layout))))) + + ;; Uncomment the line below to add an SSH server. + ;;(service openssh-service-type) + + ;; Add support for the SPICE protocol, which enables dynamic + ;; resizing of the guest screen resolution, clipboard + ;; integration with the host, etc. + (service spice-vdagent-service-type) + + ;; Use the DHCP client service rather than NetworkManager. + (service dhcpcd-service-type)) + + ;; Remove some services that don't make sense in a VM. + (remove (lambda (service) + (let ((type (service-kind service))) + (or (memq type + (list gdm-service-type + sddm-service-type + wpa-supplicant-service-type + cups-pk-helper-service-type + network-manager-service-type + modem-manager-service-type)) + (eq? 'network-manager-applet + (service-type-name type))))) + (modify-services %desktop-services + (login-service-type config => + (login-configuration + (inherit config) + (motd vm-image-motd))) + + ;; Install and run the current Guix rather than an older + ;; snapshot. + (guix-service-type config => + (guix-configuration + (inherit config) + (guix + (let ((guix (current-guix))) + (package + (inherit guix) + ;; Do not leak the local checkout URL. + (source (channel + (inherit %default-guix-channel) + (commit (guix-package-commit guix))))))))))))) + + ;; Allow resolution of '.local' host names with mDNS. + (name-service-switch %mdns-host-lookup-nss)) -- cgit v1.3 From 8ba84edf997a95726d2aa452b0c3e33e6c8a1262 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Mon, 15 Dec 2025 20:53:46 +0100 Subject: linux-initrd: Support more virtio modules in initrd. Adds mmio and scsi modules for virtio. scsi one is needed for using virtio-scsi-pci, that can be a common option on aarch64, where only two options pop up for mounting disks: - virtio-scsi-pci - virtio-blk While virtio-blk should generally be preferred, sometimes virtio-scsi-pci pops up first on the internet, so people can use it. virtio-mmio is a necessity on Aarch64 for virtio-blk to work. * gnu/system/linux-initrd.scm (default-initrd-modules): Add virtio_mmio and virito_scsi. Change-Id: Ia8fabb5594893ef1712359d27d482d9f44dc89c0 Signed-off-by: Rutherther --- gnu/system/linux-initrd.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu') diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index febfda5778..329ded9f0b 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -366,7 +366,7 @@ FILE-SYSTEMS." (define virtio-modules ;; Modules for Linux para-virtualized devices, for use in QEMU guests. '("virtio_pci" "virtio_balloon" "virtio_blk" "virtio_net" - "virtio_console" "virtio-rng")) + "virtio_console" "virtio-rng" "virtio_mmio" "virtio_scsi")) `("ahci" ;for SATA controllers "usb-storage" "uas" ;for the installation image etc. -- cgit v1.3 From d226cc49339df6c2c13fdb9c2149051f418212ee Mon Sep 17 00:00:00 2001 From: Rutherther Date: Tue, 16 Dec 2025 12:12:37 +0100 Subject: image: system-iso9660-image: Propagate image-name to derivation name. * gnu/system/image.scm (system-iso9660-image): Use name from image-name instead of hardcoded image.iso. Change-Id: I3cea3857729c2eb7d6728f650db7fb33cf4c8c8a Signed-off-by: Rutherther --- gnu/system/image.scm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gnu') diff --git a/gnu/system/image.scm b/gnu/system/image.scm index df7fa2c390..7be6a79688 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -674,6 +674,10 @@ used in the image. " (uuid-bytevector (partition-uuid partition))))) (let* ((os (image-operating-system image)) + (image-name (image-name image)) + (name (if image-name + (symbol->string image-name) + name)) (bootloader (bootloader-package bootloader)) (compression? (image-compression? image)) (substitutable? (image-substitutable? image)) -- cgit v1.3 From 105dbf7deec8599b2175bb3a6798ce726ece0154 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Tue, 16 Dec 2025 12:15:12 +0100 Subject: vm-image.tmpl: Remove current-guix url override. This simplifies things thanks to the release artifacts now, they have been rewritten to Guile and can now supply current-guix-package as a parameter, as was intended. That way the checkout is not leaked for the release artifacts. * gnu/system/examples/vm-image.tmpl (guix-package-commit): Remove variable. (operating-system): Use (current-guix) directly. * gnu/system/examples/vm-image-efi.tmpl: Likewise. Change-Id: Iabf1bb5bbb86b9984bfb87ba0543782a6dce3192 Signed-off-by: Rutherther --- gnu/system/examples/vm-image-efi.tmpl | 18 +----------------- gnu/system/examples/vm-image.tmpl | 19 ++----------------- 2 files changed, 3 insertions(+), 34 deletions(-) (limited to 'gnu') diff --git a/gnu/system/examples/vm-image-efi.tmpl b/gnu/system/examples/vm-image-efi.tmpl index 1bde66c2dd..d264b27a5f 100644 --- a/gnu/system/examples/vm-image-efi.tmpl +++ b/gnu/system/examples/vm-image-efi.tmpl @@ -30,15 +30,6 @@ Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation. accounts.\x1b[0m ")) -(define (guix-package-commit guix) - ;; Extract the commit of the GUIX package. - (match (package-source guix) - ((? channel? source) - (channel-commit source)) - (_ - (apply (lambda* (#:key commit #:allow-other-keys) commit) - (package-arguments guix))))) - (operating-system (host-name "gnu") (timezone "Etc/UTC") @@ -148,14 +139,7 @@ root ALL=(ALL) ALL (guix-service-type config => (guix-configuration (inherit config) - (guix - (let ((guix (current-guix))) - (package - (inherit guix) - ;; Do not leak the local checkout URL. - (source (channel - (inherit %default-guix-channel) - (commit (guix-package-commit guix))))))))))))) + (guix (current-guix)))))))) ;; Allow resolution of '.local' host names with mDNS. (name-service-switch %mdns-host-lookup-nss)) diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl index f7c27d23db..2a0e9e21c8 100644 --- a/gnu/system/examples/vm-image.tmpl +++ b/gnu/system/examples/vm-image.tmpl @@ -10,6 +10,7 @@ (srfi srfi-1) (ice-9 match) (guix channels) + (gnu packages package-management) (gnu system image)) (use-service-modules desktop mcron networking spice ssh xorg sddm) (use-package-modules bootloaders fonts @@ -30,15 +31,6 @@ Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation. accounts.\x1b[0m ")) -(define (guix-package-commit guix) - ;; Extract the commit of the GUIX package. - (match (package-source guix) - ((? channel? source) - (channel-commit source)) - (_ - (apply (lambda* (#:key commit #:allow-other-keys) commit) - (package-arguments guix))))) - (operating-system (host-name "gnu") (timezone "Etc/UTC") @@ -141,14 +133,7 @@ root ALL=(ALL) ALL (guix-service-type config => (guix-configuration (inherit config) - (guix - (let ((guix (current-guix))) - (package - (inherit guix) - ;; Do not leak the local checkout URL. - (source (channel - (inherit %default-guix-channel) - (commit (guix-package-commit guix))))))))))))) + (guix (current-guix)))))))) ;; Allow resolution of '.local' host names with mDNS. (name-service-switch %mdns-host-lookup-nss)) -- cgit v1.3 From e2857e21fa54ff72b4adabf95841d61fb820d55f Mon Sep 17 00:00:00 2001 From: Rutherther Date: Tue, 16 Dec 2025 12:24:42 +0100 Subject: system: install: Remove current-guix url override. Prefer parameterization of current-guix in release artifacts generation. * gnu/system/install.scm (%installation-service): Use (current-guix) directly in guix service configuration. Change-Id: Ifa363465e6a4f6936d0e51eaf1b33872519e2b0a Signed-off-by: Rutherther --- gnu/system/install.scm | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'gnu') diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 06fed8cae9..e5dfdbb427 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -336,29 +336,13 @@ templates under @file{/etc/configuration}."))) "Load the @code{uvesafb} kernel module with the right options.") (default-value #t))) -(define (guix-package-commit guix) - ;; Extract the commit of the GUIX package. - (match (package-source guix) - ((? channel? source) - (channel-commit source)) - (_ - (apply (lambda* (#:key commit #:allow-other-keys) commit) - (package-arguments guix))))) - (define* (%installation-services #:key (system (or (and=> (%current-target-system) platform-target->system) (%current-system))) - (guix-for-system - (let ((guix (current-guix))) - (package - (inherit guix) - ;; Do not leak the local checkout URL. - (source (channel - (inherit %default-guix-channel) - (commit (guix-package-commit guix)))))))) + (guix-for-system (current-guix))) ;; List of services of the installation system. (let ((motd (plain-file "motd" " \x1b[1;37mWelcome to the installation of GNU Guix!\x1b[0m -- cgit v1.3 From ab63e29e90aba4f10d477e76587d687a7bb6a27d Mon Sep 17 00:00:00 2001 From: Rutherther Date: Thu, 18 Dec 2025 15:39:54 +0100 Subject: installer: Drop uri from provenance log. To synchronize the artifacts made from Cuirass, pre-inst-env and time-machine, drop the url from provenance sexp. * gnu/installer.scm (provenance-sexp): Drop url. Change-Id: Ibe2515abdc92853ce06c0381dd03cc61b2077335 Signed-off-by: Rutherther --- gnu/installer.scm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'gnu') diff --git a/gnu/installer.scm b/gnu/installer.scm index d905ffa795..adc891e4eb 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -367,11 +367,10 @@ purposes." 'unknown) ((channels ...) (map (lambda (channel) - (let* ((uri (string->uri (channel-url channel))) - (url (if (or (not uri) (eq? 'file (uri-scheme uri))) - "local checkout" - (channel-url channel)))) - `(channel ,(channel-name channel) ,url ,(channel-commit channel)))) + ;; NOTE: URL is not logged to synchronize the derivations + ;; coming out of pre-inst-env, time-machine and Cuirass + ;; for generating release artifacts. + `(channel ,(channel-name channel) ,(channel-commit channel))) channels)))) (define* (installer-program #:key dry-run? (guix-for-installer (current-guix))) -- cgit v1.3 From d339785a0fbd8f13930082a4fa7a73b6685630fd Mon Sep 17 00:00:00 2001 From: Rutherther Date: Tue, 23 Dec 2025 10:29:43 +0100 Subject: gnu: guix: Update to 1.5.0rc1. Change-Id: I5afcfb7071c559b356e435bdefb4624a2c4ffa00 --- gnu/packages/package-management.scm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'gnu') diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm index eadaea4967..71977aaa9f 100644 --- a/gnu/packages/package-management.scm +++ b/gnu/packages/package-management.scm @@ -197,9 +197,9 @@ ;; Latest version of Guix, which may or may not correspond to a release. ;; Note: the 'update-guix-package.scm' script expects this definition to ;; start precisely like this. - (let ((version "1.4.0") - (commit "21ce6b392ace4c4d22543abc41bd7c22596cd6d2") - (revision 47)) + (let ((version "1.5.0rc1") + (commit "2d4ed08662714ea46cfe0b41ca195d1ef845fd1b") + (revision 0)) (package (name "guix") @@ -215,7 +215,7 @@ (commit commit))) (sha256 (base32 - "0q4f5aiqld1smjmq0k0y96wrrvn7pizsx8xzqk6m7f9f2qm7pdhc")) + "0z1ixlkzsaj978nh57179871xkzbf8zsf10xkcfs2647iznkx7az")) (file-name (string-append "guix-" version "-checkout")))) (build-system gnu-build-system) (arguments @@ -234,10 +234,9 @@ (string-append "--with-bash-completion-dir=" (assoc-ref %outputs "out") "/etc/bash_completion.d") - ;; TODO: Uncomment after guix is updated. - ;; (string-append "--with-apparmor-profile-dir=" - ;; (assoc-ref %outputs "out") - ;; "/etc/apparmor.d") + (string-append "--with-apparmor-profile-dir=" + (assoc-ref %outputs "out") + "/etc/apparmor.d") ;; Set 'DOT_USER_PROGRAM' to the empty string so ;; we don't keep a reference to Graphviz, whose -- cgit v1.3