summaryrefslogtreecommitdiff
path: root/gnu/system
diff options
context:
space:
mode:
authorRutherther <rutherther@ditigal.xyz>2026-01-22 13:27:13 +0100
committerRutherther <rutherther@ditigal.xyz>2026-01-22 13:27:13 +0100
commit7c0cd7e45b0240b842b4f3e767599501eac42ee1 (patch)
tree3f5aab4b08d0fdfe1728be24f3250384ab44f9d2 /gnu/system
parent4e2de18be2c7f7701c00877e05c0b587d03ac4d1 (diff)
parentd58da8a56b75af73a7b5466f7ef8a81679713aa3 (diff)
Merge branch 'version-1.5.0'
Change-Id: Id73c0c74600a3da3373b3a37236b505af65bfe31
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/examples/desktop.tmpl18
-rw-r--r--gnu/system/install.scm446
2 files changed, 308 insertions, 156 deletions
diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl
index 2d65f222947..afe5ae2d2ba 100644
--- a/gnu/system/examples/desktop.tmpl
+++ b/gnu/system/examples/desktop.tmpl
@@ -3,7 +3,8 @@
3;; for a "desktop" setup with GNOME and Xfce where the 3;; for a "desktop" setup with GNOME and Xfce where the
4;; root partition is encrypted with LUKS, and a swap file. 4;; root partition is encrypted with LUKS, and a swap file.
5 5
6(use-modules (gnu) (gnu system nss) (guix utils)) 6(use-modules (gnu) (gnu system nss) (guix utils)
7 (guix packages))
7(use-service-modules desktop sddm xorg) 8(use-service-modules desktop sddm xorg)
8(use-package-modules gnome) 9(use-package-modules gnome)
9 10
@@ -73,7 +74,10 @@
73 ;; by clicking the gear. Use the "desktop" services, which 74 ;; by clicking the gear. Use the "desktop" services, which
74 ;; include the X11 log-in service, networking with 75 ;; include the X11 log-in service, networking with
75 ;; NetworkManager, and more. 76 ;; NetworkManager, and more.
76 (services (if (target-x86-64?) 77 (services (if (supported-package? gnome
78 (or (and=> (%current-target-system)
79 gnu-triplet->nix-system)
80 (%current-system)))
77 (append (list (service gnome-desktop-service-type) 81 (append (list (service gnome-desktop-service-type)
78 (service xfce-desktop-service-type) 82 (service xfce-desktop-service-type)
79 (set-xorg-configuration 83 (set-xorg-configuration
@@ -81,16 +85,14 @@
81 (keyboard-layout keyboard-layout)))) 85 (keyboard-layout keyboard-layout))))
82 %desktop-services) 86 %desktop-services)
83 87
84 ;; FIXME: Since GDM depends on Rust (gdm -> gnome-shell -> gjs 88 ;; FIXME: Since Gnome depends on Rust and Rust is currently
85 ;; -> mozjs -> rust) and Rust is currently unavailable on 89 ;; unavailable on some platforms, we use MATE here instead of
86 ;; non-x86_64 platforms, we use SDDM and Mate here instead of 90 ;; GNOME.
87 ;; GNOME and GDM.
88 (append (list (service mate-desktop-service-type) 91 (append (list (service mate-desktop-service-type)
89 (service xfce-desktop-service-type) 92 (service xfce-desktop-service-type)
90 (set-xorg-configuration 93 (set-xorg-configuration
91 (xorg-configuration 94 (xorg-configuration
92 (keyboard-layout keyboard-layout)) 95 (keyboard-layout keyboard-layout))))
93 sddm-service-type))
94 %desktop-services))) 96 %desktop-services)))
95 97
96 ;; Allow resolution of '.local' host names with mDNS. 98 ;; Allow resolution of '.local' host names with mDNS.
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index e5dfdbb427b..7d9cfa8f21d 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -25,9 +25,11 @@
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. 25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 26
27(define-module (gnu system install) 27(define-module (gnu system install)
28 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (gnu) 29 #:use-module (gnu)
29 #:use-module (gnu system) 30 #:use-module (gnu system)
30 #:use-module (gnu system privilege) 31 #:use-module (gnu system privilege)
32 #:use-module (guix build-system trivial)
31 #:use-module (gnu bootloader) 33 #:use-module (gnu bootloader)
32 #:use-module (gnu bootloader u-boot) 34 #:use-module (gnu bootloader u-boot)
33 #:use-module (guix gexp) 35 #:use-module (guix gexp)
@@ -336,6 +338,104 @@ templates under @file{/etc/configuration}.")))
336 "Load the @code{uvesafb} kernel module with the right options.") 338 "Load the @code{uvesafb} kernel module with the right options.")
337 (default-value #t))) 339 (default-value #t)))
338 340
341(define %installation-login-pam-service
342;; Custom 'login' pam.d rule. It is based on the original one,
343;; but includes possibility to print different motd. This motd
344;; is useful for headless consoles.
345 (let* ((unix (pam-entry
346 (control "required")
347 (module "pam_unix.so")))
348 (env (pam-entry ; to honor /etc/environment.
349 (control "required")
350 (module "pam_env.so")))
351 (motd (plain-file "motd" "
352\x1b[1;37mWelcome to the installation of GNU Guix!\x1b[0m
353
354\x1b[2m\
355Using this shell, you can carry out the installation process \"manually.\"
356Access documentation at any time by pressing Alt-F2.\x1b[0m
357"))
358 (console-motd (plain-file "console-motd" "
359\x1b[1;37mWelcome to the installation of GNU Guix!\x1b[0m
360
361You are in a headless console. If you can use a display, you should see the
362graphical installer on TTY1, it's opened by default. In case you cannot use a
363display, you can carry out the installation process in this shell \"manually\"
364or by starting the installer, using `guix-system-installer` command.
365
366\x1b[2mYou can access the Guix documentation using `info \"(guix)\"`.\x1b[0m
367"))
368 (show-motd (program-file "show-motd"
369 #~(begin
370 (use-modules (ice-9 textual-ports))
371
372 (call-with-input-file
373 (if (file-exists?
374 (string-append
375 "/tmp/console_"
376 (basename (getenv "PAM_TTY"))))
377 #$console-motd
378 #$motd)
379 (lambda (port)
380 (display (get-string-all port))))))))
381 (pam-service
382 (name "login")
383 (account (list unix))
384 (auth (list (pam-entry
385 (control "required")
386 (module "pam_unix.so")
387 (arguments '("nullok")))))
388 (password (list (pam-entry
389 (control "required")
390 (module "pam_unix.so")
391 (arguments '("sha512" "shadow")))))
392 (session `(,(pam-entry
393 (control "optional")
394 (module "pam_exec.so")
395 (arguments
396 (list "type=open_session" "stdout" show-motd)))
397 ,(pam-entry ;to fill in /proc/self/loginuid
398 (control "required")
399 (module "pam_loginuid.so"))
400 ,env ,unix)))))
401
402(define %installation-console-login
403;; Make a custom 'login' wrapper for execution in console
404;; terminal. It instructs pam.d login rule to print different
405;; motd.
406 (program-file
407 "login-with-motd"
408 #~(begin
409 (call-with-output-file
410 (string-append "/tmp/console_"
411 (basename (ttyname (current-output-port))))
412 (const #t))
413
414 (apply execlp
415 #$(file-append shadow "/bin/login")
416 (command-line)))))
417
418(define* (installer-command-package installer-program
419 #:key executable)
420 (package
421 (name executable)
422 (version "0")
423 (source #f)
424 (build-system trivial-build-system)
425 (arguments
426 (list #:builder (with-imported-modules '((guix build utils))
427 #~(begin
428 (use-modules (guix build utils))
429
430 (mkdir-p (string-append #$output "/bin"))
431
432 (symlink #$installer-program
433 (string-append #$output "/bin/" #$executable))))))
434 (home-page #f)
435 (synopsis "Provides the Guix System installer as run-guix-installer command")
436 (description "Provides the Guix System installer as run-guix-installer command.")
437 (license license:gpl3+)))
438
339(define* (%installation-services 439(define* (%installation-services
340 #:key 440 #:key
341 (system (or (and=> 441 (system (or (and=>
@@ -344,152 +444,168 @@ templates under @file{/etc/configuration}.")))
344 (%current-system))) 444 (%current-system)))
345 (guix-for-system (current-guix))) 445 (guix-for-system (current-guix)))
346 ;; List of services of the installation system. 446 ;; List of services of the installation system.
347 (let ((motd (plain-file "motd" " 447 (define (normal-tty tty)
348\x1b[1;37mWelcome to the installation of GNU Guix!\x1b[0m 448 (service mingetty-service-type
349 449 (mingetty-configuration (tty tty)
350\x1b[2m\ 450 (auto-login "root")
351Using this shell, you can carry out the installation process \"manually.\" 451 (login-pause? #t))))
352Access documentation at any time by pressing Alt-F2.\x1b[0m 452
353"))) 453 (define bare-bones-os
354 (define (normal-tty tty) 454 (load "examples/bare-bones.tmpl"))
355 (service mingetty-service-type 455
356 (mingetty-configuration (tty tty) 456 (define installer
357 (auto-login "root") 457 (installer-program
358 (login-pause? #t)))) 458 #:guix-for-installer guix-for-system))
359 459
360 (define bare-bones-os 460 (append
361 (load "examples/bare-bones.tmpl")) 461 ;; Generic services
362 462 (list (service virtual-terminal-service-type)
363 (append 463
364 ;; Generic services 464 (service kmscon-service-type
365 (list (service virtual-terminal-service-type) 465 (kmscon-configuration
366 466 (virtual-terminal "tty1")
367 (service kmscon-service-type 467 (login-program installer)))
368 (kmscon-configuration 468
369 (virtual-terminal "tty1") 469 (simple-service 'installer-login
370 (login-program (installer-program 470 pam-root-service-type
371 #:guix-for-installer guix-for-system)))) 471 (list %installation-login-pam-service))
372 472
373 (service login-service-type 473 ;; Documentation. The manual is in UTF-8, but
374 (login-configuration 474 ;; 'console-font-service' sets up Unicode support and loads a font
375 (motd motd))) 475 ;; with all the useful glyphs like em dash and quotation marks.
376 476 (service documentation-service-type "tty2")
377 ;; Documentation. The manual is in UTF-8, but 477
378 ;; 'console-font-service' sets up Unicode support and loads a font 478 ;; Documentation add-on.
379 ;; with all the useful glyphs like em dash and quotation marks. 479 %configuration-template-service
380 (service documentation-service-type "tty2") 480
381 481 ;; A bunch of 'root' ttys.
382 ;; Documentation add-on. 482 (normal-tty "tty3")
383 %configuration-template-service 483 (normal-tty "tty4")
384 484 (normal-tty "tty5")
385 ;; A bunch of 'root' ttys. 485 (normal-tty "tty6")
386 (normal-tty "tty3") 486
387 (normal-tty "tty4") 487 ;; The usual services.
388 (normal-tty "tty5") 488 (service shepherd-system-log-service-type)
389 (normal-tty "tty6") 489
390 490 ;; Use the Avahi daemon to discover substitute servers on the local
391 ;; The usual services. 491 ;; network. It can be faster than fetching from remote servers.
392 (service shepherd-system-log-service-type) 492 (service avahi-service-type)
393 493
394 ;; Use the Avahi daemon to discover substitute servers on the local 494 ;; Allow runninng the installer command on headless setups.
395 ;; network. It can be faster than fetching from remote servers. 495 (simple-service 'installer-program-profile
396 (service avahi-service-type) 496 profile-service-type
397 497 (list (installer-command-package
398 ;; The build daemon. 498 installer
399 (service guix-service-type 499 #:executable "guix-system-installer")))
400 (guix-configuration 500
401 ;; Register the default substitute server key(s) as 501 ;; The build daemon.
402 ;; trusted to allow the installation process to use 502 (service guix-service-type
403 ;; substitutes by default. 503 (guix-configuration
404 (authorize-key? #t) 504 ;; Register the default substitute server key(s) as
405 505 ;; trusted to allow the installation process to use
406 ;; Install and run the current Guix rather than an older 506 ;; substitutes by default.
407 ;; snapshot. 507 (authorize-key? #t)
408 (guix guix-for-system))) 508
409 509 ;; Install and run the current Guix rather than an older
410 ;; Start udev so that useful device nodes are available. 510 ;; snapshot.
411 ;; Use device-mapper rules for cryptsetup & co; enable the CRDA for 511 (guix guix-for-system)))
412 ;; regulations-compliant WiFi access. 512
413 (service udev-service-type 513 ;; Start udev so that useful device nodes are available.
414 (udev-configuration 514 ;; Use device-mapper rules for cryptsetup & co; enable the CRDA for
415 (rules (list lvm2 crda)))) 515 ;; regulations-compliant WiFi access.
416 516 (service udev-service-type
417 ;; Add the 'cow-store' service, which users have to start manually 517 (udev-configuration
418 ;; since it takes the installation directory as an argument. 518 (rules (list lvm2 crda))))
419 (cow-store-service) 519
420 520 ;; Add the 'cow-store' service, which users have to start manually
421 ;; Install Unicode support and a suitable font. 521 ;; since it takes the installation directory as an argument.
422 (service console-font-service-type 522 (cow-store-service)
423 (map (match-lambda 523
424 ("tty2" 524 ;; Install Unicode support and a suitable font.
425 ;; Use a font that contains characters such as 525 (service console-font-service-type
426 ;; curly quotes as found in the manual. 526 (map (match-lambda
427 '("tty2" . "LatGrkCyr-8x16")) 527 ("tty2"
428 (tty 528 ;; Use a font that contains characters such as
429 ;; Use a font that doesn't have more than 256 529 ;; curly quotes as found in the manual.
430 ;; glyphs so that we can use colors with varying 530 '("tty2" . "LatGrkCyr-8x16"))
431 ;; brightness levels (see note in setfont(8)). 531 (tty
432 `(,tty . "lat9u-16"))) 532 ;; Use a font that doesn't have more than 256
433 '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6"))) 533 ;; glyphs so that we can use colors with varying
434 534 ;; brightness levels (see note in setfont(8)).
435 ;; To facilitate copy/paste. 535 `(,tty . "lat9u-16")))
436 (service gpm-service-type) 536 '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6")))
437 537
438 ;; Add an SSH server to facilitate remote installs. 538 ;; To facilitate copy/paste.
439 (service openssh-service-type 539 (service gpm-service-type)
440 (openssh-configuration 540
441 (port-number 22) 541 ;; Add an SSH server to facilitate remote installs.
442 (permit-root-login #t) 542 (service openssh-service-type
443 ;; The root account is passwordless, so make sure 543 (openssh-configuration
444 ;; a password is set before allowing logins. 544 (port-number 22)
445 (allow-empty-passwords? #f) 545 (permit-root-login #t)
446 (password-authentication? #t) 546 ;; The root account is passwordless, so make sure
447 547 ;; a password is set before allowing logins.
448 ;; Don't start it upfront. 548 (allow-empty-passwords? #f)
449 (%auto-start? #f))) 549 (password-authentication? #t)
450 550
451 ;; Since this is running on a USB stick with a overlayfs as the root 551 ;; Don't start it upfront.
452 ;; file system, use an appropriate cache configuration. 552 (%auto-start? #f)))
453 (service nscd-service-type 553
454 (nscd-configuration 554 ;; Since this is running on a USB stick with a overlayfs as the root
455 (caches %nscd-minimal-caches))) 555 ;; file system, use an appropriate cache configuration.
456 556 (service nscd-service-type
457 ;; Having /bin/sh is a good idea. In particular it allows Tramp 557 (nscd-configuration
458 ;; connections to this system to work. 558 (caches %nscd-minimal-caches)))
459 (service special-files-service-type 559
460 `(("/bin/sh" ,(file-append bash "/bin/sh")))) 560 ;; Having /bin/sh is a good idea. In particular it allows Tramp
461 561 ;; connections to this system to work.
462 ;; Loopback device, needed by OpenSSH notably. 562 (service special-files-service-type
463 (service static-networking-service-type 563 `(("/bin/sh" ,(file-append bash "/bin/sh"))))
464 (list %loopback-static-networking)) 564
465 565 ;; Loopback device, needed by OpenSSH notably.
466 (service wpa-supplicant-service-type) 566 (service static-networking-service-type
467 (service dbus-root-service-type) 567 (list %loopback-static-networking))
468 (service connman-service-type 568
469 (connman-configuration 569 (service wpa-supplicant-service-type)
470 (disable-vpn? #t))) 570 (service dbus-root-service-type)
471 571 (service connman-service-type
472 ;; Keep a reference to BARE-BONES-OS to make sure it can be 572 (connman-configuration
473 ;; installed without downloading/building anything. Also keep the 573 (disable-vpn? #t)))
474 ;; things needed by 'profile-derivation' to minimize the amount of 574
475 ;; download. 575 ;; Keep a reference to BARE-BONES-OS to make sure it can be
476 (service gc-root-service-type 576 ;; installed without downloading/building anything. Also keep the
477 (append 577 ;; things needed by 'profile-derivation' to minimize the amount of
478 (list bare-bones-os 578 ;; download.
479 (libc-utf8-locales-for-target system) 579 (service gc-root-service-type
480 texinfo 580 (append
481 guile-3.0) 581 (list bare-bones-os
482 %default-locale-libcs))) 582 (libc-utf8-locales-for-target system)
483 583 texinfo
484 ;; Specific system services 584 guile-3.0)
485 585 %default-locale-libcs)))
486 ;; Machines without Kernel Mode Setting (those with many old and 586
487 ;; current AMD GPUs, SiS GPUs, ...) need uvesafb to show the GUI 587 ;; Specific system services
488 ;; installer. Some may also need a kernel parameter like nomodeset 588
489 ;; or vga=793, but we leave that for the user to specify in GRUB. 589 ;; AArch64 has a better detection of consoles, mainly because device
490 `(,@(if (supported-package? v86d system) 590 ;; trees are utilized. On x86_64, the detection is usually done
491 (list (service uvesafb-service-type)) 591 ;; through BIOS and consoles do not get registered to /proc/console.
492 '()))))) 592 ;; The only way they would is if the user used console linux argument.
593 `(,@(if (target-aarch64? system)
594 (list (service agetty-service-type
595 (agetty-configuration (tty #f)
596 (auto-login "root")
597 (login-pause? #t)
598 (login-program
599 %installation-console-login))))
600 '()))
601
602 ;; Machines without Kernel Mode Setting (those with many old and
603 ;; current AMD GPUs, SiS GPUs, ...) need uvesafb to show the GUI
604 ;; installer. Some may also need a kernel parameter like nomodeset
605 ;; or vga=793, but we leave that for the user to specify in GRUB.
606 `(,@(if (supported-package? v86d system)
607 (list (service uvesafb-service-type))
608 '()))))
493 609
494(define %issue 610(define %issue
495 ;; Greeting. 611 ;; Greeting.
@@ -530,10 +646,44 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m
530 "usb_common" "usbcore" 646 "usb_common" "usbcore"
531 ;; USB 3.0 647 ;; USB 3.0
532 "xhci_pci" "xhci_hcd" 648 "xhci_pci" "xhci_hcd"
533 ;; embedded USB 3.0
534 "xhci_plat_hcd" 649 "xhci_plat_hcd"
650 ;; More USB controllers
651 "dwc3" "dwc3_pci"
652 ;; Allwinner
653 "phy_sun4i_usb" "phy_sun50i_usb3"
654 ;; Qualcomm
655 "dwc3_qcom"
656 "phy_qcom_qmp_usb" "phy_qcom_qusb2"
657 "phy_qcom_snps_femto_v2" "phy_qcom_usb_hs"
658 "phy_qcom_usb_ss"
659 ;; Texas Instruments
660 "phy_tusb1210"
661 ;; Rockchip
662 "phy_rockchip_usb"
663 "phy_rockchip_inno_usb2" "phy_rockchip_typec"
664 ;; NXP i.MX
665 "phy_fsl_imx8mq_usb"
666 ;; Generic
667 "phy_generic"
668 ;; "thunderbolt" "typec_thunderbolt"
535 ;; USB 2.0 669 ;; USB 2.0
536 "ehci_pci" "ehci_hcd") 670 "dwc2"
671 "ehci_pci" "ehci_hcd"
672 "ehci_platform"
673 ;; USB 1.1
674 "ohci_pci" "ohci_hcd"
675 ;; SD cards
676 "mmc_hsq" "mmc_spi"
677 "mmc_core" "mmc_block"
678 "sdhci" "sdhci_pci"
679 "mmc_spi"
680 "sdhci_acpi"
681 ;; Platform specific SD card
682 "dw_mmc" "dw_mmc-pltfm" "dw_mmc-rockchip"
683 "sunxi_mmc" "sdhci_pltfm" "sdhci_msm"
684 "sdhci_of_arasan" "sdhci_of_esdhc" "sdhci_brcmstb"
685 "sdhci_tegra" "phy_rockchip_emmc"
686 "sdhci_esdhc_imx")
537 '()) 687 '())
538 ,@%base-initrd-modules)) 688 ,@%base-initrd-modules))
539 689