summaryrefslogtreecommitdiff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-03-02 10:37:28 +0000
committerChristopher Baines <mail@cbaines.net>2023-03-02 10:55:08 +0000
commit7df09ee0ab3e7962ef27859ce87e06a323059284 (patch)
treed81334f742ddcb9a1ee63961ca6410922980af1c /gnu/system.scm
parent2ac51ec99b58b50c08ba719a8c7e9dba0330b065 (diff)
parentaf95f2d8f98eb2c8c64954bb2fd0b70838899174 (diff)
Merge remote-tracking branch 'savannah/master' into core-updates
Conflicts: gnu/local.mk gnu/packages/autotools.scm gnu/packages/cmake.scm gnu/packages/gnuzilla.scm gnu/packages/haskell.scm gnu/packages/pdf.scm gnu/packages/python-xyz.scm gnu/packages/samba.scm gnu/packages/tex.scm gnu/packages/tls.scm gnu/packages/wxwidgets.scm
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm58
1 files changed, 45 insertions, 13 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 0109e9a7123..bb1b7b5309d 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -14,6 +14,7 @@
14;;; Copyright © 2020, 2022 Efraim Flashner <efraim@flashner.co.il> 14;;; Copyright © 2020, 2022 Efraim Flashner <efraim@flashner.co.il>
15;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> 15;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
16;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com> 16;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com>
17;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
17;;; 18;;;
18;;; This file is part of GNU Guix. 19;;; This file is part of GNU Guix.
19;;; 20;;;
@@ -97,7 +98,7 @@
97 operating-system-user-services 98 operating-system-user-services
98 operating-system-packages 99 operating-system-packages
99 operating-system-host-name 100 operating-system-host-name
100 operating-system-hosts-file 101 operating-system-hosts-file ;deprecated
101 operating-system-hurd 102 operating-system-hurd
102 operating-system-kernel 103 operating-system-kernel
103 operating-system-kernel-file 104 operating-system-kernel-file
@@ -169,7 +170,7 @@
169 read-boot-parameters-file 170 read-boot-parameters-file
170 boot-parameters->menu-entry 171 boot-parameters->menu-entry
171 172
172 local-host-aliases 173 local-host-aliases ;deprecated
173 %root-account 174 %root-account
174 %setuid-programs 175 %setuid-programs
175 %sudoers-specification 176 %sudoers-specification
@@ -208,6 +209,15 @@ VERSION is the target version of the boot-parameters record."
208 #$system "/boot"))) 209 #$system "/boot")))
209 210
210;; System-wide configuration. 211;; System-wide configuration.
212
213(define-with-syntax-properties (warn-hosts-file-field-deprecation
214 (value properties))
215 (when value
216 (warning (source-properties->location properties)
217 (G_ "the 'hosts-file' field is deprecated, please use \
218'hosts-service-type' instead~%")))
219 value)
220
211;; TODO: Add per-field docstrings/stexi. 221;; TODO: Add per-field docstrings/stexi.
212(define-record-type* <operating-system> operating-system 222(define-record-type* <operating-system> operating-system
213 make-operating-system 223 make-operating-system
@@ -239,8 +249,9 @@ VERSION is the target version of the boot-parameters record."
239 (default %base-firmware)) 249 (default %base-firmware))
240 250
241 (host-name operating-system-host-name) ; string 251 (host-name operating-system-host-name) ; string
242 (hosts-file operating-system-hosts-file ; file-like | #f 252 (hosts-file %operating-system-hosts-file ; deprecated
243 (default #f)) 253 (default #f)
254 (sanitize warn-hosts-file-field-deprecation))
244 255
245 (mapped-devices operating-system-mapped-devices ; list of <mapped-device> 256 (mapped-devices operating-system-mapped-devices ; list of <mapped-device>
246 (default '())) 257 (default '()))
@@ -296,6 +307,10 @@ VERSION is the target version of the boot-parameters record."
296 source-properties->location)) 307 source-properties->location))
297 (innate))) 308 (innate)))
298 309
310(define-deprecated (operating-system-hosts-file os)
311 hosts-service-type
312 (%operating-system-hosts-file os))
313
299(define* (operating-system-kernel-arguments 314(define* (operating-system-kernel-arguments
300 os root-device #:key (version %boot-parameters-version)) 315 os root-device #:key (version %boot-parameters-version))
301 "Return all the kernel arguments, including the ones not specified directly 316 "Return all the kernel arguments, including the ones not specified directly
@@ -733,7 +748,8 @@ bookkeeping."
733 (non-boot-fs (non-boot-file-system-service os)) 748 (non-boot-fs (non-boot-file-system-service os))
734 (swaps (swap-services os)) 749 (swaps (swap-services os))
735 (procs (service user-processes-service-type)) 750 (procs (service user-processes-service-type))
736 (host-name (host-name-service (operating-system-host-name os))) 751 (host-name (operating-system-host-name os))
752 (hosts-file (%operating-system-hosts-file os))
737 (entries (operating-system-directory-base-entries os))) 753 (entries (operating-system-directory-base-entries os)))
738 (cons* (service system-service-type entries) 754 (cons* (service system-service-type entries)
739 (service linux-builder-service-type 755 (service linux-builder-service-type
@@ -755,12 +771,19 @@ bookkeeping."
755 (operating-system-groups os)) 771 (operating-system-groups os))
756 (operating-system-skeletons os)) 772 (operating-system-skeletons os))
757 (operating-system-etc-service os) 773 (operating-system-etc-service os)
774 ;; XXX: hosts-file is deprecated
775 (if hosts-file
776 (simple-service 'deprecated-hosts-file etc-service-type
777 (list `("hosts" ,hosts-file)))
778 (service hosts-service-type
779 (local-host-entries host-name)))
758 (service fstab-service-type 780 (service fstab-service-type
759 (filter file-system-needed-for-boot? 781 (filter file-system-needed-for-boot?
760 (operating-system-file-systems os))) 782 (operating-system-file-systems os)))
761 (session-environment-service 783 (session-environment-service
762 (operating-system-environment-variables os)) 784 (operating-system-environment-variables os))
763 host-name procs root-fs 785 (host-name-service host-name)
786 procs root-fs
764 (service setuid-program-service-type 787 (service setuid-program-service-type
765 (operating-system-setuid-programs os)) 788 (operating-system-setuid-programs os))
766 (service profile-service-type 789 (service profile-service-type
@@ -774,7 +797,9 @@ bookkeeping."
774 (operating-system-firmware os))))))) 797 (operating-system-firmware os)))))))
775 798
776(define (hurd-default-essential-services os) 799(define (hurd-default-essential-services os)
777 (let ((entries (operating-system-directory-base-entries os))) 800 (let ((host-name (operating-system-host-name os))
801 (hosts-file (%operating-system-hosts-file os))
802 (entries (operating-system-directory-base-entries os)))
778 (list (service system-service-type entries) 803 (list (service system-service-type entries)
779 %boot-service 804 %boot-service
780 %hurd-startup-service 805 %hurd-startup-service
@@ -794,6 +819,12 @@ bookkeeping."
794 (operating-system-file-systems os))) 819 (operating-system-file-systems os)))
795 (pam-root-service (operating-system-pam-services os)) 820 (pam-root-service (operating-system-pam-services os))
796 (operating-system-etc-service os) 821 (operating-system-etc-service os)
822 ;; XXX: hosts-file is deprecated
823 (if hosts-file
824 (simple-service 'deprecated-hosts-file etc-service-type
825 (list `("hosts" ,hosts-file)))
826 (service hosts-service-type
827 (local-host-entries host-name)))
797 (service setuid-program-service-type 828 (service setuid-program-service-type
798 (operating-system-setuid-programs os)) 829 (operating-system-setuid-programs os))
799 (service profile-service-type (operating-system-packages os))))) 830 (service profile-service-type (operating-system-packages os)))))
@@ -912,14 +943,17 @@ of PROVENANCE-SERVICE-TYPE to its services."
912 " 943 "
913This is the GNU system. Welcome.\n") 944This is the GNU system. Welcome.\n")
914 945
915(define (local-host-aliases host-name) 946(define-deprecated (local-host-aliases host-name)
947 local-host-entries
916 "Return aliases for HOST-NAME, to be used in /etc/hosts." 948 "Return aliases for HOST-NAME, to be used in /etc/hosts."
917 (string-append "127.0.0.1 localhost " host-name "\n" 949 (string-append "127.0.0.1 localhost " host-name "\n"
918 "::1 localhost " host-name "\n")) 950 "::1 localhost " host-name "\n"))
919 951
920(define (default-/etc/hosts host-name) 952(define (local-host-entries host-name)
921 "Return the default /etc/hosts file." 953 "Return <host> records for @var{host-name}."
922 (plain-file "hosts" (local-host-aliases host-name))) 954 (map (lambda (address)
955 (host address "localhost" (list host-name)))
956 '("127.0.0.1" "::1")))
923 957
924(define (validated-sudoers-file file) 958(define (validated-sudoers-file file)
925 "Return a copy of FILE, a sudoers file, after checking that it is 959 "Return a copy of FILE, a sudoers file, after checking that it is
@@ -1068,8 +1102,6 @@ fi\n")))
1068 ,@(if nsswitch `(("nsswitch.conf" ,#~#$nsswitch)) '()) 1102 ,@(if nsswitch `(("nsswitch.conf" ,#~#$nsswitch)) '())
1069 ("profile" ,#~#$profile) 1103 ("profile" ,#~#$profile)
1070 ("bashrc" ,#~#$bashrc) 1104 ("bashrc" ,#~#$bashrc)
1071 ("hosts" ,#~#$(or (operating-system-hosts-file os)
1072 (default-/etc/hosts (operating-system-host-name os))))
1073 ;; Write the operating-system-host-name to /etc/hostname to prevent 1105 ;; Write the operating-system-host-name to /etc/hostname to prevent
1074 ;; NetworkManager from changing the system's hostname when connecting 1106 ;; NetworkManager from changing the system's hostname when connecting
1075 ;; to certain networks. Some discussion at 1107 ;; to certain networks. Some discussion at