|
|
|
;;; GNU Guix --- Functional package management for GNU
|
|
|
|
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
|
|
|
|
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
|
|
|
|
;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
|
|
|
|
;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
|
|
|
|
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
|
|
|
;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
|
|
|
|
;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
|
|
|
|
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
|
|
|
|
;;;
|
|
|
|
;;; 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)
|
|
|
|
#:use-module (guix inferior)
|
|
|
|
#:use-module (guix store)
|
|
|
|
#:use-module (guix monads)
|
|
|
|
#:use-module (guix gexp)
|
|
|
|
#:use-module (guix records)
|
|
|
|
#:use-module (guix packages)
|
|
|
|
#:use-module (guix derivations)
|
|
|
|
#:use-module (guix profiles)
|
|
|
|
#:use-module (guix ui)
|
|
|
|
#:use-module (guix utils)
|
|
|
|
#:use-module (gnu packages base)
|
|
|
|
#:use-module (gnu packages bash)
|
gnu: Split (gnu packages base), adding (gnu packages commencement).
* gnu/packages/base.scm (gnu-make-boot0, diffutils-boot0,
findutils-boot0, %boot0-inputs, nix-system->gnu-triplet, boot-triplet,
binutils-boot0, gcc-boot0, perl-boot0, linux-libre-headers-boot0,
texinfo-boot0, %boot1-inputs, glibc-final-with-bootstrap-bash,
cross-gcc-wrapper, static-bash-for-glibc, glibc-final,
gcc-boot0-wrapped, %boot2-inputs, binutils-final, libstdc++,
gcc-final, ld-wrapper-boot3, %boot3-inputs, bash-final, %boot4-inputs,
guile-final, gnu-make-final, ld-wrapper, coreutils-final, grep-final,
%boot5-inputs, %final-inputs, canonical-package, gcc-toolchain,
gcc-toolchain-4.8, gcc-toolchain-4.9): Move to...
* gnu/packages/commencement.scm: ... here. New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* build-aux/check-final-inputs-self-contained.scm: Adjust accordingly.
* gnu/packages/cross-base.scm: Likewise.
* gnu/packages/make-bootstrap.scm: Likewise.
* guix/build-system/cmake.scm (cmake-build): Likewise.
* guix/build-system/gnu.scm (standard-packages, gnu-build,
gnu-cross-build): Likewise.
* guix/build-system/perl.scm (perl-build): Likewise.
* guix/build-system/python.scm (python-build): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Likewise.
* guix/download.scm (url-fetch): Likewise.
* guix/gexp.scm (default-guile): Likewise.
* guix/git-download.scm (git-fetch): Likewise.
* guix/monads.scm (run-with-store): Likewise.
* guix/packages.scm (default-guile): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/scripts/refresh.scm: Likewise.
* guix/svn-download.scm (svn-fetch): Likewise.
* tests/builders.scm (%bootstrap-inputs, %bootstrap-search-paths):
Likewise.
* tests/packages.scm ("GNU Make, bootstrap"): Likewise.
* tests/guix-package.sh: Likewise.
* gnu/services/base.scm: Use 'canonical-package' instead of xxx-final.
* gnu/services/xorg.scm: Likewise.
* gnu/system/vm.scm: Likewise.
* guix/scripts/pull.scm (guix-pull): Likewise.
8 years ago
|
|
|
#:use-module (gnu packages guile)
|
|
|
|
#:use-module (gnu packages guile-xyz)
|
|
|
|
#:use-module (gnu packages admin)
|
|
|
|
#:use-module (gnu packages linux)
|
|
|
|
#:use-module (gnu packages pciutils)
|
|
|
|
#:use-module (gnu packages package-management)
|
|
|
|
#:use-module (gnu packages less)
|
|
|
|
#:use-module (gnu packages zile)
|
|
|
|
#:use-module (gnu packages nano)
|
|
|
|
#:use-module (gnu packages gawk)
|
|
|
|
#:use-module (gnu packages man)
|
|
|
|
#:use-module (gnu packages texinfo)
|
|
|
|
#:use-module (gnu packages compression)
|
|
|
|
#:use-module (gnu packages firmware)
|
|
|
|
#:use-module (gnu services)
|
|
|
|
#:use-module (gnu services shepherd)
|
|
|
|
#:use-module (gnu services base)
|
|
|
|
#:use-module (gnu bootloader)
|
|
|
|
#:use-module (gnu system shadow)
|
|
|
|
#:use-module (gnu system nss)
|
|
|
|
#:use-module (gnu system locale)
|
|
|
|
#:use-module (gnu system pam)
|
|
|
|
#:use-module (gnu system linux-initrd)
|
|
|
|
#:use-module (gnu system uuid)
|
|
|
|
#:use-module (gnu system file-systems)
|
|
|
|
#:use-module (gnu system mapped-devices)
|
|
|
|
#:use-module (ice-9 match)
|
|
|
|
#:use-module (srfi srfi-1)
|
|
|
|
#:use-module (srfi srfi-26)
|
|
|
|
#:use-module (srfi srfi-34)
|
|
|
|
#:use-module (srfi srfi-35)
|
|
|
|
#:use-module (rnrs bytevectors)
|
|
|
|
#:export (operating-system
|
|
|
|
operating-system?
|
|
|
|
this-operating-system
|
|
|
|
|
|
|
|
operating-system-bootloader
|
|
|
|
operating-system-services
|
|
|
|
operating-system-essential-services
|
|
|
|
operating-system-default-essential-services
|
|
|
|
operating-system-user-services
|
|
|
|
operating-system-packages
|
|
|
|
operating-system-host-name
|
|
|
|
operating-system-hosts-file
|
|
|
|
operating-system-kernel
|
|
|
|
operating-system-kernel-file
|
|
|
|
operating-system-kernel-arguments
|
|
|
|
operating-system-label
|
|
|
|
operating-system-default-label
|
|
|
|
operating-system-initrd-modules
|
|
|
|
operating-system-initrd
|
|
|
|
operating-system-users
|
|
|
|
operating-system-groups
|
|
|
|
operating-system-issue
|
|
|
|
operating-system-timezone
|
|
|
|
operating-system-locale
|
|
|
|
operating-system-locale-definitions
|
|
|
|
operating-system-locale-libcs
|
|
|
|
operating-system-mapped-devices
|
|
|
|
operating-system-file-systems
|
|
|
|
operating-system-store-file-system
|
|
|
|
operating-system-user-mapped-devices
|
|
|
|
operating-system-boot-mapped-devices
|
|
|
|
operating-system-activation-script
|
|
|
|
operating-system-user-accounts
|
|
|
|
operating-system-shepherd-service-names
|
|
|
|
operating-system-user-kernel-arguments
|
|
|
|
operating-system-firmware
|
|
|
|
operating-system-keyboard-layout
|
|
|
|
operating-system-name-service-switch
|
|
|
|
operating-system-pam-services
|
|
|
|
operating-system-setuid-programs
|
|
|
|
operating-system-skeletons
|
|
|
|
operating-system-sudoers-file
|
|
|
|
operating-system-swap-devices
|
|
|
|
operating-system-kernel-loadable-modules
|
|
|
|
|
|
|
|
operating-system-derivation
|
|
|
|
operating-system-profile
|
|
|
|
operating-system-bootcfg
|
|
|
|
operating-system-etc-directory
|
|
|
|
operating-system-locale-directory
|
|
|
|
operating-system-boot-script
|
|
|
|
|
|
|
|
system-linux-image-file-name
|
|
|
|
operating-system-with-gc-roots
|
|
|
|
operating-system-with-provenance
|
|
|
|
|
|
|
|
boot-parameters
|
|
|
|
boot-parameters?
|
|
|
|
boot-parameters-label
|
|
|
|
boot-parameters-root-device
|
|
|
|
boot-parameters-bootloader-name
|
|
|
|
boot-parameters-bootloader-menu-entries
|
|
|
|
boot-parameters-store-device
|
|
|
|
boot-parameters-store-mount-point
|
|
|
|
boot-parameters-kernel
|
|
|
|
boot-parameters-kernel-arguments
|
|
|
|
boot-parameters-initrd
|
|
|
|
read-boot-parameters
|
|
|
|
read-boot-parameters-file
|
|
|
|
boot-parameters->menu-entry
|
|
|
|
|
|
|
|
local-host-aliases
|
|
|
|
%root-account
|
|
|
|
%setuid-programs
|
|
|
|
%sudoers-specification
|
|
|
|
%base-packages
|
|
|
|
%base-packages-interactive
|
|
|
|
%base-packages-linux
|
|
|
|
%base-packages-networking
|
|
|
|
%base-packages-utils
|
|
|
|
%base-firmware))
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;;;
|
|
|
|
;;; This module supports whole-system configuration.
|
|
|
|
;;;
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(define (bootable-kernel-arguments system root-device)
|
|
|
|
"Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE."
|
|
|
|
(list (string-append "--root="
|
|
|
|
;; Note: Always use the DCE format because that's what
|
|
|
|
;; (gnu build linux-boot) expects for the '--root'
|
|
|
|
;; kernel command-line option.
|
|
|
|
(file-system-device->string root-device
|
|
|
|
#:uuid-type 'dce))
|
|
|
|
#~(string-append "--system=" #$system)
|
|
|
|
#~(string-append "--load=" #$system "/boot")))
|
|
|
|
|
|
|
|
;; System-wide configuration.
|
|
|
|
;; TODO: Add per-field docstrings/stexi.
|
|
|
|
(define-record-type* <operating-system> operating-system
|
|
|
|
make-operating-system
|
|
|
|
operating-system?
|
|
|
|
this-operating-system
|
|
|
|
|
|
|
|
(kernel operating-system-kernel ; package
|
|
|
|
(default linux-libre))
|
|
|
|
(kernel-loadable-modules operating-system-kernel-loadable-modules
|
|
|
|
(default '())) ; list of packages
|
|
|
|
(kernel-arguments operating-system-user-kernel-arguments
|
|
|
|
(default '("quiet"))) ; list of gexps/strings
|
|
|
|
(bootloader operating-system-bootloader) ; <bootloader-configuration>
|
|
|
|
(label operating-system-label ; string
|
|
|
|
(thunked)
|
|
|
|
(default (operating-system-default-label this-operating-system)))
|
|
|
|
|
|
|
|
(keyboard-layout operating-system-keyboard-layout ;#f | <keyboard-layout>
|
|
|
|
(default #f))
|
|
|
|
(initrd operating-system-initrd ; (list fs) -> file-like
|
|
|
|
(default base-initrd))
|
|
|
|
(initrd-modules operating-system-initrd-modules ; list of strings
|
|
|
|
(thunked) ; it's system-dependent
|
|
|
|
(default %base-initrd-modules))
|
|
|
|
|
|
|
|
(firmware operating-system-firmware ; list of packages
|
|
|
|
(default %base-firmware))
|
|
|
|
|
|
|
|
(host-name operating-system-host-name) ; string
|
|
|
|
(hosts-file operating-system-hosts-file ; file-like | #f
|
|
|
|
(default #f))
|
|
|
|
|
|
|
|
(mapped-devices operating-system-mapped-devices ; list of <mapped-device>
|
|
|
|
(default '()))
|
|
|
|
(file-systems operating-system-file-systems) ; list of fs
|
|
|
|
(swap-devices operating-system-swap-devices ; list of strings
|
|
|
|
(default '()))
|
|
|
|
|
|
|
|
(users operating-system-users ; list of user accounts
|
|
|
|
(default %base-user-accounts))
|
|
|
|
(groups operating-system-groups ; list of user groups
|
|
|
|
(default %base-groups))
|
|
|
|
|
|
|
|
(skeletons operating-system-skeletons ; list of name/file-like value
|
|
|
|
(default (default-skeletons)))
|
|
|
|
(issue operating-system-issue ; string
|
|
|
|
(default %default-issue))
|
|
|
|
|
|
|
|
(packages operating-system-packages ; list of (PACKAGE OUTPUT...)
|
|
|
|
(default %base-packages)) ; or just PACKAGE
|
|
|
|
|
|
|
|
(timezone operating-system-timezone) ; string
|
|
|
|
(locale operating-system-locale ; string
|
|
|
|
(default "en_US.utf8"))
|
|
|
|
(locale-definitions operating-system-locale-definitions ; list of <locale-definition>
|
|
|
|
(default %default-locale-definitions))
|
|
|
|
(locale-libcs operating-system-locale-libcs ; list of <packages>
|
|
|
|
(default %default-locale-libcs))
|
|
|
|
(name-service-switch operating-system-name-service-switch ; <name-service-switch>
|
|
|
|
(default %default-nss))
|
|
|
|
|
|
|
|
(essential-services operating-system-essential-services ; list of services
|
|
|
|
(thunked)
|
|
|
|
(default (operating-system-default-essential-services
|
|
|
|
this-operating-system)))
|
|
|
|
(services operating-system-user-services ; list of services
|
|
|
|
(default %base-services))
|
|
|
|
|
|
|
|
(pam-services operating-system-pam-services ; list of PAM services
|
|
|
|
(default (base-pam-services)))
|
|
|
|
(setuid-programs operating-system-setuid-programs
|
|
|
|
(default %setuid-programs)) ; list of string-valued gexps
|
|
|
|
|
|
|
|
(sudoers-file operating-system-sudoers-file ; file-like
|
|
|
|
(default %sudoers-specification)))
|
|
|
|
|
|
|
|
(define (operating-system-kernel-arguments os root-device)
|
|
|
|
"Return all the kernel arguments, including the ones not specified
|
|
|
|
directly by the user."
|
|
|
|
(append (bootable-kernel-arguments os root-device)
|
|
|
|
(operating-system-user-kernel-arguments os)))
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
;;; Boot parameters
|
|
|
|
;;;
|
|
|
|
|
|
|
|
(define-record-type* <boot-parameters>
|
|
|
|
boot-parameters make-boot-parameters boot-parameters?
|
|
|
|
(label boot-parameters-label)
|
|
|
|
;; Because we will use the 'store-device' to create the GRUB search command,
|
|
|
|
;; the 'store-device' has slightly different semantics than 'root-device'.
|
|
|
|
;; The 'store-device' can be a file system uuid, a file system label, or #f,
|
|
|
|
;; but it cannot be a device path such as "/dev/sda3", since GRUB would not
|
|
|
|
;; understand that. The 'root-device', on the other hand, corresponds
|
|
|
|
;; exactly to the device field of the <file-system> object representing the
|
|
|
|
;; OS's root file system, so it might be a device path like "/dev/sda3".
|
|
|
|
(root-device boot-parameters-root-device)
|
|
|
|
(bootloader-name boot-parameters-bootloader-name)
|
|
|
|
(bootloader-menu-entries ;list of <menu-entry>
|
|
|
|
boot-parameters-bootloader-menu-entries)
|
|
|
|
(store-device boot-parameters-store-device)
|
|
|
|
(store-mount-point boot-parameters-store-mount-point)
|
|
|
|
(kernel boot-parameters-kernel)
|
|
|
|
(kernel-arguments boot-parameters-kernel-arguments)
|
|
|
|
(initrd boot-parameters-initrd))
|
|
|
|
|
|
|
|
(define (ensure-not-/dev device)
|
|
|
|
"If DEVICE starts with a slash, return #f. This is meant to filter out
|
|
|
|
Linux device names such as /dev/sda, and to preserve GRUB device names and
|
|
|
|
file system labels."
|
|
|
|
(if (and (string? device) (string-prefix? "/" device))
|
|
|
|
#f
|
|
|
|
device))
|
|
|
|
|
|
|
|
(define (read-boot-parameters port)
|
|
|
|
"Read boot parameters from PORT and return the corresponding
|
|
|
|
<boot-parameters> object or #f if the format is unrecognized."
|
|
|
|
(define device-sexp->device
|
|
|
|
(match-lambda
|
|
|
|
(('uuid (? symbol? type) (? bytevector? bv))
|
|
|
|
(bytevector->uuid bv type))
|
|
|
|
(('file-system-label (? string? label))
|
|
|
|
(file-system-label label))
|
|
|
|
((? bytevector? bv) ;old format
|
|
|
|
(bytevector->uuid bv 'dce))
|
|
|
|
((? string? device)
|
|
|
|
;; It used to be that we would not distinguish between labels and
|
|
|
|
;; device names. Try to infer the right thing here.
|
|
|
|
(if (string-prefix? "/dev/" device)
|
|
|
|
device
|
|
|
|
(file-system-label device)))))
|
|
|
|
|
|
|
|
(match (read port)
|
|
|
|
(('boot-parameters ('version 0)
|
|
|
|
('label label) ('root-device root)
|
|
|
|
('kernel linux)
|
|
|
|
rest ...)
|
|
|
|
(boot-parameters
|
|
|
|
(label label)
|
|
|
|
(root-device (device-sexp->device root))
|
|
|
|
|
|
|
|
(bootloader-name
|
|
|
|
(match (assq 'bootloader-name rest)
|
|
|
|
((_ args) args)
|
|
|
|
(#f 'grub))) ; for compatibility reasons.
|
|
|
|
|
|
|
|
(bootloader-menu-entries
|
|
|
|
(match (assq 'bootloader-menu-entries rest)
|
|
|
|
((_ entries) (map sexp->menu-entry entries))
|
|
|
|
(#f '())))
|
|
|
|
|
|
|
|
;; In the past, we would store the directory name of the kernel instead
|
|
|
|
;; of the absolute file name of its image. Detect that and correct it.
|
|
|
|
(kernel (if (string=? linux (direct-store-path linux))
|
|
|
|
(string-append linux "/"
|
|
|
|
(system-linux-image-file-name))
|
|
|
|
linux))
|
|
|
|
|
|
|
|
(kernel-arguments
|
|
|
|
(match (assq 'kernel-arguments rest)
|
|
|
|
((_ args) args)
|
|
|
|
(#f '()))) ;the old format
|
|
|
|
|
|
|
|
(initrd
|
|
|
|
(match (assq 'initrd rest)
|
|
|
|
(('initrd ('string-append directory file)) ;the old format
|
|
|
|
(string-append directory file))
|
|
|
|
(('initrd (? string? file))
|
|
|
|
file)))
|
|
|
|
|
|
|
|
(store-device
|
|
|
|
;; Linux device names like "/dev/sda1" are not suitable GRUB device
|
|
|
|
;; identifiers, so we just filter them out.
|
|
|
|
(ensure-not-/dev
|
|
|
|
(match (assq 'store rest)
|
|
|
|
(('store ('device #f) _ ...)
|
|
|
|
root-device)
|
|
|
|
(('store ('device device) _ ...)
|
|
|
|
(device-sexp->device device))
|
|
|
|
(_ ;the old format
|
|
|
|
root-device))))
|
|
|
|
|
|
|
|
(store-mount-point
|
|
|
|
(match (assq 'store rest)
|
|
|
|
(('store ('device _) ('mount-point mount-point) _ ...)
|
|
|
|
mount-point)
|
|
|
|
(_ ;the old format
|
|
|
|
"/")))))
|
|
|
|
(x ;unsupported format
|
|
|
|
(warning (G_ "unrecognized boot parameters at '~a'~%")
|
|
|
|
(port-filename port))
|
|
|
|
#f)))
|
|
|
|
|
|
|
|
(define (read-boot-parameters-file system)
|
|
|
|
"Read boot parameters from SYSTEM's (system or generation) \"parameters\"
|
|
|
|
file and returns the corresponding <boot-parameters> object or #f if the
|
|
|
|
format is unrecognized.
|
|
|
|
The object has its kernel-arguments extended in order to make it bootable."
|
|
|
|
(let* ((file (string-append system "/parameters"))
|
|
|
|
(params (call-with-input-file file read-boot-parameters))
|
|
|
|
(root (boot-parameters-root-device params)))
|
|
|
|
(boot-parameters
|
|
|
|
(inherit params)
|
|
|
|
(kernel-arguments (append (bootable-kernel-arguments system root)
|
|
|
|
(boot-parameters-kernel-arguments params))))))
|
|
|
|
|
|
|
|
(define (boot-parameters->menu-entry conf)
|
|
|
|
(menu-entry
|
|
|
|
(label (boot-parameters-label conf))
|
|
|
|
(device (boot-parameters-store-device conf))
|
|
|
|
(device-mount-point (boot-parameters-store-mount-point conf))
|
|
|
|
(linux (boot-parameters-kernel conf))
|
|
|
|
(linux-arguments (boot-parameters-kernel-arguments conf))
|
|
|
|
(initrd (boot-parameters-initrd conf))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
;;; Services.
|
|
|
|
;;;
|
|
|
|
|
|
|
|
(define (non-boot-file-system-service os)
|
|
|
|
"Return the file system service for the file systems of OS that are not
|
|
|
|
marked as 'needed-for-boot'."
|
|
|
|
(define file-systems
|
|
|
|
(remove file-system-needed-for-boot?
|
|
|
|
(operating-system-file-systems os)))
|
|
|
|
|
|
|
|
(define mapped-devices-for-boot
|
|
|
|
(operating-system-boot-mapped-devices os))
|
|
|
|
|
|
|
|
(define (device-mappings fs)
|
|
|
|
(let ((device (file-system-device fs)))
|
|
|
|
(if (string? device) ;title is 'device
|
|
|
|
(filter (lambda (md)
|
|
|
|
(string=? (string-append "/dev/mapper/"
|
|
|
|
(mapped-device-target md))
|
|
|
|
device))
|
|
|
|
(operating-system-mapped-devices os))
|
|
|
|
'())))
|
|
|
|
|
|
|
|
(define (add-dependencies fs)
|
|
|
|
;; Add the dependencies due to device mappings to FS.
|
|
|
|
(file-system
|
|
|
|
(inherit fs)
|
|
|
|
(dependencies
|
|
|
|
(delete-duplicates
|
|
|
|
(remove (cut member <> mapped-devices-for-boot)
|
|
|
|
(append (device-mappings fs)
|
|
|
|
(file-system-dependencies fs)))
|
|
|
|
eq?))))
|
|
|
|
|
|
|
|
(service file-system-service-type
|
|
|
|
(map add-dependencies file-systems)))
|
|
|
|
|
|
|
|
(define (mapped-device-users device file-systems)
|
|
|
|
"Return the subset of FILE-SYSTEMS that use DEVICE."
|
|
|
|
(let ((target (string-append "/dev/mapper/" (mapped-device-target device))))
|
|
|
|
(filter (lambda (fs)
|
|
|
|
(or (member device (file-system-dependencies fs))
|
|
|
|
(and (string? (file-system-device fs))
|
|
|
|
(string=? (file-system-device fs) target))))
|
|
|
|
file-systems)))
|
|
|
|
|
|
|
|
(define (operating-system-user-mapped-devices os)
|
|
|
|
"Return the subset of mapped devices that can be installed in
|
|
|
|
user-land--i.e., those not needed during boot."
|
|
|
|
(let ((devices (operating-system-mapped-devices os))
|
|
|
|
(file-systems (operating-system-file-systems os)))
|
|
|
|
(filter (lambda (md)
|
|
|
|
(let ((users (mapped-device-users md file-systems)))
|
|
|
|
(not (any file-system-needed-for-boot? users))))
|
|
|
|
devices)))
|
|
|
|
|
|
|
|
(define (operating-system-boot-mapped-devices os)
|
|
|
|
"Return the subset of mapped devices that must be installed during boot,
|
|
|
|
from the initrd."
|
|
|
|
(let ((devices (operating-system-mapped-devices os))
|
|
|
|
(file-systems (operating-system-file-systems os)))
|
|
|
|
(filter (lambda (md)
|
|
|
|
(let ((users (mapped-device-users md file-systems)))
|
|
|
|
(any file-system-needed-for-boot? users)))
|
|
|
|
devices)))
|
|
|
|
|
|
|
|
(define (device-mapping-services os)
|
system: Make service procedures non-monadic.
* gnu/services/avahi.scm (configuration-file): Use 'plain-file' instead
of 'text-file'.
(avahi-service): Turn into a regular procedure that returns a <service>.
* gnu/services/base.scm (root-file-system-service, file-system-service,
user-unmount-service, user-processes-service, host-name-service,
console-keymap-service, console-font-service, mingetty-service,
nscd.conf-file, nscd-service): Likewise.
(%default-syslog.conf): New variable.
(syslog-service): Use it. Turn into a regular procedure.
(guix-service, udev-rules-union, kvm-udev-rule, udev-service,
device-mapping-service, swap-service): Likewise.
* gnu/services/databases.scm (%default-postgres-hba,
%default-postgres-ident): Use 'plain-file' instead of 'text-file'.
(%default-postgres-config): Use 'mixed-text-file' instead of
'text-file*'.
(postgresql-service): Use 'program-file' instead of 'gexp->script'.
Turn into a regular procedure.
* gnu/services/desktop.scm (dbus-configuration-directory): Use
'computed-file' instead of 'gexp->derivation'.
(upower-configuration-file, geoclue-configuration-file,
elogind-configuration-file): Use 'plain-file' instead of 'text-file'.
(dbus-service, upower-service, colord-service, geoclue-service,
polkit-service, elogind-service): Turn into regular procedures.
(%desktop-services): Remove use of 'mlet' when iterating on
%BASE-SERVICES.
* gnu/services/lirc.scm (lirc-service): Turn into a regular procedure.
* gnu/services/networking.scm (static-networking-service,
dhcp-client-service, ntp-service, tor-service, bitlbee-service,
wicd-service): Likewise.
* gnu/services/ssh.scm (lsh-service): Likewise.
* gnu/services/web.scm (nginx-service): Likewise.
* gnu/services/xorg.scm (xorg-configuration-file): Use 'mixed-text-file'
instead of 'text-file*'.
(xorg-start-command, slim-service): Turn into regular procedures.
(xinitrc): Use 'program-file' instead of 'gexp->script'.
* gnu/system/install.scm (cow-store-service,
configuration-template-service): Turn into regular procedures.
* gnu/system.scm (other-file-system-services, device-mapping-services,
swap-services, essential-services, operating-system-services,
user-shells, operating-system-accounts): Remove now unnecessary
'mlet' and turn into regular procedures.
(operating-system-etc-directory, operating-system-activation-script,
operating-system-boot-script): Adjust accordingly.
* doc/guix.texi (Base Services, Networking Services, X Window, Desktop
Services, Database Services, Web Services, Various Services, Name
Service Switch): Adjust accordingly.
7 years ago
|
|
|
"Return the list of device-mapping services for OS as a list."
|
|
|
|
(map device-mapping-service
|
system: Make service procedures non-monadic.
* gnu/services/avahi.scm (configuration-file): Use 'plain-file' instead
of 'text-file'.
(avahi-service): Turn into a regular procedure that returns a <service>.
* gnu/services/base.scm (root-file-system-service, file-system-service,
user-unmount-service, user-processes-service, host-name-service,
console-keymap-service, console-font-service, mingetty-service,
nscd.conf-file, nscd-service): Likewise.
(%default-syslog.conf): New variable.
(syslog-service): Use it. Turn into a regular procedure.
(guix-service, udev-rules-union, kvm-udev-rule, udev-service,
device-mapping-service, swap-service): Likewise.
* gnu/services/databases.scm (%default-postgres-hba,
%default-postgres-ident): Use 'plain-file' instead of 'text-file'.
(%default-postgres-config): Use 'mixed-text-file' instead of
'text-file*'.
(postgresql-service): Use 'program-file' instead of 'gexp->script'.
Turn into a regular procedure.
* gnu/services/desktop.scm (dbus-configuration-directory): Use
'computed-file' instead of 'gexp->derivation'.
(upower-configuration-file, geoclue-configuration-file,
elogind-configuration-file): Use 'plain-file' instead of 'text-file'.
(dbus-service, upower-service, colord-service, geoclue-service,
polkit-service, elogind-service): Turn into regular procedures.
(%desktop-services): Remove use of 'mlet' when iterating on
%BASE-SERVICES.
* gnu/services/lirc.scm (lirc-service): Turn into a regular procedure.
* gnu/services/networking.scm (static-networking-service,
dhcp-client-service, ntp-service, tor-service, bitlbee-service,
wicd-service): Likewise.
* gnu/services/ssh.scm (lsh-service): Likewise.
* gnu/services/web.scm (nginx-service): Likewise.
* gnu/services/xorg.scm (xorg-configuration-file): Use 'mixed-text-file'
instead of 'text-file*'.
(xorg-start-command, slim-service): Turn into regular procedures.
(xinitrc): Use 'program-file' instead of 'gexp->script'.
* gnu/system/install.scm (cow-store-service,
configuration-template-service): Turn into regular procedures.
* gnu/system.scm (other-file-system-services, device-mapping-services,
swap-services, essential-services, operating-system-services,
user-shells, operating-system-accounts): Remove now unnecessary
'mlet' and turn into regular procedures.
(operating-system-etc-directory, operating-system-activation-script,
operating-system-boot-script): Adjust accordingly.
* doc/guix.texi (Base Services, Networking Services, X Window, Desktop
Services, Database Services, Web Services, Various Services, Name
Service Switch): Adjust accordingly.
7 years ago
|
|
|
(operating-system-user-mapped-devices os)))
|
|
|
|
|
|
|
|
(define (swap-services os)
|
system: Make service procedures non-monadic.
* gnu/services/avahi.scm (configuration-file): Use 'plain-file' instead
of 'text-file'.
(avahi-service): Turn into a regular procedure that returns a <service>.
* gnu/services/base.scm (root-file-system-service, file-system-service,
user-unmount-service, user-processes-service, host-name-service,
console-keymap-service, console-font-service, mingetty-service,
nscd.conf-file, nscd-service): Likewise.
(%default-syslog.conf): New variable.
(syslog-service): Use it. Turn into a regular procedure.
(guix-service, udev-rules-union, kvm-udev-rule, udev-service,
device-mapping-service, swap-service): Likewise.
* gnu/services/databases.scm (%default-postgres-hba,
%default-postgres-ident): Use 'plain-file' instead of 'text-file'.
(%default-postgres-config): Use 'mixed-text-file' instead of
'text-file*'.
(postgresql-service): Use 'program-file' instead of 'gexp->script'.
Turn into a regular procedure.
* gnu/services/desktop.scm (dbus-configuration-directory): Use
'computed-file' instead of 'gexp->derivation'.
(upower-configuration-file, geoclue-configuration-file,
elogind-configuration-file): Use 'plain-file' instead of 'text-file'.
(dbus-service, upower-service, colord-service, geoclue-service,
polkit-service, elogind-service): Turn into regular procedures.
(%desktop-services): Remove use of 'mlet' when iterating on
%BASE-SERVICES.
* gnu/services/lirc.scm (lirc-service): Turn into a regular procedure.
* gnu/services/networking.scm (static-networking-service,
dhcp-client-service, ntp-service, tor-service, bitlbee-service,
wicd-service): Likewise.
* gnu/services/ssh.scm (lsh-service): Likewise.
* gnu/services/web.scm (nginx-service): Likewise.
* gnu/services/xorg.scm (xorg-configuration-file): Use 'mixed-text-file'
instead of 'text-file*'.
(xorg-start-command, slim-service): Turn into regular procedures.
(xinitrc): Use 'program-file' instead of 'gexp->script'.
* gnu/system/install.scm (cow-store-service,
configuration-template-service): Turn into regular procedures.
* gnu/system.scm (other-file-system-services, device-mapping-services,
swap-services, essential-services, operating-system-services,
user-shells, operating-system-accounts): Remove now unnecessary
'mlet' and turn into regular procedures.
(operating-system-etc-directory, operating-system-activation-script,
operating-system-boot-script): Adjust accordingly.
* doc/guix.texi (Base Services, Networking Services, X Window, Desktop
Services, Database Services, Web Services, Various Services, Name
Service Switch): Adjust accordingly.
7 years ago
|
|
|
"Return the list of swap services for OS."
|
|
|
|
(map swap-service (operating-system-swap-devices os)))
|
|
|
|
|
|
|
|
(define* (system-linux-image-file-name)
|
|
|
|
"Return the basename of the kernel image file for SYSTEM."
|
|
|
|
;; FIXME: Evaluate the conditional based on the actual current system.
|
|
|
|
(let ((target (or (%current-target-system) (%current-system))))
|
|
|
|
(cond
|
|
|
|
((string-prefix? "arm" target) "zImage")
|
|
|
|
((string-prefix? "mips" target) "vmlinuz")
|
|
|
|
((string-prefix? "aarch64" target) "Image")
|
|
|
|
(else "bzImage"))))
|
|
|
|
|
|
|
|
(define (operating-system-kernel-file os)
|
|
|
|
"Return an object representing the absolute file name of the kernel image of
|
|
|
|
OS."
|
|
|
|
(file-append (operating-system-kernel os)
|
|
|
|
"/" (system-linux-image-file-name)))
|
|
|
|
|
|
|
|
(define (package-for-kernel target-kernel module-package)
|
|
|
|
"Return a package like MODULE-PACKAGE, adapted for TARGET-KERNEL, if
|
|
|
|
possible (that is if there's a LINUX keyword argument in the build system)."
|
|
|
|
(package
|
|
|
|
(inherit module-package)
|
|
|
|
(arguments
|
|
|
|
(substitute-keyword-arguments (package-arguments module-package)
|
|
|
|
((#:linux kernel #f)
|
|
|
|
target-kernel)))))
|
|
|
|
|
|
|
|
(define* (operating-system-directory-base-entries os)
|
|
|
|
"Return the basic entries of the 'system' directory of OS for use as the
|
|
|
|
value of the SYSTEM-SERVICE-TYPE service."
|
|
|
|
(let ((locale (operating-system-locale-directory os)))
|
|
|
|
(mlet* %store-monad ((kernel -> (operating-system-kernel os))
|
|
|
|
(modules ->
|
|
|
|
(operating-system-kernel-loadable-modules os))
|
|
|
|
(kernel
|
|
|
|
(profile-derivation
|
|
|
|
(packages->manifest
|
|
|
|
(cons kernel
|
|
|
|
(map (lambda (module)
|
|
|
|
(if (package? module)
|
|
|
|
(package-for-kernel kernel module)
|
|
|
|
module))
|
|
|
|
modules)))
|
|
|
|
#:hooks (list linux-module-database)))
|
|
|
|
(initrd -> (operating-system-initrd-file os))
|
|
|
|
(params -> (operating-system-boot-parameters-file os)))
|
|
|
|
(return `(("kernel" ,kernel)
|
|
|
|
("parameters" ,params)
|
|
|
|
("initrd" ,initrd)
|
|
|
|
("locale" ,locale)))))) ;used by libc
|
|
|
|
|
|
|
|
(define (operating-system-default-essential-services os)
|
|
|
|
"Return the list of essential services for OS. These are special services
|
|
|
|
that implement part of what's declared in OS are responsible for low-level
|
|
|
|
bookkeeping."
|
|
|
|
(define known-fs
|
|
|
|
(map file-system-mount-point (operating-system-file-systems os)))
|
|
|
|
|
system: Make service procedures non-monadic.
* gnu/services/avahi.scm (configuration-file): Use 'plain-file' instead
of 'text-file'.
(avahi-service): Turn into a regular procedure that returns a <service>.
* gnu/services/base.scm (root-file-system-service, file-system-service,
user-unmount-service, user-processes-service, host-name-service,
console-keymap-service, console-font-service, mingetty-service,
nscd.conf-file, nscd-service): Likewise.
(%default-syslog.conf): New variable.
(syslog-service): Use it. Turn into a regular procedure.
(guix-service, udev-rules-union, kvm-udev-rule, udev-service,
device-mapping-service, swap-service): Likewise.
* gnu/services/databases.scm (%default-postgres-hba,
%default-postgres-ident): Use 'plain-file' instead of 'text-file'.
(%default-postgres-config): Use 'mixed-text-file' instead of
'text-file*'.
(postgresql-service): Use 'program-file' instead of 'gexp->script'.
Turn into a regular procedure.
* gnu/services/desktop.scm (dbus-configuration-directory): Use
'computed-file' instead of 'gexp->derivation'.
(upower-configuration-file, geoclue-configuration-file,
elogind-configuration-file): Use 'plain-file' instead of 'text-file'.
(dbus-service, upower-service, colord-service, geoclue-service,
polkit-service, elogind-service): Turn into regular procedures.
(%desktop-services): Remove use of 'mlet' when iterating on
%BASE-SERVICES.
* gnu/services/lirc.scm (lirc-service): Turn into a regular procedure.
* gnu/services/networking.scm (static-networking-service,
dhcp-client-service, ntp-service, tor-service, bitlbee-service,
wicd-service): Likewise.
* gnu/services/ssh.scm (lsh-service): Likewise.
* gnu/services/web.scm (nginx-service): Likewise.
* gnu/services/xorg.scm (xorg-configuration-file): Use 'mixed-text-file'
instead of 'text-file*'.
(xorg-start-command, slim-service): Turn into regular procedures.
(xinitrc): Use 'program-file' instead of 'gexp->script'.
* gnu/system/install.scm (cow-store-service,
configuration-template-service): Turn into regular procedures.
* gnu/system.scm (other-file-system-services, device-mapping-services,
swap-services, essential-services, operating-system-services,
user-shells, operating-system-accounts): Remove now unnecessary
'mlet' and turn into regular procedures.
(operating-system-etc-directory, operating-system-activation-script,
operating-system-boot-script): Adjust accordingly.
* doc/guix.texi (Base Services, Networking Services, X Window, Desktop
Services, Database Services, Web Services, Various Services, Name
Service Switch): Adjust accordingly.
7 years ago
|
|
|
(let* ((mappings (device-mapping-services os))
|
|
|
|
(root-fs (root-file-system-service))
|
|
|
|
(other-fs (non-boot-file-system-service os))
|
system: Make service procedures non-monadic.
* gnu/services/avahi.scm (configuration-file): Use 'plain-file' instead
of 'text-file'.
(avahi-service): Turn into a regular procedure that returns a <service>.
* gnu/services/base.scm (root-file-system-service, file-system-service,
user-unmount-service, user-processes-service, host-name-service,
console-keymap-service, console-font-service, mingetty-service,
nscd.conf-file, nscd-service): Likewise.
(%default-syslog.conf): New variable.
(syslog-service): Use it. Turn into a regular procedure.
(guix-service, udev-rules-union, kvm-udev-rule, udev-service,
device-mapping-service, swap-service): Likewise.
* gnu/services/databases.scm (%default-postgres-hba,
%default-postgres-ident): Use 'plain-file' instead of 'text-file'.
(%default-postgres-config): Use 'mixed-text-file' instead of
'text-file*'.
(postgresql-service): Use 'program-file' instead of 'gexp->script'.
Turn into a regular procedure.
* gnu/services/desktop.scm (dbus-configuration-directory): Use
'computed-file' instead of 'gexp->derivation'.
(upower-configuration-file, geoclue-configuration-file,
elogind-configuration-file): Use 'plain-file' instead of 'text-file'.
(dbus-service, upower-service, colord-service, geoclue-service,
polkit-service, elogind-service): Turn into regular procedures.
(%desktop-services): Remove use of 'mlet' when iterating on
%BASE-SERVICES.
* gnu/services/lirc.scm (lirc-service): Turn into a regular procedure.
* gnu/services/networking.scm (static-networking-service,
dhcp-client-service, ntp-service, tor-service, bitlbee-service,
wicd-service): Likewise.
* gnu/services/ssh.scm (lsh-service): Likewise.
* gnu/services/web.scm (nginx-service): Likewise.
* gnu/services/xorg.scm (xorg-configuration-file): Use 'mixed-text-file'
instead of 'text-file*'.
(xorg-start-command, slim-service): Turn into regular procedures.
(xinitrc): Use 'program-file' instead of 'gexp->script'.
* gnu/system/install.scm (cow-store-service,
configuration-template-service): Turn into regular procedures.
* gnu/system.scm (other-file-system-services, device-mapping-services,
swap-services, essential-services, operating-system-services,
user-shells, operating-system-accounts): Remove now unnecessary
'mlet' and turn into regular procedures.
(operating-system-etc-directory, operating-system-activation-script,
operating-system-boot-script): Adjust accordingly.
* doc/guix.texi (Base Services, Networking Services, X Window, Desktop
Services, Database Services, Web Services, Various Services, Name
Service Switch): Adjust accordingly.
7 years ago
|
|
|
(swaps (swap-services os))
|
|
|
|
(procs (service user-processes-service-type))
|
|