2013-12-09 15:32:36 -05:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2022-03-20 17:13:48 -04:00
|
|
|
|
;;; Copyright © 2013-2022 Ludovic Courtès <ludo@gnu.org>
|
2015-02-24 23:54:29 -05:00
|
|
|
|
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
|
2016-02-11 05:52:48 -05:00
|
|
|
|
;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
|
2016-10-28 06:07:18 -04:00
|
|
|
|
;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
|
2017-04-02 09:52:29 -04:00
|
|
|
|
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
2019-01-05 08:06:47 -05:00
|
|
|
|
;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
|
2020-12-21 07:02:01 -05:00
|
|
|
|
;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
|
2020-02-18 04:42:07 -05:00
|
|
|
|
;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
|
2021-07-06 16:03:19 -04:00
|
|
|
|
;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re>
|
2020-04-29 11:17:55 -04:00
|
|
|
|
;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
|
2022-02-18 15:42:07 -05:00
|
|
|
|
;;; Copyright © 2020, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
2023-05-15 13:11:35 -04:00
|
|
|
|
;;; Copyright © 2020, 2023 Janneke Nieuwenhuizen <jannek@gnu.org>
|
2022-03-07 15:47:27 -05:00
|
|
|
|
;;; Copyright © 2020, 2022 Efraim Flashner <efraim@flashner.co.il>
|
2021-01-22 14:06:55 -05:00
|
|
|
|
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
|
2021-03-21 23:23:32 -04:00
|
|
|
|
;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com>
|
2023-01-27 16:06:12 -05:00
|
|
|
|
;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
|
2013-12-09 15:32:36 -05:00
|
|
|
|
;;;
|
|
|
|
|
;;; 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)
|
2018-12-19 15:22:20 -05:00
|
|
|
|
#:use-module (guix inferior)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (guix store)
|
2022-05-14 01:30:44 -04:00
|
|
|
|
#:use-module (guix memoization)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (guix monads)
|
2014-04-26 10:36:48 -04:00
|
|
|
|
#:use-module (guix gexp)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (guix records)
|
|
|
|
|
#:use-module (guix packages)
|
2022-11-28 13:57:58 -05:00
|
|
|
|
#:use-module (guix deprecation)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (guix derivations)
|
2014-08-11 16:18:33 -04:00
|
|
|
|
#:use-module (guix profiles)
|
2020-07-24 16:58:08 -04:00
|
|
|
|
#:use-module ((guix utils) #:select (substitute-keyword-arguments))
|
|
|
|
|
#:use-module (guix i18n)
|
|
|
|
|
#:use-module (guix diagnostics)
|
2022-05-14 01:30:44 -04:00
|
|
|
|
#:use-module (guix ui)
|
2020-10-09 05:47:34 -04:00
|
|
|
|
#:use-module (gnu packages admin)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (gnu packages base)
|
|
|
|
|
#:use-module (gnu packages bash)
|
2020-10-09 05:47:34 -04:00
|
|
|
|
#:use-module (gnu packages compression)
|
2020-05-26 11:38:30 -04:00
|
|
|
|
#:use-module (gnu packages cross-base)
|
2020-10-09 05:47:34 -04:00
|
|
|
|
#:use-module (gnu packages firmware)
|
|
|
|
|
#:use-module (gnu packages gawk)
|
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.
2014-08-26 18:25:17 -04:00
|
|
|
|
#:use-module (gnu packages guile)
|
2019-04-24 06:35:06 -04:00
|
|
|
|
#:use-module (gnu packages guile-xyz)
|
2020-05-26 11:38:30 -04:00
|
|
|
|
#:use-module (gnu packages hurd)
|
2014-06-04 08:59:24 -04:00
|
|
|
|
#:use-module (gnu packages less)
|
2020-10-09 05:47:34 -04:00
|
|
|
|
#:use-module (gnu packages linux)
|
2014-12-07 16:59:46 -05:00
|
|
|
|
#:use-module (gnu packages man)
|
2020-10-09 05:47:34 -04:00
|
|
|
|
#:use-module (gnu packages nano)
|
install: Deduplicate packages with %base-package sets.
* gnu/system.scm (%base-packages-interactive): Add nvi.
* gnu/system/install.scm (installation-os)[packages]: Remove parted,
gptfdisk, ddrescue, cryptsetup, mdadm, dosfstools, btrfs-progs,
f2fs-tools, jfstools, openssh, wireless-tools, iw,
wpa-supplicant-minimal, iproute, bash-completion, nvi. Add
%base-packages-disk-utilities.
2020-10-09 05:51:26 -04:00
|
|
|
|
#:use-module (gnu packages nvi)
|
2020-10-09 05:47:34 -04:00
|
|
|
|
#:use-module (gnu packages package-management)
|
|
|
|
|
#:use-module (gnu packages pciutils)
|
2016-02-08 17:34:50 -05:00
|
|
|
|
#:use-module (gnu packages texinfo)
|
2021-07-09 04:20:39 -04:00
|
|
|
|
#:use-module (gnu packages text-editors)
|
2021-05-07 12:17:26 -04:00
|
|
|
|
#:use-module (gnu packages wget)
|
2014-02-19 14:58:24 -05:00
|
|
|
|
#:use-module (gnu services)
|
2016-01-27 07:45:01 -05:00
|
|
|
|
#:use-module (gnu services shepherd)
|
2014-02-19 14:58:24 -05:00
|
|
|
|
#:use-module (gnu services base)
|
2017-05-15 16:24:18 -04:00
|
|
|
|
#:use-module (gnu bootloader)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (gnu system shadow)
|
2015-02-04 15:58:15 -05:00
|
|
|
|
#:use-module (gnu system nss)
|
2014-11-26 16:49:11 -05:00
|
|
|
|
#:use-module (gnu system locale)
|
2015-11-03 12:08:47 -05:00
|
|
|
|
#:use-module (gnu system pam)
|
2014-01-29 07:04:00 -05:00
|
|
|
|
#:use-module (gnu system linux-initrd)
|
2021-07-06 16:03:19 -04:00
|
|
|
|
#:use-module (gnu system setuid)
|
2017-09-06 03:28:28 -04:00
|
|
|
|
#:use-module (gnu system uuid)
|
2014-05-20 15:59:08 -04:00
|
|
|
|
#:use-module (gnu system file-systems)
|
2016-04-17 11:53:20 -04:00
|
|
|
|
#:use-module (gnu system mapped-devices)
|
2022-05-14 01:30:44 -04:00
|
|
|
|
#:use-module (ice-9 format)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (ice-9 match)
|
|
|
|
|
#:use-module (srfi srfi-1)
|
|
|
|
|
#:use-module (srfi srfi-26)
|
2014-11-26 16:49:11 -05:00
|
|
|
|
#:use-module (srfi srfi-34)
|
|
|
|
|
#:use-module (srfi srfi-35)
|
2022-05-14 01:30:44 -04:00
|
|
|
|
#:use-module (srfi srfi-71)
|
2016-11-03 09:10:28 -04:00
|
|
|
|
#:use-module (rnrs bytevectors)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:export (operating-system
|
|
|
|
|
operating-system?
|
2019-03-29 18:22:27 -04:00
|
|
|
|
this-operating-system
|
2014-05-18 15:58:01 -04:00
|
|
|
|
|
|
|
|
|
operating-system-bootloader
|
2013-12-09 15:32:36 -05:00
|
|
|
|
operating-system-services
|
2019-03-22 12:48:37 -04:00
|
|
|
|
operating-system-essential-services
|
2019-05-10 11:45:06 -04:00
|
|
|
|
operating-system-default-essential-services
|
2014-05-09 16:58:46 -04:00
|
|
|
|
operating-system-user-services
|
2013-12-09 15:32:36 -05:00
|
|
|
|
operating-system-packages
|
2014-01-31 08:36:48 -05:00
|
|
|
|
operating-system-host-name
|
2023-01-27 16:06:12 -05:00
|
|
|
|
operating-system-hosts-file ;deprecated
|
2020-05-03 09:09:15 -04:00
|
|
|
|
operating-system-hurd
|
2014-01-31 08:36:48 -05:00
|
|
|
|
operating-system-kernel
|
2016-09-09 17:27:00 -04:00
|
|
|
|
operating-system-kernel-file
|
2017-04-21 08:37:08 -04:00
|
|
|
|
operating-system-kernel-arguments
|
2019-04-15 05:30:50 -04:00
|
|
|
|
operating-system-label
|
|
|
|
|
operating-system-default-label
|
2018-02-27 05:42:09 -05:00
|
|
|
|
operating-system-initrd-modules
|
2014-01-31 08:36:48 -05:00
|
|
|
|
operating-system-initrd
|
|
|
|
|
operating-system-users
|
|
|
|
|
operating-system-groups
|
2014-05-31 16:01:05 -04:00
|
|
|
|
operating-system-issue
|
2014-01-31 08:36:48 -05:00
|
|
|
|
operating-system-timezone
|
|
|
|
|
operating-system-locale
|
2014-11-26 16:49:11 -05:00
|
|
|
|
operating-system-locale-definitions
|
2015-10-30 18:05:52 -04:00
|
|
|
|
operating-system-locale-libcs
|
2014-09-11 17:39:15 -04:00
|
|
|
|
operating-system-mapped-devices
|
2014-05-02 18:26:07 -04:00
|
|
|
|
operating-system-file-systems
|
2016-01-21 16:45:54 -05:00
|
|
|
|
operating-system-store-file-system
|
2016-07-17 18:51:02 -04:00
|
|
|
|
operating-system-user-mapped-devices
|
|
|
|
|
operating-system-boot-mapped-devices
|
2020-12-21 07:02:01 -05:00
|
|
|
|
operating-system-bootloader-crypto-devices
|
2014-06-26 18:06:46 -04:00
|
|
|
|
operating-system-activation-script
|
2016-05-04 16:48:28 -04:00
|
|
|
|
operating-system-user-accounts
|
|
|
|
|
operating-system-shepherd-service-names
|
2018-01-09 03:24:00 -05:00
|
|
|
|
operating-system-user-kernel-arguments
|
2020-03-05 05:38:42 -05:00
|
|
|
|
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
|
2020-03-23 13:32:02 -04:00
|
|
|
|
operating-system-kernel-loadable-modules
|
2020-07-14 19:31:23 -04:00
|
|
|
|
operating-system-location
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2014-04-27 08:58:15 -04:00
|
|
|
|
operating-system-derivation
|
2014-05-02 18:26:07 -04:00
|
|
|
|
operating-system-profile
|
2017-04-02 09:52:29 -04:00
|
|
|
|
operating-system-bootcfg
|
2015-06-08 08:59:00 -04:00
|
|
|
|
operating-system-etc-directory
|
|
|
|
|
operating-system-locale-directory
|
|
|
|
|
operating-system-boot-script
|
2020-04-28 08:12:34 -04:00
|
|
|
|
operating-system-uuid
|
2015-06-08 08:59:00 -04:00
|
|
|
|
|
2017-02-14 10:28:31 -05:00
|
|
|
|
system-linux-image-file-name
|
2019-05-10 16:29:10 -04:00
|
|
|
|
operating-system-with-gc-roots
|
2019-11-30 12:05:07 -05:00
|
|
|
|
operating-system-with-provenance
|
2017-02-14 10:28:31 -05:00
|
|
|
|
|
2020-05-03 08:13:58 -04:00
|
|
|
|
hurd-default-essential-services
|
|
|
|
|
|
2016-01-07 18:48:17 -05:00
|
|
|
|
boot-parameters
|
|
|
|
|
boot-parameters?
|
|
|
|
|
boot-parameters-label
|
|
|
|
|
boot-parameters-root-device
|
2017-06-10 04:47:25 -04:00
|
|
|
|
boot-parameters-bootloader-name
|
2019-08-28 17:27:20 -04:00
|
|
|
|
boot-parameters-bootloader-menu-entries
|
2020-12-21 07:02:01 -05:00
|
|
|
|
boot-parameters-store-crypto-devices
|
2016-10-28 06:07:18 -04:00
|
|
|
|
boot-parameters-store-device
|
2020-10-24 12:15:53 -04:00
|
|
|
|
boot-parameters-store-directory-prefix
|
2016-10-28 06:07:18 -04:00
|
|
|
|
boot-parameters-store-mount-point
|
2019-10-21 06:23:40 -04:00
|
|
|
|
boot-parameters-locale
|
2016-01-07 18:48:17 -05:00
|
|
|
|
boot-parameters-kernel
|
|
|
|
|
boot-parameters-kernel-arguments
|
2016-09-24 04:39:00 -04:00
|
|
|
|
boot-parameters-initrd
|
2020-05-26 11:38:30 -04:00
|
|
|
|
boot-parameters-multiboot-modules
|
2022-02-18 15:42:07 -05:00
|
|
|
|
boot-parameters-version
|
|
|
|
|
%boot-parameters-version
|
2017-05-08 15:03:37 -04:00
|
|
|
|
read-boot-parameters
|
2017-04-21 08:37:09 -04:00
|
|
|
|
read-boot-parameters-file
|
2017-06-29 06:42:59 -04:00
|
|
|
|
boot-parameters->menu-entry
|
2016-01-07 18:48:17 -05:00
|
|
|
|
|
2023-01-27 16:06:12 -05:00
|
|
|
|
local-host-aliases ;deprecated
|
2018-11-16 06:43:55 -05:00
|
|
|
|
%root-account
|
2014-09-09 11:12:33 -04:00
|
|
|
|
%setuid-programs
|
2020-03-17 22:10:40 -04:00
|
|
|
|
%sudoers-specification
|
2014-09-11 17:39:15 -04:00
|
|
|
|
%base-packages
|
2021-09-28 06:18:40 -04:00
|
|
|
|
%base-packages-artwork
|
2020-04-04 03:59:48 -04:00
|
|
|
|
%base-packages-interactive
|
|
|
|
|
%base-packages-linux
|
|
|
|
|
%base-packages-networking
|
2020-10-09 05:47:34 -04:00
|
|
|
|
%base-packages-disk-utilities
|
2020-04-04 03:59:48 -04:00
|
|
|
|
%base-packages-utils
|
2020-04-29 11:17:55 -04:00
|
|
|
|
%base-firmware
|
|
|
|
|
%default-kernel-arguments))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;;
|
|
|
|
|
;;; This module supports whole-system configuration.
|
|
|
|
|
;;;
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2022-02-17 23:28:07 -05:00
|
|
|
|
(define* (bootable-kernel-arguments system root-device version)
|
|
|
|
|
"Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE.
|
|
|
|
|
VERSION is the target version of the boot-parameters record."
|
|
|
|
|
;; If the version is newer than 0, we use the new style initrd parameter
|
|
|
|
|
;; names, otherwise we use the legacy ones. This is to maintain backward
|
|
|
|
|
;; compatibility when producing bootloader configurations for older
|
|
|
|
|
;; generations.
|
|
|
|
|
(define version>0? (> version 0))
|
|
|
|
|
(list (string-append (if version>0? "root=" "--root=")
|
2020-02-11 23:56:45 -05:00
|
|
|
|
;; Note: Always use the DCE format because that's what
|
2022-02-17 23:28:07 -05:00
|
|
|
|
;; (gnu build linux-boot) expects for the 'root'
|
2020-02-11 23:56:45 -05:00
|
|
|
|
;; kernel command-line option.
|
|
|
|
|
(file-system-device->string root-device
|
|
|
|
|
#:uuid-type 'dce))
|
2022-02-17 23:28:07 -05:00
|
|
|
|
#~(string-append (if #$version>0? "gnu.system=" "--system=") #$system)
|
|
|
|
|
#~(string-append (if #$version>0? "gnu.load=" "--load=")
|
|
|
|
|
#$system "/boot")))
|
2017-04-21 08:37:08 -04:00
|
|
|
|
|
2013-12-09 15:32:36 -05:00
|
|
|
|
;; System-wide configuration.
|
2023-01-27 16:06:12 -05:00
|
|
|
|
|
|
|
|
|
(define-with-syntax-properties (warn-hosts-file-field-deprecation
|
|
|
|
|
(value properties))
|
|
|
|
|
(when value
|
|
|
|
|
(warning (source-properties->location properties)
|
|
|
|
|
(G_ "the 'hosts-file' field is deprecated, please use \
|
|
|
|
|
'hosts-service-type' instead~%")))
|
|
|
|
|
value)
|
|
|
|
|
|
2013-12-09 15:32:36 -05:00
|
|
|
|
;; TODO: Add per-field docstrings/stexi.
|
|
|
|
|
(define-record-type* <operating-system> operating-system
|
|
|
|
|
make-operating-system
|
|
|
|
|
operating-system?
|
2019-03-29 18:22:27 -04:00
|
|
|
|
this-operating-system
|
|
|
|
|
|
2013-12-09 15:32:36 -05:00
|
|
|
|
(kernel operating-system-kernel ; package
|
2015-08-04 10:38:06 -04:00
|
|
|
|
(default linux-libre))
|
2020-02-18 04:42:07 -05:00
|
|
|
|
(kernel-loadable-modules operating-system-kernel-loadable-modules
|
|
|
|
|
(default '())) ; list of packages
|
2017-04-20 22:21:20 -04:00
|
|
|
|
(kernel-arguments operating-system-user-kernel-arguments
|
2020-04-29 11:17:55 -04:00
|
|
|
|
(default %default-kernel-arguments)) ; list of gexps/strings
|
2020-05-03 09:09:15 -04:00
|
|
|
|
(hurd operating-system-hurd
|
|
|
|
|
(default #f)) ; package
|
2017-05-15 16:24:18 -04:00
|
|
|
|
(bootloader operating-system-bootloader) ; <bootloader-configuration>
|
2019-04-15 05:30:50 -04:00
|
|
|
|
(label operating-system-label ; string
|
|
|
|
|
(thunked)
|
|
|
|
|
(default (operating-system-default-label this-operating-system)))
|
2014-05-18 15:58:01 -04:00
|
|
|
|
|
2019-03-20 07:19:14 -04:00
|
|
|
|
(keyboard-layout operating-system-keyboard-layout ;#f | <keyboard-layout>
|
|
|
|
|
(default #f))
|
2018-11-15 12:39:18 -05:00
|
|
|
|
(initrd operating-system-initrd ; (list fs) -> file-like
|
2014-06-30 14:56:45 -04:00
|
|
|
|
(default base-initrd))
|
2018-02-27 05:42:09 -05:00
|
|
|
|
(initrd-modules operating-system-initrd-modules ; list of strings
|
|
|
|
|
(thunked) ; it's system-dependent
|
|
|
|
|
(default %base-initrd-modules))
|
|
|
|
|
|
2014-11-11 16:42:15 -05:00
|
|
|
|
(firmware operating-system-firmware ; list of packages
|
|
|
|
|
(default %base-firmware))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
|
|
|
|
(host-name operating-system-host-name) ; string
|
2023-01-27 16:06:12 -05:00
|
|
|
|
(hosts-file %operating-system-hosts-file ; deprecated
|
|
|
|
|
(default #f)
|
|
|
|
|
(sanitize warn-hosts-file-field-deprecation))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2014-09-11 17:39:15 -04:00
|
|
|
|
(mapped-devices operating-system-mapped-devices ; list of <mapped-device>
|
|
|
|
|
(default '()))
|
2014-06-26 18:11:38 -04:00
|
|
|
|
(file-systems operating-system-file-systems) ; list of fs
|
2021-11-15 15:26:27 -05:00
|
|
|
|
(swap-devices operating-system-swap-devices ; list of string | <swap-space>
|
|
|
|
|
(default '())
|
2021-11-15 15:26:28 -05:00
|
|
|
|
(delayed)
|
|
|
|
|
(sanitize warn-swap-devices-change))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
|
|
|
|
(users operating-system-users ; list of user accounts
|
2015-05-25 10:54:05 -04:00
|
|
|
|
(default %base-user-accounts))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
(groups operating-system-groups ; list of user groups
|
2014-06-22 16:16:14 -04:00
|
|
|
|
(default %base-groups))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2019-03-22 08:53:47 -04:00
|
|
|
|
(skeletons operating-system-skeletons ; list of name/file-like value
|
2014-05-12 17:37:13 -04:00
|
|
|
|
(default (default-skeletons)))
|
2014-05-31 16:01:05 -04:00
|
|
|
|
(issue operating-system-issue ; string
|
|
|
|
|
(default %default-issue))
|
2014-05-12 17:37:13 -04:00
|
|
|
|
|
2013-12-09 15:32:36 -05:00
|
|
|
|
(packages operating-system-packages ; list of (PACKAGE OUTPUT...)
|
2014-06-04 08:59:24 -04:00
|
|
|
|
(default %base-packages)) ; or just PACKAGE
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2022-10-10 22:22:16 -04:00
|
|
|
|
(timezone operating-system-timezone
|
|
|
|
|
(default "Etc/UTC")) ; string
|
2014-06-26 18:11:38 -04:00
|
|
|
|
(locale operating-system-locale ; string
|
2014-11-26 16:49:11 -05:00
|
|
|
|
(default "en_US.utf8"))
|
|
|
|
|
(locale-definitions operating-system-locale-definitions ; list of <locale-definition>
|
|
|
|
|
(default %default-locale-definitions))
|
2015-10-30 18:05:52 -04:00
|
|
|
|
(locale-libcs operating-system-locale-libcs ; list of <packages>
|
|
|
|
|
(default %default-locale-libcs))
|
2015-02-04 15:58:15 -05:00
|
|
|
|
(name-service-switch operating-system-name-service-switch ; <name-service-switch>
|
|
|
|
|
(default %default-nss))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(essential-services operating-system-essential-services ; list of services
|
|
|
|
|
(thunked)
|
2019-05-10 11:45:06 -04:00
|
|
|
|
(default (operating-system-default-essential-services
|
|
|
|
|
this-operating-system)))
|
2019-03-22 08:53:47 -04:00
|
|
|
|
(services operating-system-user-services ; list of services
|
2021-12-08 09:27:06 -05:00
|
|
|
|
(thunked) ;allow for system-dependent services
|
2014-04-30 16:17:56 -04:00
|
|
|
|
(default %base-services))
|
|
|
|
|
|
|
|
|
|
(pam-services operating-system-pam-services ; list of PAM services
|
|
|
|
|
(default (base-pam-services)))
|
2021-08-12 05:58:47 -04:00
|
|
|
|
(setuid-programs operating-system-setuid-programs
|
|
|
|
|
(default %setuid-programs) ; list of <setuid-program>
|
|
|
|
|
(sanitize ensure-setuid-program-list))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2015-06-15 06:18:20 -04:00
|
|
|
|
(sudoers-file operating-system-sudoers-file ; file-like
|
2020-07-14 19:31:23 -04:00
|
|
|
|
(default %sudoers-specification))
|
|
|
|
|
|
|
|
|
|
(location operating-system-location ; <location>
|
|
|
|
|
(default (and=> (current-source-location)
|
|
|
|
|
source-properties->location))
|
|
|
|
|
(innate)))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2023-01-27 16:06:12 -05:00
|
|
|
|
(define-deprecated (operating-system-hosts-file os)
|
|
|
|
|
hosts-service-type
|
|
|
|
|
(%operating-system-hosts-file os))
|
|
|
|
|
|
2022-02-17 23:28:07 -05:00
|
|
|
|
(define* (operating-system-kernel-arguments
|
|
|
|
|
os root-device #:key (version %boot-parameters-version))
|
|
|
|
|
"Return all the kernel arguments, including the ones not specified directly
|
2022-06-02 17:19:03 -04:00
|
|
|
|
by the user. VERSION should match that of the target <boot-parameters> record
|
2022-02-17 23:28:07 -05:00
|
|
|
|
object that will contain the kernel parameters."
|
|
|
|
|
(append (bootable-kernel-arguments os root-device version)
|
2018-11-15 08:36:16 -05:00
|
|
|
|
(operating-system-user-kernel-arguments os)))
|
2017-04-21 08:37:08 -04:00
|
|
|
|
|
2014-05-12 17:37:13 -04:00
|
|
|
|
|
|
|
|
|
;;;
|
2017-05-07 05:30:24 -04:00
|
|
|
|
;;; Boot parameters
|
|
|
|
|
;;;
|
|
|
|
|
|
2022-02-17 23:28:07 -05:00
|
|
|
|
;;; Version 1 was introduced early 2022 to mark the departure from long option
|
|
|
|
|
;;; names such as '--load' to the more conventional initrd option names like
|
|
|
|
|
;;; 'gnu.load'.
|
|
|
|
|
;;;
|
2022-02-18 15:42:07 -05:00
|
|
|
|
;;; When bumping the boot-parameters version, increment it by one (1).
|
2022-02-17 23:28:07 -05:00
|
|
|
|
(define %boot-parameters-version 1)
|
2022-02-18 15:42:07 -05:00
|
|
|
|
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(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,
|
2020-11-02 12:22:33 -05:00
|
|
|
|
;; but it cannot be a device file name such as "/dev/sda3", since GRUB would
|
|
|
|
|
;; not understand that. The 'root-device', on the other hand, corresponds
|
2017-05-07 05:30:24 -04:00
|
|
|
|
;; exactly to the device field of the <file-system> object representing the
|
2020-11-02 12:22:33 -05:00
|
|
|
|
;; OS's root file system, so it might be a device file name like
|
|
|
|
|
;; "/dev/sda3". The 'store-directory-prefix' field contains #f or the store
|
|
|
|
|
;; file name inside the 'store-device' as it is seen by GRUB, e.g. it would
|
|
|
|
|
;; contain "/storefs" if the store is located in that subvolume of a btrfs
|
2020-10-24 12:15:53 -04:00
|
|
|
|
;; partition.
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(root-device boot-parameters-root-device)
|
2017-06-10 04:47:25 -04:00
|
|
|
|
(bootloader-name boot-parameters-bootloader-name)
|
2019-08-28 17:27:20 -04:00
|
|
|
|
(bootloader-menu-entries ;list of <menu-entry>
|
|
|
|
|
boot-parameters-bootloader-menu-entries)
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(store-device boot-parameters-store-device)
|
|
|
|
|
(store-mount-point boot-parameters-store-mount-point)
|
2020-10-24 12:15:53 -04:00
|
|
|
|
(store-directory-prefix boot-parameters-store-directory-prefix)
|
2020-12-21 07:02:01 -05:00
|
|
|
|
(store-crypto-devices boot-parameters-store-crypto-devices
|
|
|
|
|
(default '()))
|
2019-10-21 06:23:40 -04:00
|
|
|
|
(locale boot-parameters-locale)
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(kernel boot-parameters-kernel)
|
|
|
|
|
(kernel-arguments boot-parameters-kernel-arguments)
|
2020-05-26 11:38:30 -04:00
|
|
|
|
(initrd boot-parameters-initrd)
|
2022-02-18 15:42:07 -05:00
|
|
|
|
(multiboot-modules boot-parameters-multiboot-modules)
|
|
|
|
|
(version boot-parameters-version ;positive integer
|
|
|
|
|
(default %boot-parameters-version)))
|
2017-05-07 05:30:24 -04:00
|
|
|
|
|
2017-10-06 17:09:48 -04:00
|
|
|
|
(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))
|
|
|
|
|
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(define (read-boot-parameters port)
|
|
|
|
|
"Read boot parameters from PORT and return the corresponding
|
2022-03-16 10:03:01 -04:00
|
|
|
|
<boot-parameters> object. Raise an error if the format is unrecognized."
|
2017-09-06 04:22:58 -04:00
|
|
|
|
(define device-sexp->device
|
|
|
|
|
(match-lambda
|
|
|
|
|
(('uuid (? symbol? type) (? bytevector? bv))
|
|
|
|
|
(bytevector->uuid bv type))
|
2018-05-18 07:43:07 -04:00
|
|
|
|
(('file-system-label (? string? label))
|
|
|
|
|
(file-system-label label))
|
2017-09-06 04:22:58 -04:00
|
|
|
|
((? bytevector? bv) ;old format
|
|
|
|
|
(bytevector->uuid bv 'dce))
|
|
|
|
|
((? string? device)
|
2020-09-07 04:04:19 -04:00
|
|
|
|
(if (string-contains device ":/")
|
|
|
|
|
device ; nfs-root
|
|
|
|
|
;; It used to be that we would not distinguish between labels and
|
|
|
|
|
;; device names. Try to infer the right thing here.
|
|
|
|
|
(if (string-prefix? "/" device)
|
|
|
|
|
device
|
|
|
|
|
(file-system-label device))))))
|
2020-12-21 07:02:01 -05:00
|
|
|
|
(define uuid-sexp->uuid
|
|
|
|
|
(match-lambda
|
|
|
|
|
(('uuid (? symbol? type) (? bytevector? bv))
|
|
|
|
|
(bytevector->uuid bv type))
|
|
|
|
|
(x
|
|
|
|
|
(warning (G_ "unrecognized uuid ~a at '~a'~%") x (port-filename port))
|
|
|
|
|
#f)))
|
2017-09-06 04:22:58 -04:00
|
|
|
|
|
2022-02-18 15:42:07 -05:00
|
|
|
|
;; New versions are not backward-compatible, so only accept past and current
|
|
|
|
|
;; versions, not future ones.
|
|
|
|
|
(define (version? n)
|
|
|
|
|
(member n (iota (1+ %boot-parameters-version))))
|
|
|
|
|
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(match (read port)
|
2022-02-18 15:42:07 -05:00
|
|
|
|
(('boot-parameters ('version (? version? version))
|
2017-05-07 05:30:24 -04:00
|
|
|
|
('label label) ('root-device root)
|
2020-05-26 11:38:30 -04:00
|
|
|
|
('kernel kernel)
|
2017-05-07 05:30:24 -04:00
|
|
|
|
rest ...)
|
|
|
|
|
(boot-parameters
|
2022-02-18 15:42:07 -05:00
|
|
|
|
(version version)
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(label label)
|
2017-09-11 17:00:40 -04:00
|
|
|
|
(root-device (device-sexp->device root))
|
2017-05-07 05:30:24 -04:00
|
|
|
|
|
2017-06-10 04:47:25 -04:00
|
|
|
|
(bootloader-name
|
|
|
|
|
(match (assq 'bootloader-name rest)
|
2017-04-02 09:10:52 -04:00
|
|
|
|
((_ args) args)
|
|
|
|
|
(#f 'grub))) ; for compatibility reasons.
|
|
|
|
|
|
2019-08-28 17:27:20 -04:00
|
|
|
|
(bootloader-menu-entries
|
|
|
|
|
(match (assq 'bootloader-menu-entries rest)
|
|
|
|
|
((_ entries) (map sexp->menu-entry entries))
|
|
|
|
|
(#f '())))
|
|
|
|
|
|
2020-05-26 11:38:30 -04:00
|
|
|
|
;; In the past, we would store the directory name of linux instead of
|
|
|
|
|
;; the absolute file name of its image. Detect that and correct it.
|
|
|
|
|
(kernel (if (string=? kernel (direct-store-path kernel))
|
|
|
|
|
(string-append kernel "/"
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(system-linux-image-file-name))
|
2020-05-26 11:38:30 -04:00
|
|
|
|
kernel))
|
2017-05-07 05:30:24 -04:00
|
|
|
|
|
|
|
|
|
(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))
|
2020-06-29 09:24:45 -04:00
|
|
|
|
file)
|
|
|
|
|
(#f #f)))
|
2017-05-07 05:30:24 -04:00
|
|
|
|
|
2020-06-29 09:24:45 -04:00
|
|
|
|
(multiboot-modules
|
|
|
|
|
(match (assq 'multiboot-modules rest)
|
|
|
|
|
((_ args) args)
|
|
|
|
|
(#f '())))
|
2020-05-26 11:38:30 -04:00
|
|
|
|
|
2019-10-21 06:23:40 -04:00
|
|
|
|
(locale
|
|
|
|
|
(match (assq 'locale rest)
|
|
|
|
|
((_ locale) locale)
|
|
|
|
|
(#f #f)))
|
|
|
|
|
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(store-device
|
2017-09-21 16:30:59 -04:00
|
|
|
|
;; 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))))
|
2017-05-07 05:30:24 -04:00
|
|
|
|
|
2020-10-24 12:15:53 -04:00
|
|
|
|
(store-directory-prefix
|
|
|
|
|
(match (assq 'store rest)
|
|
|
|
|
(('store . store-data)
|
|
|
|
|
(match (assq 'directory-prefix store-data)
|
|
|
|
|
(('directory-prefix prefix) prefix)
|
|
|
|
|
;; No directory-prefix found.
|
|
|
|
|
(_ #f)))
|
|
|
|
|
(_
|
|
|
|
|
;; No store found, old format.
|
|
|
|
|
#f)))
|
|
|
|
|
|
2020-12-21 07:02:01 -05:00
|
|
|
|
(store-crypto-devices
|
|
|
|
|
(match (assq 'store rest)
|
|
|
|
|
(('store . store-data)
|
|
|
|
|
(match (assq 'crypto-devices store-data)
|
|
|
|
|
(('crypto-devices (devices ...))
|
|
|
|
|
(map uuid-sexp->uuid devices))
|
|
|
|
|
(('crypto-devices dev)
|
|
|
|
|
(warning (G_ "unrecognized crypto-devices ~S at '~a'~%")
|
|
|
|
|
dev (port-filename port))
|
|
|
|
|
'())
|
|
|
|
|
(_
|
|
|
|
|
;; No crypto-devices found.
|
|
|
|
|
'())))
|
|
|
|
|
(_
|
|
|
|
|
;; No store found, old format.
|
|
|
|
|
'())))
|
|
|
|
|
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(store-mount-point
|
|
|
|
|
(match (assq 'store rest)
|
|
|
|
|
(('store ('device _) ('mount-point mount-point) _ ...)
|
|
|
|
|
mount-point)
|
|
|
|
|
(_ ;the old format
|
|
|
|
|
"/")))))
|
|
|
|
|
(x ;unsupported format
|
2022-03-16 10:03:01 -04:00
|
|
|
|
(raise
|
|
|
|
|
(make-compound-condition
|
|
|
|
|
(formatted-message
|
|
|
|
|
(G_ "unrecognized boot parameters at '~a'~%")
|
|
|
|
|
(port-filename port))
|
|
|
|
|
(condition
|
|
|
|
|
(&fix-hint (hint (format #f (G_ "This probably means that this version
|
|
|
|
|
of Guix is older than the one that created @file{~a}. To address this, you
|
|
|
|
|
need to update Guix:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
guix pull
|
|
|
|
|
@end example")
|
|
|
|
|
(port-filename port))))))))))
|
2017-05-07 05:30:24 -04:00
|
|
|
|
|
|
|
|
|
(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))
|
2022-02-17 23:28:07 -05:00
|
|
|
|
(root (boot-parameters-root-device params))
|
|
|
|
|
(version (boot-parameters-version params)))
|
2018-11-15 08:36:16 -05:00
|
|
|
|
(boot-parameters
|
|
|
|
|
(inherit params)
|
2022-02-17 23:28:07 -05:00
|
|
|
|
(kernel-arguments (append (bootable-kernel-arguments system root version)
|
2018-11-15 08:36:16 -05:00
|
|
|
|
(boot-parameters-kernel-arguments params))))))
|
2017-05-29 08:24:20 -04:00
|
|
|
|
|
2017-06-29 06:42:59 -04:00
|
|
|
|
(define (boot-parameters->menu-entry conf)
|
2022-06-02 17:19:03 -04:00
|
|
|
|
"Return a <menu-entry> instance given CONF, a <boot-parameters> instance."
|
2020-05-26 11:38:30 -04:00
|
|
|
|
(let* ((kernel (boot-parameters-kernel conf))
|
|
|
|
|
(multiboot-modules (boot-parameters-multiboot-modules conf))
|
|
|
|
|
(multiboot? (pair? multiboot-modules)))
|
|
|
|
|
(menu-entry
|
|
|
|
|
(label (boot-parameters-label conf))
|
|
|
|
|
(device (boot-parameters-store-device conf))
|
|
|
|
|
(device-mount-point (boot-parameters-store-mount-point conf))
|
|
|
|
|
(linux (and (not multiboot?) kernel))
|
2020-06-08 21:12:24 -04:00
|
|
|
|
(linux-arguments (if (not multiboot?)
|
2020-05-26 11:38:30 -04:00
|
|
|
|
(boot-parameters-kernel-arguments conf)
|
|
|
|
|
'()))
|
|
|
|
|
(initrd (boot-parameters-initrd conf))
|
|
|
|
|
(multiboot-kernel (and multiboot? kernel))
|
|
|
|
|
(multiboot-arguments (if multiboot?
|
|
|
|
|
(boot-parameters-kernel-arguments conf)
|
|
|
|
|
'()))
|
|
|
|
|
(multiboot-modules (if multiboot?
|
|
|
|
|
(boot-parameters-multiboot-modules conf)
|
|
|
|
|
'())))))
|
2017-05-29 08:24:20 -04:00
|
|
|
|
|
2017-05-07 05:30:24 -04:00
|
|
|
|
|
|
|
|
|
;;;
|
2014-05-12 17:37:13 -04:00
|
|
|
|
;;; Services.
|
|
|
|
|
;;;
|
|
|
|
|
|
2016-08-21 12:50:14 -04:00
|
|
|
|
(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'."
|
2014-05-10 17:33:52 -04:00
|
|
|
|
(define file-systems
|
2014-11-25 10:01:21 -05:00
|
|
|
|
(remove file-system-needed-for-boot?
|
2014-05-10 17:33:52 -04:00
|
|
|
|
(operating-system-file-systems os)))
|
|
|
|
|
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(define mapped-devices-for-boot
|
|
|
|
|
(operating-system-boot-mapped-devices os))
|
|
|
|
|
|
2014-09-11 17:39:15 -04:00
|
|
|
|
(define (device-mappings fs)
|
2015-12-21 18:29:43 -05:00
|
|
|
|
(let ((device (file-system-device fs)))
|
2016-01-01 16:29:33 -05:00
|
|
|
|
(if (string? device) ;title is 'device
|
2015-12-21 18:29:43 -05:00
|
|
|
|
(filter (lambda (md)
|
2020-11-06 04:47:37 -05:00
|
|
|
|
(any (cut string=? device <>)
|
|
|
|
|
(map (cut string-append "/dev/mapper" <>)
|
|
|
|
|
(mapped-device-targets md))))
|
2015-12-21 18:29:43 -05:00
|
|
|
|
(operating-system-mapped-devices os))
|
|
|
|
|
'())))
|
2014-09-11 17:39:15 -04:00
|
|
|
|
|
2015-10-29 13:22:19 -04:00
|
|
|
|
(define (add-dependencies fs)
|
|
|
|
|
;; Add the dependencies due to device mappings to FS.
|
|
|
|
|
(file-system
|
|
|
|
|
(inherit fs)
|
|
|
|
|
(dependencies
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(delete-duplicates
|
|
|
|
|
(remove (cut member <> mapped-devices-for-boot)
|
|
|
|
|
(append (device-mappings fs)
|
|
|
|
|
(file-system-dependencies fs)))
|
|
|
|
|
eq?))))
|
2015-10-29 13:22:19 -04:00
|
|
|
|
|
2016-08-21 12:50:14 -04:00
|
|
|
|
(service file-system-service-type
|
|
|
|
|
(map add-dependencies file-systems)))
|
2014-05-10 17:33:52 -04:00
|
|
|
|
|
2020-04-23 08:00:02 -04:00
|
|
|
|
(define (boot-file-system-service os)
|
|
|
|
|
"Return a service which adds, to the system profile, packages providing the
|
2022-10-23 19:25:36 -04:00
|
|
|
|
utilities for the file systems marked as 'needed-for-boot' in OS."
|
2020-04-23 08:00:02 -04:00
|
|
|
|
(let ((file-systems (filter file-system-needed-for-boot?
|
|
|
|
|
(operating-system-file-systems os))))
|
|
|
|
|
(simple-service 'boot-file-system-utilities profile-service-type
|
|
|
|
|
(file-system-utilities file-systems))))
|
|
|
|
|
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(define (mapped-device-users device file-systems)
|
|
|
|
|
"Return the subset of FILE-SYSTEMS that use DEVICE."
|
2020-11-06 04:47:37 -05:00
|
|
|
|
(let ((targets (map (cut string-append "/dev/mapper/" <>)
|
|
|
|
|
(mapped-device-targets device))))
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(filter (lambda (fs)
|
|
|
|
|
(or (member device (file-system-dependencies fs))
|
|
|
|
|
(and (string? (file-system-device fs))
|
2020-11-06 04:47:37 -05:00
|
|
|
|
(any (cut string=? (file-system-device fs) <>) targets))))
|
2018-06-21 17:50:47 -04:00
|
|
|
|
file-systems)))
|
2014-09-22 05:06:42 -04:00
|
|
|
|
|
|
|
|
|
(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."
|
2014-11-30 11:50:07 -05:00
|
|
|
|
(let ((devices (operating-system-mapped-devices os))
|
|
|
|
|
(file-systems (operating-system-file-systems os)))
|
|
|
|
|
(filter (lambda (md)
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(let ((users (mapped-device-users md file-systems)))
|
|
|
|
|
(not (any file-system-needed-for-boot? users))))
|
2014-11-30 11:50:07 -05:00
|
|
|
|
devices)))
|
2014-09-22 05:06:42 -04:00
|
|
|
|
|
|
|
|
|
(define (operating-system-boot-mapped-devices os)
|
|
|
|
|
"Return the subset of mapped devices that must be installed during boot,
|
|
|
|
|
from the initrd."
|
2014-11-30 11:50:07 -05:00
|
|
|
|
(let ((devices (operating-system-mapped-devices os))
|
|
|
|
|
(file-systems (operating-system-file-systems os)))
|
|
|
|
|
(filter (lambda (md)
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(let ((users (mapped-device-users md file-systems)))
|
|
|
|
|
(any file-system-needed-for-boot? users)))
|
2014-11-30 11:50:07 -05:00
|
|
|
|
devices)))
|
2014-09-22 05:06:42 -04:00
|
|
|
|
|
2022-05-14 01:30:44 -04:00
|
|
|
|
(define operating-system-bootloader-crypto-devices
|
|
|
|
|
(mlambdaq (os) ;to avoid duplicated output
|
|
|
|
|
"Return the sources of the LUKS mapped devices specified by UUID."
|
|
|
|
|
;; XXX: Device ordering is important, we trust the returned one.
|
|
|
|
|
(let* ((luks-devices (filter (lambda (m)
|
|
|
|
|
(eq? luks-device-mapping
|
|
|
|
|
(mapped-device-type m)))
|
|
|
|
|
(operating-system-boot-mapped-devices os)))
|
|
|
|
|
(uuid-crypto-devices non-uuid-crypto-devices
|
|
|
|
|
(partition (compose uuid? mapped-device-source)
|
|
|
|
|
luks-devices)))
|
|
|
|
|
(when (not (null? non-uuid-crypto-devices))
|
|
|
|
|
(for-each (lambda (dev)
|
|
|
|
|
(warning
|
|
|
|
|
(source-properties->location (mapped-device-location dev))
|
|
|
|
|
(G_ "mapped device '~a' may be ignored by bootloader~%")
|
|
|
|
|
(mapped-device-source dev)))
|
|
|
|
|
non-uuid-crypto-devices)
|
|
|
|
|
(display-hint "Specify mapped device sources via their LUKS UUID."))
|
|
|
|
|
(map mapped-device-source uuid-crypto-devices))))
|
2020-12-21 07:02:01 -05:00
|
|
|
|
|
2014-09-11 17:39:15 -04:00
|
|
|
|
(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.
2015-09-09 03:17:31 -04:00
|
|
|
|
"Return the list of device-mapping services for OS as a list."
|
2016-04-17 12:26:50 -04:00
|
|
|
|
(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.
2015-09-09 03:17:31 -04:00
|
|
|
|
(operating-system-user-mapped-devices os)))
|
2014-09-11 17:39:15 -04:00
|
|
|
|
|
2021-11-15 15:26:28 -05:00
|
|
|
|
(define-syntax-rule (warn-swap-devices-change value)
|
|
|
|
|
(%warn-swap-devices-change value (current-source-location)))
|
|
|
|
|
|
|
|
|
|
(define (%warn-swap-devices-change value location)
|
|
|
|
|
(map (lambda (x)
|
|
|
|
|
(unless (swap-space? x)
|
|
|
|
|
(warning
|
|
|
|
|
(source-properties->location
|
|
|
|
|
location)
|
|
|
|
|
(G_ "List elements of the field 'swap-devices' should \
|
|
|
|
|
now use the <swap-space> record, as the old method is deprecated. \
|
|
|
|
|
See \"(guix) operating-system Reference\" for more details.~%")))
|
|
|
|
|
x) value))
|
|
|
|
|
|
2014-09-18 16:51:48 -04:00
|
|
|
|
(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.
2015-09-09 03:17:31 -04:00
|
|
|
|
"Return the list of swap services for OS."
|
2021-11-15 15:26:30 -05:00
|
|
|
|
(define early-userspace-file-systems
|
|
|
|
|
(filter file-system-needed-for-boot?
|
|
|
|
|
(operating-system-file-systems os)))
|
|
|
|
|
|
|
|
|
|
(define early-userspace-mapped-devices
|
|
|
|
|
(operating-system-boot-mapped-devices os))
|
|
|
|
|
|
|
|
|
|
(define (filter-deps swap)
|
|
|
|
|
(if (swap-space? swap)
|
|
|
|
|
(swap-space
|
|
|
|
|
(inherit swap)
|
|
|
|
|
(dependencies (remove (lambda (dep)
|
|
|
|
|
(or (member dep early-userspace-mapped-devices)
|
|
|
|
|
(member dep early-userspace-file-systems)))
|
|
|
|
|
(swap-space-dependencies swap))))
|
|
|
|
|
swap))
|
|
|
|
|
|
|
|
|
|
(map (compose swap-service filter-deps)
|
|
|
|
|
(operating-system-swap-devices os)))
|
2014-09-18 16:51:48 -04:00
|
|
|
|
|
2020-05-27 11:40:14 -04:00
|
|
|
|
(define* (system-linux-image-file-name #:optional
|
|
|
|
|
(target (or (%current-target-system)
|
|
|
|
|
(%current-system))))
|
|
|
|
|
"Return the basename of the kernel image file for TARGET."
|
|
|
|
|
(cond
|
|
|
|
|
((string-prefix? "arm" target) "zImage")
|
|
|
|
|
((string-prefix? "mips" target) "vmlinuz")
|
|
|
|
|
((string-prefix? "aarch64" target) "Image")
|
2022-03-07 15:47:27 -05:00
|
|
|
|
((string-prefix? "riscv64" target) "Image")
|
2020-05-27 11:40:14 -04:00
|
|
|
|
(else "bzImage")))
|
2016-09-09 17:27:00 -04:00
|
|
|
|
|
|
|
|
|
(define (operating-system-kernel-file os)
|
|
|
|
|
"Return an object representing the absolute file name of the kernel image of
|
|
|
|
|
OS."
|
2020-05-26 11:38:30 -04:00
|
|
|
|
(if (operating-system-hurd os)
|
|
|
|
|
(file-append (operating-system-kernel os) "/boot/gnumach")
|
|
|
|
|
(file-append (operating-system-kernel os)
|
|
|
|
|
"/" (system-linux-image-file-name))))
|
2016-09-09 17:27:00 -04:00
|
|
|
|
|
2020-04-29 11:17:55 -04:00
|
|
|
|
(define %default-modprobe-blacklist
|
|
|
|
|
;; List of kernel modules to blacklist by default.
|
2020-05-01 05:08:07 -04:00
|
|
|
|
'("usbmouse" ;races with bcm5974, see <https://bugs.gnu.org/35574>
|
|
|
|
|
"usbkbd")) ;races with usbhid, see <https://issues.guix.gnu.org/35574#18>
|
2020-04-29 11:17:55 -04:00
|
|
|
|
|
|
|
|
|
(define %default-kernel-arguments
|
|
|
|
|
;; Default arguments passed to the kernel.
|
|
|
|
|
(list (string-append "modprobe.blacklist="
|
|
|
|
|
(string-join %default-modprobe-blacklist ","))
|
|
|
|
|
"quiet"))
|
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(define* (operating-system-directory-base-entries os)
|
2015-11-02 12:44:17 -05:00
|
|
|
|
"Return the basic entries of the 'system' directory of OS for use as the
|
|
|
|
|
value of the SYSTEM-SERVICE-TYPE service."
|
2020-04-22 09:51:26 -04:00
|
|
|
|
(let* ((locale (operating-system-locale-directory os))
|
|
|
|
|
(kernel (operating-system-kernel os))
|
2020-06-28 12:51:25 -04:00
|
|
|
|
(hurd (operating-system-hurd os))
|
|
|
|
|
(initrd (and (not hurd) (operating-system-initrd-file os)))
|
2020-04-22 09:51:26 -04:00
|
|
|
|
(params (operating-system-boot-parameters-file os)))
|
2021-03-21 23:23:32 -04:00
|
|
|
|
`(,@(if hurd
|
|
|
|
|
`(("hurd" ,hurd)
|
|
|
|
|
("kernel" ,kernel))
|
|
|
|
|
'())
|
2020-04-22 10:22:33 -04:00
|
|
|
|
("parameters" ,params)
|
2020-06-28 12:51:25 -04:00
|
|
|
|
,@(if initrd `(("initrd" ,initrd)) '())
|
2020-04-22 10:22:33 -04:00
|
|
|
|
("locale" ,locale)))) ;used by libc
|
2019-03-22 12:48:37 -04:00
|
|
|
|
|
2019-05-10 11:45:06 -04:00
|
|
|
|
(define (operating-system-default-essential-services os)
|
2014-05-09 16:58:46 -04:00
|
|
|
|
"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
|
2019-03-22 12:48:37 -04:00
|
|
|
|
bookkeeping."
|
2014-11-10 16:25:39 -05:00
|
|
|
|
(define known-fs
|
|
|
|
|
(map file-system-mount-point (operating-system-file-systems os)))
|
|
|
|
|
|
2020-04-23 08:00:02 -04:00
|
|
|
|
(let* ((mappings (device-mapping-services os))
|
|
|
|
|
(root-fs (root-file-system-service))
|
|
|
|
|
(boot-fs (boot-file-system-service os))
|
|
|
|
|
(non-boot-fs (non-boot-file-system-service os))
|
|
|
|
|
(swaps (swap-services os))
|
|
|
|
|
(procs (service user-processes-service-type))
|
2023-01-27 16:06:12 -05:00
|
|
|
|
(host-name (operating-system-host-name os))
|
|
|
|
|
(hosts-file (%operating-system-hosts-file os))
|
2020-04-23 08:00:02 -04:00
|
|
|
|
(entries (operating-system-directory-base-entries os)))
|
2015-11-02 12:44:17 -05:00
|
|
|
|
(cons* (service system-service-type entries)
|
2021-03-21 23:23:32 -04:00
|
|
|
|
(service linux-builder-service-type
|
|
|
|
|
(linux-builder-configuration
|
|
|
|
|
(kernel (operating-system-kernel os))
|
|
|
|
|
(modules (operating-system-kernel-loadable-modules os))))
|
2015-11-02 12:44:17 -05:00
|
|
|
|
%boot-service
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
|
2018-06-20 03:44:27 -04:00
|
|
|
|
;; %SHEPHERD-ROOT-SERVICE must come last so that the gexp that
|
services: Rename 'dmd' services to 'shepherd'.
* gnu/services/shepherd.scm (dmd-root-service-type, %dmd-root-service)
(dmd-service-type, <dmd-service>, dmd-service, dmd-service?)
(make-dmd-service, dmd-service-documentation, dmd-service-provision)
(dmd-service-requirement, dmd-service-respawn, dmd-service-start)
(dmd-service-stop, dmd-service-auto-start?, dmd-service-modules)
(dmd-service-imported-modules, dmd-service-file-name, dmd-service-file)
(dmd-service-back-edges): Rename to...
(shepherd-root-service-type, %shepherd-root-service, shepherd-service-type)
(<shepherd-service>, shepherd-service, shepherd-service?)
(make-shepherd-service, shepherd-service-documentation)
(shepherd-service-provision, shepherd-service-requirement)
(shepherd-service-respawn, shepherd-service-start)
(shepherd-service-stop, shepherd-service-auto-start?)
(shepherd-service-modules, shepherd-service-imported-modules)
(shepherd-service-file-name, shepherd-service-file)
(shepherd-service-back-edges): ...this
* gnu/services.scm: Adjust comments.
* gnu/services/avahi.scm (avahi-dmd-service): Rename to...
(avahi-shepherd-service): ... this.
* gnu/services/base.scm (%root-file-system-dmd-service)
(file-system->dmd-service-name, mapped-device->dmd-service-name)
(dependency->dmd-service-name, file-system-dmd-service)
(mingetty-dmd-service, nscd-dmd-service, guix-dmd-service)
(guix-publish-dmd-service, udev-dmd-service, gpm-dmd-service): Rename to...
(%root-file-system-shepherd-service)
(file-system->shepherd-service-name, mapped-device->shepherd-service-name)
(dependency->shepherd-service-name, file-system-shepherd-service)
(mingetty-shepherd-service, nscd-shepherd-service, guix-shepherd-service)
(guix-publish-shepherd-service, udev-shepherd-service)
(gpm-shepherd-service): ... this.
* gnu/services/databases.scm (postgresql-dmd-service): Rename to...
(postgresql-shepherd-service): ... this.
* gnu/services/desktop.scm (upower-dmd-service, elogind-dmd-service):
Rename to...
(upower-shepherd-service, elogind-shepherd-service): ... this.
* gnu/services/dbus.scm (dbus-dmd-service): Rename to...
(dbus-shepherd-service): ... this.
* gnu/services/lirc.scm (lirc-dmd-service): Rename to...
(lirc-shepherd-service): ... this.
* gnu/services/mail.scm (dovecot-dmd-service): Rename to...
(dovecot-shepherd-service): ... this.
* gnu/services/networking.scm (ntp-dmd-service, tor-dmd-service)
(bitlbee-dmd-service, wicd-dmd-service, network-manager-dmd-service): Rename to...
(dbus-shepherd-service): ... this.
* gnu/services/ssh.scm (lsh-dmd-service): Rename to...
(lsh-shepherd-service): ... this.
* gnu/services/web.scm (nginx-dmd-service): Rename to...
(nginx-shepherd-service): ... this.
* gnu/services/xorg.scm (slim-dmd-service): Rename to...
(slim-shepherd-service): ... this.
* gnu/system.scm (essential-services): Use '%shepherd-root-service'.
* gnu/system/install.scm (cow-store-service-type): Adjust accordingly.
* guix/scripts/system.scm (dmd-service-node-label, dmd-service-node-type)
(export-dmd-graph): Likewise.
* tests/guix-system.sh: Likewise.
* tests/services.scm ("dmd-service-back-edges"): Rename to...
("shepherd-service-back-edges"): Adjust accordingly.
* doc/guix.texi: Likewise.
* doc/images/service-graph.dot: Use 'shepherd' service name.
2016-01-27 15:02:31 -05:00
|
|
|
|
;; execs shepherd comes last in the boot script (XXX). Likewise,
|
2018-06-20 03:44:27 -04:00
|
|
|
|
;; the cleanup service must come first so that its gexp runs before
|
services: Rename 'dmd' services to 'shepherd'.
* gnu/services/shepherd.scm (dmd-root-service-type, %dmd-root-service)
(dmd-service-type, <dmd-service>, dmd-service, dmd-service?)
(make-dmd-service, dmd-service-documentation, dmd-service-provision)
(dmd-service-requirement, dmd-service-respawn, dmd-service-start)
(dmd-service-stop, dmd-service-auto-start?, dmd-service-modules)
(dmd-service-imported-modules, dmd-service-file-name, dmd-service-file)
(dmd-service-back-edges): Rename to...
(shepherd-root-service-type, %shepherd-root-service, shepherd-service-type)
(<shepherd-service>, shepherd-service, shepherd-service?)
(make-shepherd-service, shepherd-service-documentation)
(shepherd-service-provision, shepherd-service-requirement)
(shepherd-service-respawn, shepherd-service-start)
(shepherd-service-stop, shepherd-service-auto-start?)
(shepherd-service-modules, shepherd-service-imported-modules)
(shepherd-service-file-name, shepherd-service-file)
(shepherd-service-back-edges): ...this
* gnu/services.scm: Adjust comments.
* gnu/services/avahi.scm (avahi-dmd-service): Rename to...
(avahi-shepherd-service): ... this.
* gnu/services/base.scm (%root-file-system-dmd-service)
(file-system->dmd-service-name, mapped-device->dmd-service-name)
(dependency->dmd-service-name, file-system-dmd-service)
(mingetty-dmd-service, nscd-dmd-service, guix-dmd-service)
(guix-publish-dmd-service, udev-dmd-service, gpm-dmd-service): Rename to...
(%root-file-system-shepherd-service)
(file-system->shepherd-service-name, mapped-device->shepherd-service-name)
(dependency->shepherd-service-name, file-system-shepherd-service)
(mingetty-shepherd-service, nscd-shepherd-service, guix-shepherd-service)
(guix-publish-shepherd-service, udev-shepherd-service)
(gpm-shepherd-service): ... this.
* gnu/services/databases.scm (postgresql-dmd-service): Rename to...
(postgresql-shepherd-service): ... this.
* gnu/services/desktop.scm (upower-dmd-service, elogind-dmd-service):
Rename to...
(upower-shepherd-service, elogind-shepherd-service): ... this.
* gnu/services/dbus.scm (dbus-dmd-service): Rename to...
(dbus-shepherd-service): ... this.
* gnu/services/lirc.scm (lirc-dmd-service): Rename to...
(lirc-shepherd-service): ... this.
* gnu/services/mail.scm (dovecot-dmd-service): Rename to...
(dovecot-shepherd-service): ... this.
* gnu/services/networking.scm (ntp-dmd-service, tor-dmd-service)
(bitlbee-dmd-service, wicd-dmd-service, network-manager-dmd-service): Rename to...
(dbus-shepherd-service): ... this.
* gnu/services/ssh.scm (lsh-dmd-service): Rename to...
(lsh-shepherd-service): ... this.
* gnu/services/web.scm (nginx-dmd-service): Rename to...
(nginx-shepherd-service): ... this.
* gnu/services/xorg.scm (slim-dmd-service): Rename to...
(slim-shepherd-service): ... this.
* gnu/system.scm (essential-services): Use '%shepherd-root-service'.
* gnu/system/install.scm (cow-store-service-type): Adjust accordingly.
* guix/scripts/system.scm (dmd-service-node-label, dmd-service-node-type)
(export-dmd-graph): Likewise.
* tests/guix-system.sh: Likewise.
* tests/services.scm ("dmd-service-back-edges"): Rename to...
("shepherd-service-back-edges"): Adjust accordingly.
* doc/guix.texi: Likewise.
* doc/images/service-graph.dot: Use 'shepherd' service name.
2016-01-27 15:02:31 -05:00
|
|
|
|
;; activation code.
|
2016-01-04 16:58:05 -05:00
|
|
|
|
(service cleanup-service-type #f)
|
2018-06-20 03:44:27 -04:00
|
|
|
|
%activation-service
|
|
|
|
|
%shepherd-root-service
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
|
|
|
|
|
(pam-root-service (operating-system-pam-services os))
|
|
|
|
|
(account-service (append (operating-system-accounts os)
|
|
|
|
|
(operating-system-groups os))
|
|
|
|
|
(operating-system-skeletons os))
|
|
|
|
|
(operating-system-etc-service os)
|
2023-01-27 16:06:12 -05:00
|
|
|
|
;; XXX: hosts-file is deprecated
|
|
|
|
|
(if hosts-file
|
|
|
|
|
(simple-service 'deprecated-hosts-file etc-service-type
|
|
|
|
|
(list `("hosts" ,hosts-file)))
|
|
|
|
|
(service hosts-service-type
|
|
|
|
|
(local-host-entries host-name)))
|
2019-04-26 17:53:53 -04:00
|
|
|
|
(service fstab-service-type
|
|
|
|
|
(filter file-system-needed-for-boot?
|
|
|
|
|
(operating-system-file-systems os)))
|
2015-12-02 08:14:02 -05:00
|
|
|
|
(session-environment-service
|
|
|
|
|
(operating-system-environment-variables os))
|
2023-02-25 13:57:47 -05:00
|
|
|
|
(service host-name-service-type host-name)
|
2023-01-27 16:06:12 -05:00
|
|
|
|
procs root-fs
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
(service setuid-program-service-type
|
2021-08-12 05:58:47 -04:00
|
|
|
|
(operating-system-setuid-programs os))
|
2015-11-02 15:52:28 -05:00
|
|
|
|
(service profile-service-type
|
|
|
|
|
(operating-system-packages os))
|
2020-04-23 08:00:02 -04:00
|
|
|
|
boot-fs non-boot-fs
|
2016-08-21 12:50:14 -04:00
|
|
|
|
(append mappings swaps
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
;; Add the firmware service.
|
|
|
|
|
(list %linux-bare-metal-service
|
|
|
|
|
(service firmware-service-type
|
|
|
|
|
(operating-system-firmware os)))))))
|
|
|
|
|
|
2020-05-03 08:13:58 -04:00
|
|
|
|
(define (hurd-default-essential-services os)
|
2023-01-27 16:06:12 -05:00
|
|
|
|
(let ((host-name (operating-system-host-name os))
|
|
|
|
|
(hosts-file (%operating-system-hosts-file os))
|
|
|
|
|
(entries (operating-system-directory-base-entries os)))
|
2020-06-28 12:51:25 -04:00
|
|
|
|
(list (service system-service-type entries)
|
|
|
|
|
%boot-service
|
|
|
|
|
%hurd-startup-service
|
|
|
|
|
%activation-service
|
2022-03-28 08:01:10 -04:00
|
|
|
|
(service shepherd-root-service-type
|
|
|
|
|
(shepherd-configuration
|
|
|
|
|
(shepherd shepherd-0.8))) ;no Fibers
|
|
|
|
|
|
2020-06-28 12:51:25 -04:00
|
|
|
|
(service user-processes-service-type)
|
|
|
|
|
(account-service (append (operating-system-accounts os)
|
|
|
|
|
(operating-system-groups os))
|
|
|
|
|
(operating-system-skeletons os))
|
|
|
|
|
(root-file-system-service)
|
|
|
|
|
(service file-system-service-type '())
|
|
|
|
|
(service fstab-service-type
|
|
|
|
|
(filter file-system-needed-for-boot?
|
|
|
|
|
(operating-system-file-systems os)))
|
|
|
|
|
(pam-root-service (operating-system-pam-services os))
|
|
|
|
|
(operating-system-etc-service os)
|
2023-01-27 16:06:12 -05:00
|
|
|
|
;; XXX: hosts-file is deprecated
|
|
|
|
|
(if hosts-file
|
|
|
|
|
(simple-service 'deprecated-hosts-file etc-service-type
|
|
|
|
|
(list `("hosts" ,hosts-file)))
|
|
|
|
|
(service hosts-service-type
|
|
|
|
|
(local-host-entries host-name)))
|
2020-10-09 16:55:46 -04:00
|
|
|
|
(service setuid-program-service-type
|
2021-08-12 05:58:47 -04:00
|
|
|
|
(operating-system-setuid-programs os))
|
2020-06-28 12:51:25 -04:00
|
|
|
|
(service profile-service-type (operating-system-packages os)))))
|
2020-05-03 08:13:58 -04:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(define* (operating-system-services os)
|
|
|
|
|
"Return all the services of OS, including \"essential\" services."
|
2018-01-20 18:05:09 -05:00
|
|
|
|
(instantiate-missing-services
|
|
|
|
|
(append (operating-system-user-services os)
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(operating-system-essential-services os))))
|
2014-05-09 16:58:46 -04:00
|
|
|
|
|
2019-05-10 16:29:10 -04:00
|
|
|
|
(define (operating-system-with-gc-roots os roots)
|
|
|
|
|
"Return a variant of OS where ROOTS are registered as GC roots."
|
|
|
|
|
(operating-system
|
|
|
|
|
(inherit os)
|
|
|
|
|
|
|
|
|
|
;; We use this procedure for the installation OS, which already defines GC
|
|
|
|
|
;; roots. Add ROOTS to those.
|
|
|
|
|
(services (cons (simple-service 'extra-root
|
|
|
|
|
gc-root-service-type roots)
|
|
|
|
|
(operating-system-user-services os)))))
|
|
|
|
|
|
2020-07-28 16:36:20 -04:00
|
|
|
|
(define (operating-system-configuration-file os)
|
|
|
|
|
"Return the configuration file of OS, based on its 'location' field, or #f
|
|
|
|
|
if it could not be determined."
|
|
|
|
|
(let ((file (and=> (operating-system-location os)
|
|
|
|
|
location-file)))
|
|
|
|
|
(and file
|
|
|
|
|
(or (and (string-prefix? "/" file) file)
|
|
|
|
|
(search-path %load-path file)))))
|
|
|
|
|
|
|
|
|
|
(define* (operating-system-with-provenance os
|
|
|
|
|
#:optional
|
|
|
|
|
(config-file
|
|
|
|
|
(operating-system-configuration-file
|
|
|
|
|
os)))
|
2019-11-30 12:05:07 -05:00
|
|
|
|
"Return a variant of OS that stores its own provenance information,
|
|
|
|
|
including CONFIG-FILE, if available. This is achieved by adding an instance
|
|
|
|
|
of PROVENANCE-SERVICE-TYPE to its services."
|
|
|
|
|
(operating-system
|
|
|
|
|
(inherit os)
|
|
|
|
|
(services (cons (service provenance-service-type config-file)
|
|
|
|
|
(operating-system-user-services os)))))
|
|
|
|
|
|
2014-05-12 17:37:13 -04:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; /etc.
|
|
|
|
|
;;;
|
|
|
|
|
|
2014-11-11 16:42:15 -05:00
|
|
|
|
(define %base-firmware
|
|
|
|
|
;; Firmware usable by default.
|
2016-11-19 14:25:02 -05:00
|
|
|
|
(list ath9k-htc-firmware
|
|
|
|
|
openfwwf-firmware))
|
2014-11-11 16:42:15 -05:00
|
|
|
|
|
2021-09-28 06:18:40 -04:00
|
|
|
|
(define %base-packages-artwork
|
|
|
|
|
;; Default set of artwork packages.
|
|
|
|
|
(list guix-icons))
|
|
|
|
|
|
2020-04-04 03:59:48 -04:00
|
|
|
|
(define %base-packages-utils
|
|
|
|
|
;; Default set of utilities packages.
|
|
|
|
|
(cons* procps psmisc which
|
2022-11-27 08:53:09 -05:00
|
|
|
|
shadow ;for 'passwd'
|
2020-04-04 03:59:48 -04:00
|
|
|
|
|
2022-11-28 14:10:14 -05:00
|
|
|
|
e2fsprogs ;for lsattr, chattr, etc.
|
|
|
|
|
|
2020-10-08 06:07:51 -04:00
|
|
|
|
guile-3.0-latest
|
2020-04-04 03:59:48 -04:00
|
|
|
|
|
|
|
|
|
;; The packages below are also in %FINAL-INPUTS, so take them from
|
|
|
|
|
;; there to avoid duplication.
|
2020-04-23 07:33:09 -04:00
|
|
|
|
(list bash coreutils findutils grep sed
|
|
|
|
|
diffutils patch gawk tar gzip bzip2 xz lzip)))
|
2020-04-04 03:59:48 -04:00
|
|
|
|
|
|
|
|
|
(define %base-packages-linux
|
|
|
|
|
;; Default set of linux specific packages.
|
|
|
|
|
(list pciutils usbutils
|
|
|
|
|
util-linux+udev
|
|
|
|
|
;; Get 'insmod' & co. from kmod, not module-init-tools, since udev
|
|
|
|
|
;; already depends on it anyway.
|
|
|
|
|
kmod eudev))
|
|
|
|
|
|
|
|
|
|
(define %base-packages-interactive
|
|
|
|
|
;; Default set of common interactive packages.
|
2021-07-09 04:20:39 -04:00
|
|
|
|
(list less mg nano
|
install: Deduplicate packages with %base-package sets.
* gnu/system.scm (%base-packages-interactive): Add nvi.
* gnu/system/install.scm (installation-os)[packages]: Remove parted,
gptfdisk, ddrescue, cryptsetup, mdadm, dosfstools, btrfs-progs,
f2fs-tools, jfstools, openssh, wireless-tools, iw,
wpa-supplicant-minimal, iproute, bash-completion, nvi. Add
%base-packages-disk-utilities.
2020-10-09 05:51:26 -04:00
|
|
|
|
nvi
|
2020-04-04 03:59:48 -04:00
|
|
|
|
man-db
|
|
|
|
|
info-reader ;the standalone Info reader (no Perl)
|
|
|
|
|
bash-completion
|
|
|
|
|
kbd
|
|
|
|
|
;; The 'sudo' command is already in %SETUID-PROGRAMS, but we also
|
|
|
|
|
;; want the other commands and the man pages (notably because
|
|
|
|
|
;; auto-completion in Emacs shell relies on man pages.)
|
|
|
|
|
sudo
|
|
|
|
|
guile-readline guile-colorized))
|
|
|
|
|
|
|
|
|
|
(define %base-packages-networking
|
|
|
|
|
;; Default set of networking packages.
|
|
|
|
|
(list inetutils isc-dhcp
|
|
|
|
|
iproute
|
2021-05-07 12:17:26 -04:00
|
|
|
|
wget
|
2020-04-04 03:59:48 -04:00
|
|
|
|
;; wireless-tools is deprecated in favor of iw, but it's still what
|
|
|
|
|
;; many people are familiar with, so keep it around.
|
|
|
|
|
iw wireless-tools))
|
|
|
|
|
|
2022-11-28 13:57:58 -05:00
|
|
|
|
(define-deprecated %base-packages-disk-utilities #f '())
|
2020-10-09 05:47:34 -04:00
|
|
|
|
|
2014-06-04 08:59:24 -04:00
|
|
|
|
(define %base-packages
|
|
|
|
|
;; Default set of packages globally visible. It should include anything
|
|
|
|
|
;; required for basic administrator tasks.
|
2020-04-23 08:00:02 -04:00
|
|
|
|
(append %base-packages-artwork
|
2020-04-04 03:59:48 -04:00
|
|
|
|
%base-packages-interactive
|
|
|
|
|
%base-packages-linux
|
|
|
|
|
%base-packages-networking
|
|
|
|
|
%base-packages-utils))
|
2014-06-04 08:59:24 -04:00
|
|
|
|
|
2014-05-31 16:01:05 -04:00
|
|
|
|
(define %default-issue
|
|
|
|
|
;; Default contents for /etc/issue.
|
|
|
|
|
"
|
|
|
|
|
This is the GNU system. Welcome.\n")
|
|
|
|
|
|
2023-01-27 16:06:12 -05:00
|
|
|
|
(define-deprecated (local-host-aliases host-name)
|
|
|
|
|
local-host-entries
|
2014-10-07 15:17:22 -04:00
|
|
|
|
"Return aliases for HOST-NAME, to be used in /etc/hosts."
|
|
|
|
|
(string-append "127.0.0.1 localhost " host-name "\n"
|
|
|
|
|
"::1 localhost " host-name "\n"))
|
|
|
|
|
|
2023-01-27 16:06:12 -05:00
|
|
|
|
(define (local-host-entries host-name)
|
|
|
|
|
"Return <host> records for @var{host-name}."
|
|
|
|
|
(map (lambda (address)
|
|
|
|
|
(host address "localhost" (list host-name)))
|
|
|
|
|
'("127.0.0.1" "::1")))
|
2014-09-11 16:03:24 -04:00
|
|
|
|
|
2020-08-24 11:02:48 -04:00
|
|
|
|
(define (validated-sudoers-file file)
|
|
|
|
|
"Return a copy of FILE, a sudoers file, after checking that it is
|
|
|
|
|
syntactically correct."
|
|
|
|
|
(computed-file "sudoers"
|
|
|
|
|
(with-imported-modules '((guix build utils))
|
|
|
|
|
#~(begin
|
|
|
|
|
(use-modules (guix build utils))
|
|
|
|
|
|
|
|
|
|
(invoke #+(file-append sudo "/sbin/visudo")
|
|
|
|
|
"--check" "--file" #$file)
|
|
|
|
|
(copy-file #$file #$output)))))
|
|
|
|
|
|
2023-03-10 15:21:22 -05:00
|
|
|
|
(define os-release
|
|
|
|
|
(plain-file "os-release" "\
|
2021-09-28 06:19:26 -04:00
|
|
|
|
NAME=\"Guix System\"
|
|
|
|
|
ID=guix
|
|
|
|
|
PRETTY_NAME=\"Guix System\"
|
|
|
|
|
LOGO=guix-icon
|
|
|
|
|
HOME_URL=\"https://guix.gnu.org\"
|
|
|
|
|
DOCUMENTATION_URL=\"https://guix.gnu.org/en/manual\"
|
|
|
|
|
SUPPORT_URL=\"https://guix.gnu.org/en/help\"
|
|
|
|
|
BUG_REPORT_URL=\"https://lists.gnu.org/mailman/listinfo/bug-guix\"
|
|
|
|
|
"))
|
|
|
|
|
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
(define* (operating-system-etc-service os)
|
2021-01-21 10:05:37 -05:00
|
|
|
|
"Return a <service> that builds a directory containing the static part of
|
|
|
|
|
the /etc directory."
|
2020-04-25 05:55:56 -04:00
|
|
|
|
(let* ((login.defs
|
2018-04-08 14:30:05 -04:00
|
|
|
|
(plain-file "login.defs"
|
|
|
|
|
(string-append
|
|
|
|
|
"# Default paths for non-login shells started by su(1).\n"
|
|
|
|
|
"ENV_PATH /run/setuid-programs:"
|
|
|
|
|
"/run/current-system/profile/bin:"
|
|
|
|
|
"/run/current-system/profile/sbin\n"
|
|
|
|
|
"ENV_SUPATH /run/setuid-programs:"
|
|
|
|
|
"/run/current-system/profile/bin:"
|
2021-12-31 11:45:12 -05:00
|
|
|
|
"/run/current-system/profile/sbin\n"
|
|
|
|
|
|
|
|
|
|
"\n"
|
|
|
|
|
"# Allow 'chfn' to change the full name,\n"
|
|
|
|
|
"# room number, and so on.\n"
|
|
|
|
|
"CHFN_RESTRICT frwh\n")))
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
|
2020-04-25 05:55:56 -04:00
|
|
|
|
(hurd (operating-system-hurd os))
|
|
|
|
|
(issue (plain-file "issue" (operating-system-issue os)))
|
2023-03-10 15:21:21 -05:00
|
|
|
|
(nsswitch (and=> (operating-system-name-service-switch os)
|
|
|
|
|
(compose (cut plain-file "nsswitch.conf" <>)
|
|
|
|
|
name-service-switch->string)))
|
2020-04-25 05:55:56 -04:00
|
|
|
|
(sudoers (operating-system-sudoers-file os))
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
|
|
|
|
|
;; Startup file for POSIX-compliant login shells, which set system-wide
|
|
|
|
|
;; environment variables.
|
|
|
|
|
(profile (mixed-text-file "profile" "\
|
2015-07-07 14:24:57 -04:00
|
|
|
|
# Crucial variables that could be missing in the profiles' 'etc/profile'
|
2015-05-06 12:23:27 -04:00
|
|
|
|
# because they would require combining both profiles.
|
|
|
|
|
# FIXME: See <http://bugs.gnu.org/20255>.
|
2014-12-12 17:52:27 -05:00
|
|
|
|
export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/man
|
2018-06-12 09:04:52 -04:00
|
|
|
|
export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
|
2015-01-27 00:37:53 -05:00
|
|
|
|
export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share
|
|
|
|
|
export XDG_CONFIG_DIRS=$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg
|
|
|
|
|
|
2017-10-08 11:21:09 -04:00
|
|
|
|
# Make sure libXcursor finds cursors installed into user or system profiles. See <http://bugs.gnu.org/24445>
|
|
|
|
|
export XCURSOR_PATH=$HOME/.icons:$HOME/.guix-profile/share/icons:/run/current-system/profile/share/icons
|
|
|
|
|
|
2015-05-06 12:23:27 -04:00
|
|
|
|
# Ignore the default value of 'PATH'.
|
|
|
|
|
unset PATH
|
|
|
|
|
|
|
|
|
|
# Load the system profile's settings.
|
2017-11-20 12:41:47 -05:00
|
|
|
|
GUIX_PROFILE=/run/current-system/profile ; \\
|
2015-05-07 03:45:45 -04:00
|
|
|
|
. /run/current-system/profile/etc/profile
|
2015-05-06 12:23:27 -04:00
|
|
|
|
|
2016-07-27 08:27:00 -04:00
|
|
|
|
# Since 'lshd' does not use pam_env, /etc/environment must be explicitly
|
|
|
|
|
# loaded when someone logs in via SSH. See <http://bugs.gnu.org/22175>.
|
|
|
|
|
# We need 'PATH' to be defined here, for 'cat' and 'cut'. Do this before
|
|
|
|
|
# reading the user's 'etc/profile' to allow variables to be overridden.
|
|
|
|
|
if [ -f /etc/environment -a -n \"$SSH_CLIENT\" \\
|
|
|
|
|
-a -z \"$LINUX_MODULE_DIRECTORY\" ]
|
|
|
|
|
then
|
|
|
|
|
. /etc/environment
|
|
|
|
|
export `cat /etc/environment | cut -d= -f1`
|
|
|
|
|
fi
|
|
|
|
|
|
2018-06-12 09:04:52 -04:00
|
|
|
|
# Arrange so that ~/.config/guix/current comes first.
|
|
|
|
|
for profile in \"$HOME/.guix-profile\" \"$HOME/.config/guix/current\"
|
2018-06-09 04:36:38 -04:00
|
|
|
|
do
|
|
|
|
|
if [ -f \"$profile/etc/profile\" ]
|
|
|
|
|
then
|
|
|
|
|
# Load the user profile's settings.
|
|
|
|
|
GUIX_PROFILE=\"$profile\" ; \\
|
|
|
|
|
. \"$profile/etc/profile\"
|
|
|
|
|
else
|
|
|
|
|
# At least define this one so that basic things just work
|
|
|
|
|
# when the user installs their first package.
|
|
|
|
|
export PATH=\"$profile/bin:$PATH\"
|
|
|
|
|
fi
|
|
|
|
|
done
|
2015-05-06 12:23:27 -04:00
|
|
|
|
|
2018-06-18 16:57:22 -04:00
|
|
|
|
# Prepend setuid programs.
|
|
|
|
|
export PATH=/run/setuid-programs:$PATH
|
|
|
|
|
|
2018-06-12 09:04:52 -04:00
|
|
|
|
# Arrange so that ~/.config/guix/current/share/info comes first.
|
|
|
|
|
export INFOPATH=\"$HOME/.config/guix/current/share/info:$INFOPATH\"
|
|
|
|
|
|
2016-03-08 17:30:53 -05:00
|
|
|
|
# Set the umask, notably for users logging in via 'lsh'.
|
|
|
|
|
# See <http://bugs.gnu.org/22650>.
|
|
|
|
|
umask 022
|
2016-02-03 03:07:35 -05:00
|
|
|
|
|
2017-09-18 03:50:52 -04:00
|
|
|
|
# Allow Hunspell-based applications (IceCat, LibreOffice, etc.) to
|
|
|
|
|
# find dictionaries.
|
|
|
|
|
export DICPATH=\"$HOME/.guix-profile/share/hunspell:/run/current-system/profile/share/hunspell\"
|
|
|
|
|
|
2015-10-15 17:06:20 -04:00
|
|
|
|
# Allow GStreamer-based applications to find plugins.
|
|
|
|
|
export GST_PLUGIN_PATH=\"$HOME/.guix-profile/lib/gstreamer-1.0\"
|
|
|
|
|
|
2015-03-12 17:11:18 -04:00
|
|
|
|
if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ]
|
|
|
|
|
then
|
|
|
|
|
# Load Bash-specific initialization code.
|
2015-05-07 03:45:45 -04:00
|
|
|
|
. /etc/bashrc
|
2015-03-12 17:11:18 -04:00
|
|
|
|
fi
|
2014-05-12 17:37:13 -04:00
|
|
|
|
"))
|
2015-03-12 17:11:18 -04:00
|
|
|
|
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
(bashrc (plain-file "bashrc" "\
|
2015-03-12 17:11:18 -04:00
|
|
|
|
# Bash-specific initialization.
|
|
|
|
|
|
2022-12-27 15:52:59 -05:00
|
|
|
|
# Provide a default prompt. The user's ~/.bashrc can override it.
|
|
|
|
|
PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '
|
|
|
|
|
|
2015-03-12 17:11:18 -04:00
|
|
|
|
# The 'bash-completion' package.
|
|
|
|
|
if [ -f /run/current-system/profile/etc/profile.d/bash_completion.sh ]
|
|
|
|
|
then
|
|
|
|
|
# Bash-completion sources ~/.bash_completion. It installs a dynamic
|
|
|
|
|
# completion loader that searches its own completion files as well
|
|
|
|
|
# as those in ~/.guix-profile and /run/current-system/profile.
|
|
|
|
|
source /run/current-system/profile/etc/profile.d/bash_completion.sh
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
fi\n")))
|
2023-03-13 13:36:14 -04:00
|
|
|
|
(service etc-service-type
|
2023-03-10 15:21:22 -05:00
|
|
|
|
`(("os-release" ,os-release)
|
2021-09-28 06:19:26 -04:00
|
|
|
|
("services" ,(file-append net-base "/etc/services"))
|
system: Use 'file-append' to denote file names.
* gnu/services/avahi.scm, gnu/services/base.scm,
gnu/services/databases.scm, gnu/services/dbus.scm,
gnu/services/desktop.scm, gnu/services/dict.scm,
gnu/services/mail.scm, gnu/services/networking.scm,
gnu/services/sddm.scm, gnu/services/spice.scm,
gnu/services/ssh.scm, gnu/services/web.scm,
gnu/services/xorg.scm, gnu/system.scm: Replace the
#~(string-append #$pkg "/bin/foo") idiom with
(file-append pkg "/bin/foo").
2016-09-10 06:03:47 -04:00
|
|
|
|
("protocols" ,(file-append net-base "/etc/protocols"))
|
|
|
|
|
("rpc" ,(file-append net-base "/etc/rpc"))
|
2023-03-10 15:21:22 -05:00
|
|
|
|
("login.defs" ,login.defs)
|
|
|
|
|
("issue" ,issue)
|
|
|
|
|
,@(if nsswitch `(("nsswitch.conf" ,nsswitch)) '())
|
|
|
|
|
("profile" ,profile)
|
|
|
|
|
("bashrc" ,bashrc)
|
2017-09-16 07:54:40 -04:00
|
|
|
|
;; Write the operating-system-host-name to /etc/hostname to prevent
|
|
|
|
|
;; NetworkManager from changing the system's hostname when connecting
|
|
|
|
|
;; to certain networks. Some discussion at
|
|
|
|
|
;; https://lists.gnu.org/archive/html/help-guix/2017-09/msg00037.html
|
|
|
|
|
("hostname" ,(plain-file "hostname" (operating-system-host-name os)))
|
2019-07-16 10:04:58 -04:00
|
|
|
|
;; Some programs (e.g., GLib) look at /etc/timezone to find the
|
|
|
|
|
;; name of the current timezone. For details, see
|
|
|
|
|
;; https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00166.html
|
2021-09-14 05:35:54 -04:00
|
|
|
|
;; Some programs expect a terminating newline.
|
|
|
|
|
("timezone" ,(plain-file "timezone"
|
|
|
|
|
(string-append
|
|
|
|
|
(string-trim-both
|
|
|
|
|
(operating-system-timezone os))
|
|
|
|
|
"\n")))
|
system: Use 'file-append' to denote file names.
* gnu/services/avahi.scm, gnu/services/base.scm,
gnu/services/databases.scm, gnu/services/dbus.scm,
gnu/services/desktop.scm, gnu/services/dict.scm,
gnu/services/mail.scm, gnu/services/networking.scm,
gnu/services/sddm.scm, gnu/services/spice.scm,
gnu/services/ssh.scm, gnu/services/web.scm,
gnu/services/xorg.scm, gnu/system.scm: Replace the
#~(string-append #$pkg "/bin/foo") idiom with
(file-append pkg "/bin/foo").
2016-09-10 06:03:47 -04:00
|
|
|
|
("localtime" ,(file-append tzdata "/share/zoneinfo/"
|
|
|
|
|
(operating-system-timezone os)))
|
2020-08-24 11:02:48 -04:00
|
|
|
|
,@(if sudoers
|
|
|
|
|
`(("sudoers" ,(validated-sudoers-file sudoers)))
|
|
|
|
|
'())
|
2020-04-25 05:55:56 -04:00
|
|
|
|
,@(if hurd
|
|
|
|
|
`(("login" ,(file-append hurd "/etc/login"))
|
2020-06-09 11:44:52 -04:00
|
|
|
|
("motd" ,(file-append hurd "/etc/motd"))
|
|
|
|
|
("ttys" ,(file-append hurd "/etc/ttys")))
|
2020-04-25 05:55:56 -04:00
|
|
|
|
'())))))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
system: Make accounts and groups at activation time.
* gnu/services/base.scm (guix-build-accounts): Remove #:gid parameter;
add #:group. Remove 'password' and 'gid' fields in 'user-account'
form, and add 'group'.
(guix-service): Remove #:build-user-gid parameter. Remove 'id' field
in 'user-group' form.
* gnu/system.scm (etc-directory): Remove #:groups and #:accounts. No
longer produce files "passwd", "shadow", and "group". Adjust caller
accordingly.
(%root-account): New variable.
(operating-system-accounts): Add 'users' variable. Add %ROOT-ACCOUNT
only of 'operating-system-users' doesn't already contain a root
account.
(user-group->gexp, user-account->gexp): New procedures.
(operating-system-boot-script): Add calls to 'setenv' and
'activate-users+groups' in gexp.
* gnu/system/linux.scm (base-pam-services): Add PAM services for
"user{add,del,mode}" and "group{add,del,mod}".
* gnu/system/shadow.scm (<user-account>)[gid]: Rename to...
[group]: ... this.
[supplementary-groups]: New field.
[uid, password]: Default to #f.
(<user-group>)[id]: Default to #f.
(group-file, passwd-file): Remove.
* gnu/system/vm.scm (operating-system-default-contents)[user-directories]:
Remove. Add "/home" to the directives.
* guix/build/activation.scm (add-group, add-user,
activate-users+groups): New procedures.
2014-05-11 16:41:01 -04:00
|
|
|
|
(define %root-account
|
|
|
|
|
;; Default root account.
|
|
|
|
|
(user-account
|
|
|
|
|
(name "root")
|
|
|
|
|
(password "")
|
|
|
|
|
(uid 0) (group "root")
|
|
|
|
|
(comment "System administrator")
|
|
|
|
|
(home-directory "/root")))
|
|
|
|
|
|
2014-04-23 09:47:42 -04:00
|
|
|
|
(define (operating-system-accounts os)
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
"Return the user accounts for OS, including an obligatory 'root' account,
|
|
|
|
|
and excluding accounts requested by services."
|
|
|
|
|
;; Make sure there's a root account.
|
|
|
|
|
(if (find (lambda (user)
|
|
|
|
|
(and=> (user-account-uid user) zero?))
|
|
|
|
|
(operating-system-users os))
|
|
|
|
|
(operating-system-users os)
|
|
|
|
|
(cons %root-account (operating-system-users os))))
|
2014-04-23 09:47:42 -04:00
|
|
|
|
|
2015-06-05 14:22:47 -04:00
|
|
|
|
(define (maybe-string->file file-name thing)
|
|
|
|
|
"If THING is a string, return a <plain-file> with THING as its content.
|
|
|
|
|
Otherwise just return THING.
|
|
|
|
|
|
|
|
|
|
This is for backward-compatibility of fields that used to be strings and are
|
|
|
|
|
now file-like objects.."
|
|
|
|
|
(match thing
|
|
|
|
|
((? string?)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(warning (G_ "using a string for file '~a' is deprecated; \
|
2015-06-05 14:22:47 -04:00
|
|
|
|
use 'plain-file' instead~%")
|
|
|
|
|
file-name)
|
|
|
|
|
(plain-file file-name thing))
|
|
|
|
|
(x
|
|
|
|
|
x)))
|
|
|
|
|
|
2015-06-05 16:41:55 -04:00
|
|
|
|
(define (maybe-file->monadic file-name thing)
|
|
|
|
|
"If THING is a value in %STORE-MONAD, return it as is; otherwise return
|
|
|
|
|
THING in the %STORE-MONAD.
|
|
|
|
|
|
|
|
|
|
This is for backward-compatibility of fields that used to be monadic values
|
|
|
|
|
and are now file-like objects."
|
|
|
|
|
(with-monad %store-monad
|
|
|
|
|
(match thing
|
|
|
|
|
((? procedure?)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(warning (G_ "using a monadic value for '~a' is deprecated; \
|
2015-06-05 16:41:55 -04:00
|
|
|
|
use 'plain-file' instead~%")
|
|
|
|
|
file-name)
|
|
|
|
|
thing)
|
|
|
|
|
(x
|
|
|
|
|
(return x)))))
|
|
|
|
|
|
2014-04-23 09:47:42 -04:00
|
|
|
|
(define (operating-system-etc-directory os)
|
|
|
|
|
"Return that static part of the /etc directory of OS."
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
(etc-directory
|
|
|
|
|
(fold-services (operating-system-services os)
|
|
|
|
|
#:target-type etc-service-type)))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2015-12-02 08:14:02 -05:00
|
|
|
|
(define (operating-system-environment-variables os)
|
|
|
|
|
"Return the environment variables of OS for
|
|
|
|
|
@var{session-environment-service-type}, to be used in @file{/etc/environment}."
|
|
|
|
|
`(("LANG" . ,(operating-system-locale os))
|
2017-11-09 03:58:33 -05:00
|
|
|
|
;; Note: No need to set 'TZ' since (1) we provide /etc/localtime, and (2)
|
|
|
|
|
;; it doesn't work for setuid binaries. See <https://bugs.gnu.org/29212>.
|
system: Use 'file-append' to denote file names.
* gnu/services/avahi.scm, gnu/services/base.scm,
gnu/services/databases.scm, gnu/services/dbus.scm,
gnu/services/desktop.scm, gnu/services/dict.scm,
gnu/services/mail.scm, gnu/services/networking.scm,
gnu/services/sddm.scm, gnu/services/spice.scm,
gnu/services/ssh.scm, gnu/services/web.scm,
gnu/services/xorg.scm, gnu/system.scm: Replace the
#~(string-append #$pkg "/bin/foo") idiom with
(file-append pkg "/bin/foo").
2016-09-10 06:03:47 -04:00
|
|
|
|
("TZDIR" . ,(file-append tzdata "/share/zoneinfo"))
|
2015-12-02 08:14:02 -05:00
|
|
|
|
;; Tell 'modprobe' & co. where to look for modules.
|
|
|
|
|
("LINUX_MODULE_DIRECTORY" . "/run/booted-system/kernel/lib/modules")
|
|
|
|
|
;; These variables are honored by OpenSSL (libssl) and Git.
|
|
|
|
|
("SSL_CERT_DIR" . "/etc/ssl/certs")
|
|
|
|
|
("SSL_CERT_FILE" . "/etc/ssl/certs/ca-certificates.crt")
|
|
|
|
|
("GIT_SSL_CAINFO" . "/etc/ssl/certs/ca-certificates.crt")
|
2016-04-04 16:27:15 -04:00
|
|
|
|
|
|
|
|
|
;; 'GTK_DATA_PREFIX' must name one directory where GTK+ themes are
|
|
|
|
|
;; searched for.
|
|
|
|
|
("GTK_DATA_PREFIX" . "/run/current-system/profile")
|
|
|
|
|
|
2015-12-02 08:14:02 -05:00
|
|
|
|
;; By default, applications that use D-Bus, such as Emacs, abort at startup
|
|
|
|
|
;; when /etc/machine-id is missing. Make sure these warnings are non-fatal.
|
2023-03-27 12:56:14 -04:00
|
|
|
|
("DBUS_FATAL_WARNINGS" . "0")))
|
2015-12-02 08:14:02 -05:00
|
|
|
|
|
2021-11-17 09:43:48 -05:00
|
|
|
|
;; Ensure LST is a list of <setuid-program> records and warn otherwise.
|
|
|
|
|
(define-with-syntax-properties (ensure-setuid-program-list (lst properties))
|
|
|
|
|
(%ensure-setuid-program-list lst properties))
|
2021-08-12 05:58:47 -04:00
|
|
|
|
|
2021-11-17 09:43:48 -05:00
|
|
|
|
;; We want to be able to use defines, so define a procedure.
|
|
|
|
|
(define (%ensure-setuid-program-list lst properties)
|
2021-08-12 05:58:47 -04:00
|
|
|
|
(define warned? #f)
|
|
|
|
|
|
|
|
|
|
(define (warn-once)
|
|
|
|
|
(unless warned?
|
2021-11-17 09:43:48 -05:00
|
|
|
|
(warning (source-properties->location properties)
|
2021-08-12 05:58:47 -04:00
|
|
|
|
(G_ "representing setuid programs with file-like objects is \
|
|
|
|
|
deprecated; use 'setuid-program' instead~%"))
|
|
|
|
|
(set! warned? #t)))
|
|
|
|
|
|
|
|
|
|
(map (match-lambda
|
|
|
|
|
((? setuid-program? program)
|
2021-08-12 06:08:55 -04:00
|
|
|
|
program)
|
|
|
|
|
(program
|
|
|
|
|
;; PROGRAM is a file-like or a gexp like #~(string-append #$foo
|
|
|
|
|
;; "/bin/bar").
|
|
|
|
|
(warn-once)
|
|
|
|
|
(setuid-program (program program))))
|
2021-08-12 05:58:47 -04:00
|
|
|
|
lst))
|
2021-07-06 16:03:19 -04:00
|
|
|
|
|
2014-04-30 16:17:56 -04:00
|
|
|
|
(define %setuid-programs
|
|
|
|
|
;; Default set of setuid-root programs.
|
2015-08-18 23:56:16 -04:00
|
|
|
|
(let ((shadow (@ (gnu packages admin) shadow)))
|
2021-07-06 16:03:20 -04:00
|
|
|
|
(map file-like->setuid-program
|
|
|
|
|
(list (file-append shadow "/bin/passwd")
|
2021-12-31 11:45:12 -05:00
|
|
|
|
(file-append shadow "/bin/chfn")
|
2021-07-06 16:03:20 -04:00
|
|
|
|
(file-append shadow "/bin/sg")
|
|
|
|
|
(file-append shadow "/bin/su")
|
|
|
|
|
(file-append shadow "/bin/newgrp")
|
|
|
|
|
(file-append shadow "/bin/newuidmap")
|
|
|
|
|
(file-append shadow "/bin/newgidmap")
|
|
|
|
|
(file-append inetutils "/bin/ping")
|
|
|
|
|
(file-append inetutils "/bin/ping6")
|
|
|
|
|
(file-append sudo "/bin/sudo")
|
|
|
|
|
(file-append sudo "/bin/sudoedit")
|
2023-07-29 20:00:00 -04:00
|
|
|
|
(file-append fuse-2 "/bin/fusermount")
|
2023-07-22 20:00:00 -04:00
|
|
|
|
(file-append fuse "/bin/fusermount3")
|
2021-07-06 16:03:20 -04:00
|
|
|
|
|
|
|
|
|
;; To allow mounts with the "user" option, "mount" and "umount" must
|
|
|
|
|
;; be setuid-root.
|
|
|
|
|
(file-append util-linux "/bin/mount")
|
|
|
|
|
(file-append util-linux "/bin/umount")))))
|
2014-05-01 09:29:24 -04:00
|
|
|
|
|
|
|
|
|
(define %sudoers-specification
|
|
|
|
|
;; Default /etc/sudoers contents: 'root' and all members of the 'wheel'
|
|
|
|
|
;; group can do anything. See
|
|
|
|
|
;; <http://www.sudo.ws/sudo/man/1.8.10/sudoers.man.html>.
|
|
|
|
|
;; TODO: Add a declarative API.
|
2015-06-05 14:22:47 -04:00
|
|
|
|
(plain-file "sudoers" "\
|
|
|
|
|
root ALL=(ALL) ALL
|
|
|
|
|
%wheel ALL=(ALL) ALL\n"))
|
2014-04-30 16:17:56 -04:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(define* (operating-system-activation-script os)
|
2014-05-24 09:51:57 -04:00
|
|
|
|
"Return the activation script for OS---i.e., the code that \"activates\" the
|
|
|
|
|
stateful part of OS, including user accounts and groups, special directories,
|
|
|
|
|
etc."
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(let* ((services (operating-system-services os))
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
(activation (fold-services services
|
|
|
|
|
#:target-type activation-service-type)))
|
|
|
|
|
(activation-service->script activation)))
|
2014-05-24 09:51:57 -04:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(define* (operating-system-boot-script os)
|
2014-05-24 09:51:57 -04:00
|
|
|
|
"Return the boot script for OS---i.e., the code started by the initrd once
|
2019-03-22 12:48:37 -04:00
|
|
|
|
we're running in the final root."
|
|
|
|
|
(let* ((services (operating-system-services os))
|
2015-11-02 12:44:17 -05:00
|
|
|
|
(boot (fold-services services #:target-type boot-service-type)))
|
2017-04-15 16:12:37 -04:00
|
|
|
|
(service-value boot)))
|
2014-04-23 10:52:14 -04:00
|
|
|
|
|
2016-05-04 16:48:28 -04:00
|
|
|
|
(define (operating-system-user-accounts os)
|
|
|
|
|
"Return the list of user accounts of OS."
|
|
|
|
|
(let* ((services (operating-system-services os))
|
|
|
|
|
(account (fold-services services
|
|
|
|
|
#:target-type account-service-type)))
|
|
|
|
|
(filter user-account?
|
2017-04-15 16:12:37 -04:00
|
|
|
|
(service-value account))))
|
2016-05-04 16:48:28 -04:00
|
|
|
|
|
|
|
|
|
(define (operating-system-shepherd-service-names os)
|
|
|
|
|
"Return the list of Shepherd service names for OS."
|
|
|
|
|
(append-map shepherd-service-provision
|
2021-01-22 14:06:55 -05:00
|
|
|
|
(shepherd-configuration-services
|
|
|
|
|
(service-value
|
|
|
|
|
(fold-services (operating-system-services os)
|
|
|
|
|
#:target-type
|
|
|
|
|
shepherd-root-service-type)))))
|
2016-05-04 16:48:28 -04:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(define* (operating-system-derivation os)
|
2015-11-02 12:44:17 -05:00
|
|
|
|
"Return a derivation that builds OS."
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(let* ((services (operating-system-services os))
|
2015-11-02 12:44:17 -05:00
|
|
|
|
(system (fold-services services)))
|
|
|
|
|
;; SYSTEM contains the derivation as a monadic value.
|
2017-04-15 16:12:37 -04:00
|
|
|
|
(service-value system)))
|
2015-11-02 12:44:17 -05:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(define* (operating-system-profile os)
|
2015-11-02 15:52:28 -05:00
|
|
|
|
"Return a derivation that builds the system profile of OS."
|
|
|
|
|
(mlet* %store-monad
|
2019-03-22 12:48:37 -04:00
|
|
|
|
((services -> (operating-system-services os))
|
2015-11-02 15:52:28 -05:00
|
|
|
|
(profile (fold-services services
|
|
|
|
|
#:target-type profile-service-type)))
|
|
|
|
|
(match profile
|
|
|
|
|
(("profile" profile)
|
|
|
|
|
(return profile)))))
|
|
|
|
|
|
2014-05-02 18:26:07 -04:00
|
|
|
|
(define (operating-system-root-file-system os)
|
|
|
|
|
"Return the root file system of OS."
|
2020-07-14 19:32:25 -04:00
|
|
|
|
(or (find (lambda (fs)
|
|
|
|
|
(string=? "/" (file-system-mount-point fs)))
|
|
|
|
|
(operating-system-file-systems os))
|
|
|
|
|
(raise (condition
|
|
|
|
|
(&message (message "missing root file system"))
|
|
|
|
|
(&error-location
|
|
|
|
|
(location (operating-system-location os)))))))
|
2014-05-02 18:26:07 -04:00
|
|
|
|
|
2014-05-17 11:39:30 -04:00
|
|
|
|
(define (operating-system-initrd-file os)
|
|
|
|
|
"Return a gexp denoting the initrd file of OS."
|
2014-05-02 18:26:07 -04:00
|
|
|
|
(define boot-file-systems
|
2014-11-25 10:01:21 -05:00
|
|
|
|
(filter file-system-needed-for-boot?
|
2014-05-02 18:26:07 -04:00
|
|
|
|
(operating-system-file-systems os)))
|
|
|
|
|
|
2014-09-22 05:06:42 -04:00
|
|
|
|
(define mapped-devices
|
|
|
|
|
(operating-system-boot-mapped-devices os))
|
|
|
|
|
|
|
|
|
|
(define make-initrd
|
|
|
|
|
(operating-system-initrd os))
|
|
|
|
|
|
2018-11-21 10:19:09 -05:00
|
|
|
|
(make-initrd boot-file-systems
|
|
|
|
|
#:linux (operating-system-kernel os)
|
|
|
|
|
#:linux-modules
|
|
|
|
|
(operating-system-initrd-modules os)
|
2019-03-20 07:19:14 -04:00
|
|
|
|
#:mapped-devices mapped-devices
|
|
|
|
|
#:keyboard-layout (operating-system-keyboard-layout os)))
|
2014-05-17 11:39:30 -04:00
|
|
|
|
|
2020-04-28 08:12:34 -04:00
|
|
|
|
(define* (operating-system-uuid os #:optional (type 'dce))
|
|
|
|
|
"Compute UUID object with a deterministic \"UUID\" for OS, of the given
|
|
|
|
|
TYPE (one of 'iso9660 or 'dce). Return a UUID object."
|
|
|
|
|
;; Note: For this to be deterministic, we must not hash things that contains
|
|
|
|
|
;; (directly or indirectly) procedures, for example. That rules out
|
|
|
|
|
;; anything that contains gexps, thunk or delayed record fields, etc.
|
|
|
|
|
|
|
|
|
|
(define service-name
|
|
|
|
|
(compose service-type-name service-kind))
|
|
|
|
|
|
|
|
|
|
(define (file-system-digest fs)
|
|
|
|
|
;; Return a hashable digest that does not contain 'dependencies' since
|
|
|
|
|
;; this field can contain procedures.
|
|
|
|
|
(let ((device (file-system-device fs)))
|
|
|
|
|
(list (file-system-mount-point fs)
|
|
|
|
|
(file-system-type fs)
|
|
|
|
|
(file-system-device->string device)
|
|
|
|
|
(file-system-options fs))))
|
|
|
|
|
|
|
|
|
|
(if (eq? type 'iso9660)
|
|
|
|
|
(let ((pad (compose (cut string-pad <> 2 #\0)
|
|
|
|
|
number->string))
|
|
|
|
|
(h (hash (map service-name (operating-system-services os))
|
|
|
|
|
3600)))
|
|
|
|
|
(bytevector->uuid
|
|
|
|
|
(string->iso9660-uuid
|
|
|
|
|
(string-append "1970-01-01-"
|
|
|
|
|
(pad (hash (operating-system-host-name os) 24)) "-"
|
|
|
|
|
(pad (quotient h 60)) "-"
|
|
|
|
|
(pad (modulo h 60)) "-"
|
|
|
|
|
(pad (hash (map file-system-digest
|
|
|
|
|
(operating-system-file-systems os))
|
|
|
|
|
100))))
|
|
|
|
|
'iso9660))
|
|
|
|
|
(bytevector->uuid
|
|
|
|
|
(uint-list->bytevector
|
|
|
|
|
(list (hash (map file-system-digest
|
|
|
|
|
(operating-system-file-systems os))
|
|
|
|
|
(- (expt 2 32) 1))
|
|
|
|
|
(hash (operating-system-host-name os)
|
|
|
|
|
(- (expt 2 32) 1))
|
|
|
|
|
(hash (map service-name (operating-system-services os))
|
|
|
|
|
(- (expt 2 32) 1))
|
|
|
|
|
(hash (map file-system-digest (operating-system-file-systems os))
|
|
|
|
|
(- (expt 2 32) 1)))
|
|
|
|
|
(endianness little)
|
|
|
|
|
4)
|
|
|
|
|
type)))
|
|
|
|
|
|
2016-02-10 05:01:54 -05:00
|
|
|
|
(define (locale-name->definition* name)
|
|
|
|
|
"Variant of 'locale-name->definition' that raises an error upon failure."
|
|
|
|
|
(match (locale-name->definition name)
|
|
|
|
|
(#f
|
2020-07-25 12:26:18 -04:00
|
|
|
|
(raise (formatted-message (G_ "~a: invalid locale name") name)))
|
2016-02-10 05:01:54 -05:00
|
|
|
|
(def def)))
|
|
|
|
|
|
2014-11-26 16:49:11 -05:00
|
|
|
|
(define (operating-system-locale-directory os)
|
|
|
|
|
"Return the directory containing the locales compiled for the definitions
|
|
|
|
|
listed in OS. The C library expects to find it under
|
|
|
|
|
/run/current-system/locale."
|
2016-02-10 05:01:54 -05:00
|
|
|
|
(define name
|
|
|
|
|
(operating-system-locale os))
|
|
|
|
|
|
|
|
|
|
(define definitions
|
|
|
|
|
;; While we're at it, check whether NAME is defined and add it if needed.
|
|
|
|
|
(if (member name (map locale-definition-name
|
|
|
|
|
(operating-system-locale-definitions os)))
|
|
|
|
|
(operating-system-locale-definitions os)
|
|
|
|
|
(cons (locale-name->definition* name)
|
|
|
|
|
(operating-system-locale-definitions os))))
|
|
|
|
|
|
|
|
|
|
(locale-directory definitions
|
2015-10-30 18:05:52 -04:00
|
|
|
|
#:libcs (operating-system-locale-libcs os)))
|
2014-11-26 16:49:11 -05:00
|
|
|
|
|
2020-05-10 09:31:45 -04:00
|
|
|
|
(define* (kernel->boot-label kernel #:key hurd)
|
2017-04-02 09:52:34 -04:00
|
|
|
|
"Return a label for the bootloader menu entry that boots KERNEL."
|
2020-05-10 09:31:45 -04:00
|
|
|
|
(cond ((package? hurd)
|
|
|
|
|
(string-append "GNU with the "
|
|
|
|
|
(string-titlecase (package-name hurd)) " "
|
|
|
|
|
(package-version hurd)))
|
|
|
|
|
((package? kernel)
|
2018-12-19 15:22:20 -05:00
|
|
|
|
(string-append "GNU with "
|
|
|
|
|
(string-titlecase (package-name kernel)) " "
|
2019-04-14 17:30:52 -04:00
|
|
|
|
(package-version kernel)))
|
2018-12-19 15:22:20 -05:00
|
|
|
|
((inferior-package? kernel)
|
|
|
|
|
(string-append "GNU with "
|
2018-12-24 14:52:59 -05:00
|
|
|
|
(string-titlecase (inferior-package-name kernel)) " "
|
2019-04-14 17:30:52 -04:00
|
|
|
|
(inferior-package-version kernel)))
|
2018-12-19 15:22:20 -05:00
|
|
|
|
(else "GNU")))
|
2014-06-25 16:46:44 -04:00
|
|
|
|
|
2019-04-15 05:30:50 -04:00
|
|
|
|
(define (operating-system-default-label os)
|
|
|
|
|
"Return the default label for OS, as it will appear in the bootloader menu
|
|
|
|
|
entry."
|
2020-05-10 09:31:45 -04:00
|
|
|
|
(kernel->boot-label (operating-system-kernel os)
|
|
|
|
|
#:hurd (operating-system-hurd os)))
|
2019-04-15 05:30:50 -04:00
|
|
|
|
|
2016-01-21 16:45:54 -05:00
|
|
|
|
(define (store-file-system file-systems)
|
|
|
|
|
"Return the file system object among FILE-SYSTEMS that contains the store."
|
|
|
|
|
(match (filter (lambda (fs)
|
|
|
|
|
(and (file-system-mount? fs)
|
|
|
|
|
(not (memq 'bind-mount (file-system-flags fs)))
|
|
|
|
|
(string-prefix? (file-system-mount-point fs)
|
|
|
|
|
(%store-prefix))))
|
|
|
|
|
file-systems)
|
|
|
|
|
((and candidates (head . tail))
|
|
|
|
|
(reduce (lambda (fs1 fs2)
|
|
|
|
|
(if (> (string-length (file-system-mount-point fs1))
|
|
|
|
|
(string-length (file-system-mount-point fs2)))
|
|
|
|
|
fs1
|
|
|
|
|
fs2))
|
|
|
|
|
head
|
|
|
|
|
candidates))))
|
|
|
|
|
|
|
|
|
|
(define (operating-system-store-file-system os)
|
|
|
|
|
"Return the file system that contains the store of OS."
|
|
|
|
|
(store-file-system (operating-system-file-systems os)))
|
|
|
|
|
|
2017-04-02 09:52:29 -04:00
|
|
|
|
(define* (operating-system-bootcfg os #:optional (old-entries '()))
|
2018-11-16 02:39:07 -05:00
|
|
|
|
"Return the bootloader configuration file for OS. Use OLD-ENTRIES,
|
|
|
|
|
a list of <menu-entry>, to populate the \"old entries\" menu."
|
2019-07-14 07:50:23 -04:00
|
|
|
|
(let* ((file-systems (operating-system-file-systems os))
|
|
|
|
|
(root-fs (operating-system-root-file-system os))
|
2018-11-16 02:50:44 -05:00
|
|
|
|
(root-device (file-system-device root-fs))
|
2019-04-22 08:44:22 -04:00
|
|
|
|
(locale (operating-system-locale os))
|
2020-12-21 07:02:01 -05:00
|
|
|
|
(crypto-devices (operating-system-bootloader-crypto-devices os))
|
2018-11-16 02:50:44 -05:00
|
|
|
|
(params (operating-system-boot-parameters
|
|
|
|
|
os root-device
|
|
|
|
|
#:system-kernel-arguments? #t))
|
|
|
|
|
(entry (boot-parameters->menu-entry params))
|
|
|
|
|
(bootloader-conf (operating-system-bootloader os)))
|
2019-07-14 07:50:23 -04:00
|
|
|
|
|
2018-11-15 07:32:07 -05:00
|
|
|
|
(define generate-config-file
|
|
|
|
|
(bootloader-configuration-file-generator
|
|
|
|
|
(bootloader-configuration-bootloader bootloader-conf)))
|
|
|
|
|
|
2018-11-16 02:50:44 -05:00
|
|
|
|
(generate-config-file bootloader-conf (list entry)
|
2019-07-14 07:50:23 -04:00
|
|
|
|
#:old-entries old-entries
|
2019-04-22 08:44:22 -04:00
|
|
|
|
#:locale locale
|
2020-12-21 07:02:01 -05:00
|
|
|
|
#:store-crypto-devices crypto-devices
|
2020-05-27 22:44:28 -04:00
|
|
|
|
#:store-directory-prefix
|
2019-07-14 07:50:23 -04:00
|
|
|
|
(btrfs-store-subvolume-file-name file-systems))))
|
2014-05-17 11:39:30 -04:00
|
|
|
|
|
2020-05-26 11:38:30 -04:00
|
|
|
|
(define (operating-system-multiboot-modules os)
|
|
|
|
|
(if (operating-system-hurd os) (hurd-multiboot-modules os) '()))
|
|
|
|
|
|
|
|
|
|
(define (hurd-multiboot-modules os)
|
|
|
|
|
(let* ((hurd (operating-system-hurd os))
|
2023-05-15 13:11:35 -04:00
|
|
|
|
(pci-arbiter-command
|
|
|
|
|
(list (file-append hurd "/hurd/pci-arbiter.static")
|
|
|
|
|
"pci-arbiter"
|
|
|
|
|
"--host-priv-port='${host-port}'"
|
|
|
|
|
"--device-master-port='${device-port}'"
|
|
|
|
|
"--next-task='${disk-task}'"
|
|
|
|
|
"'$(pci-task=task-create)'"
|
|
|
|
|
"'$(task-resume)'"))
|
|
|
|
|
(rumpdisk-command
|
|
|
|
|
(list (file-append hurd "/hurd/rumpdisk.static")
|
|
|
|
|
"rumpdisk"
|
|
|
|
|
"--next-task='${fs-task}'"
|
|
|
|
|
"'$(disk-task=task-create)'"))
|
2020-05-26 11:38:30 -04:00
|
|
|
|
(root-file-system-command
|
|
|
|
|
(list (file-append hurd "/hurd/ext2fs.static")
|
|
|
|
|
"ext2fs"
|
|
|
|
|
"--multiboot-command-line='${kernel-command-line}'"
|
|
|
|
|
"--exec-server-task='${exec-task}'"
|
|
|
|
|
"--store-type=typed"
|
2020-06-08 06:25:24 -04:00
|
|
|
|
"--x-xattr-translator-records"
|
2023-05-15 13:11:35 -04:00
|
|
|
|
"'${root}'"
|
|
|
|
|
"'$(fs-task=task-create)'"))
|
2020-05-26 11:38:30 -04:00
|
|
|
|
(target (%current-target-system))
|
|
|
|
|
(libc (if target
|
|
|
|
|
(with-parameters ((%current-target-system #f))
|
|
|
|
|
;; TODO: cross-libc has extra patches for the Hurd;
|
|
|
|
|
;; remove in next rebuild cycle
|
|
|
|
|
(cross-libc target))
|
|
|
|
|
glibc))
|
|
|
|
|
(exec-server-command
|
2022-10-23 06:20:55 -04:00
|
|
|
|
;; XXX: Run the statically-linked 'exec' to work around
|
2023-05-06 13:46:34 -04:00
|
|
|
|
;; <https://issues.guix.gnu.org/58320>, which manifests on some
|
2022-10-23 06:20:55 -04:00
|
|
|
|
;; machines.
|
|
|
|
|
|
|
|
|
|
;; (list (file-append libc "/lib/ld.so.1") "exec"
|
|
|
|
|
;; (file-append hurd "/hurd/exec") "'$(exec-task=task-create)'")
|
|
|
|
|
(list (file-append hurd "/hurd/exec.static") "exec"
|
|
|
|
|
"'$(exec-task=task-create)'")))
|
2023-05-15 13:11:35 -04:00
|
|
|
|
(list pci-arbiter-command
|
|
|
|
|
rumpdisk-command
|
|
|
|
|
root-file-system-command
|
|
|
|
|
exec-server-command)))
|
2020-05-26 11:38:30 -04:00
|
|
|
|
|
2018-11-15 08:36:16 -05:00
|
|
|
|
(define* (operating-system-boot-parameters os root-device
|
|
|
|
|
#:key system-kernel-arguments?)
|
|
|
|
|
"Return a monadic <boot-parameters> record that describes the boot
|
2022-02-17 23:28:07 -05:00
|
|
|
|
parameters of OS. When SYSTEM-KERNEL-ARGUMENTS? is true, add the kernel
|
|
|
|
|
arguments 'root', 'gnu.load' and 'gnu.system' to <boot-parameters>. The
|
|
|
|
|
SYSTEM-KERNEL-ARGUMENTS? should only be used in necessity, as the 'gnu.load'
|
|
|
|
|
and 'gnu.system' values are self-referential (they refer to the system), thus
|
2022-02-28 17:05:14 -05:00
|
|
|
|
susceptible to introduce a cyclic dependency."
|
2020-07-05 03:40:34 -04:00
|
|
|
|
(let* ((initrd (and (not (operating-system-hurd os))
|
2020-05-26 11:38:30 -04:00
|
|
|
|
(operating-system-initrd-file os)))
|
2018-11-15 12:52:38 -05:00
|
|
|
|
(store (operating-system-store-file-system os))
|
2020-10-24 12:15:53 -04:00
|
|
|
|
(file-systems (operating-system-file-systems os))
|
2020-12-21 07:02:01 -05:00
|
|
|
|
(crypto-devices (operating-system-bootloader-crypto-devices os))
|
2019-10-21 06:23:40 -04:00
|
|
|
|
(locale (operating-system-locale os))
|
2018-11-15 12:52:38 -05:00
|
|
|
|
(bootloader (bootloader-configuration-bootloader
|
|
|
|
|
(operating-system-bootloader os)))
|
|
|
|
|
(bootloader-name (bootloader-name bootloader))
|
2020-05-26 11:38:30 -04:00
|
|
|
|
(label (operating-system-label os))
|
|
|
|
|
(multiboot-modules (operating-system-multiboot-modules os)))
|
2018-11-15 12:52:38 -05:00
|
|
|
|
(boot-parameters
|
|
|
|
|
(label label)
|
|
|
|
|
(root-device root-device)
|
|
|
|
|
(kernel (operating-system-kernel-file os))
|
|
|
|
|
(kernel-arguments
|
|
|
|
|
(if system-kernel-arguments?
|
|
|
|
|
(operating-system-kernel-arguments os root-device)
|
|
|
|
|
(operating-system-user-kernel-arguments os)))
|
|
|
|
|
(initrd initrd)
|
2020-05-26 11:38:30 -04:00
|
|
|
|
(multiboot-modules multiboot-modules)
|
2018-11-15 12:52:38 -05:00
|
|
|
|
(bootloader-name bootloader-name)
|
2019-08-28 17:27:20 -04:00
|
|
|
|
(bootloader-menu-entries
|
|
|
|
|
(bootloader-configuration-menu-entries (operating-system-bootloader os)))
|
2019-10-21 06:23:40 -04:00
|
|
|
|
(locale locale)
|
2018-11-15 12:52:38 -05:00
|
|
|
|
(store-device (ensure-not-/dev (file-system-device store)))
|
2020-10-24 12:15:53 -04:00
|
|
|
|
(store-directory-prefix (btrfs-store-subvolume-file-name file-systems))
|
2020-12-21 07:02:01 -05:00
|
|
|
|
(store-crypto-devices crypto-devices)
|
2018-11-15 12:52:38 -05:00
|
|
|
|
(store-mount-point (file-system-mount-point store)))))
|
2017-04-21 08:37:07 -04:00
|
|
|
|
|
2017-09-06 03:28:28 -04:00
|
|
|
|
(define (device->sexp device)
|
|
|
|
|
"Serialize DEVICE as an sexp (really, as an object with a read syntax.)"
|
|
|
|
|
(match device
|
|
|
|
|
((? uuid? uuid)
|
2017-09-06 04:22:58 -04:00
|
|
|
|
`(uuid ,(uuid-type uuid) ,(uuid-bytevector uuid)))
|
2018-05-18 07:43:07 -04:00
|
|
|
|
((? file-system-label? label)
|
|
|
|
|
`(file-system-label ,(file-system-label->string label)))
|
2017-09-06 03:28:28 -04:00
|
|
|
|
(_
|
|
|
|
|
device)))
|
|
|
|
|
|
2022-02-28 17:05:14 -05:00
|
|
|
|
(define* (operating-system-boot-parameters-file os)
|
|
|
|
|
"Return a file that describes the boot parameters of OS. The primary use
|
|
|
|
|
of this file is the reconstruction of GRUB menu entries for old
|
|
|
|
|
configurations."
|
2018-11-15 12:52:38 -05:00
|
|
|
|
(let* ((root (operating-system-root-file-system os))
|
|
|
|
|
(device (file-system-device root))
|
2022-02-28 17:05:14 -05:00
|
|
|
|
(params (operating-system-boot-parameters os device)))
|
2020-04-22 09:03:51 -04:00
|
|
|
|
(scheme-file "parameters"
|
|
|
|
|
#~(boot-parameters
|
2022-02-18 15:42:07 -05:00
|
|
|
|
(version #$(boot-parameters-version params))
|
2020-04-22 09:03:51 -04:00
|
|
|
|
(label #$(boot-parameters-label params))
|
|
|
|
|
(root-device
|
|
|
|
|
#$(device->sexp
|
|
|
|
|
(boot-parameters-root-device params)))
|
|
|
|
|
(kernel #$(boot-parameters-kernel params))
|
|
|
|
|
(kernel-arguments
|
|
|
|
|
#$(boot-parameters-kernel-arguments params))
|
2020-06-28 12:51:25 -04:00
|
|
|
|
#$@(if (boot-parameters-initrd params)
|
|
|
|
|
#~((initrd #$(boot-parameters-initrd params)))
|
|
|
|
|
#~())
|
|
|
|
|
#$@(if (pair? (boot-parameters-multiboot-modules params))
|
|
|
|
|
#~((multiboot-modules
|
|
|
|
|
#$(boot-parameters-multiboot-modules params)))
|
|
|
|
|
#~())
|
2020-04-22 09:03:51 -04:00
|
|
|
|
(bootloader-name #$(boot-parameters-bootloader-name params))
|
|
|
|
|
(bootloader-menu-entries
|
|
|
|
|
#$(map menu-entry->sexp
|
|
|
|
|
(or (and=> (operating-system-bootloader os)
|
|
|
|
|
bootloader-configuration-menu-entries)
|
|
|
|
|
'())))
|
2019-10-21 06:23:40 -04:00
|
|
|
|
(locale #$(boot-parameters-locale params))
|
2020-04-22 09:03:51 -04:00
|
|
|
|
(store
|
|
|
|
|
(device
|
|
|
|
|
#$(device->sexp (boot-parameters-store-device params)))
|
|
|
|
|
(mount-point #$(boot-parameters-store-mount-point
|
2020-10-24 12:15:53 -04:00
|
|
|
|
params))
|
|
|
|
|
(directory-prefix
|
2020-12-21 07:02:01 -05:00
|
|
|
|
#$(boot-parameters-store-directory-prefix params))
|
|
|
|
|
(crypto-devices
|
|
|
|
|
#$(map device->sexp
|
|
|
|
|
(boot-parameters-store-crypto-devices params)))))
|
2020-04-22 09:03:51 -04:00
|
|
|
|
#:set-load-path? #f)))
|
2014-06-25 16:48:25 -04:00
|
|
|
|
|
2017-09-12 16:20:08 -04:00
|
|
|
|
(define-gexp-compiler (operating-system-compiler (os <operating-system>)
|
|
|
|
|
system target)
|
|
|
|
|
((store-lift
|
|
|
|
|
(lambda (store)
|
|
|
|
|
;; XXX: This is not super elegant but we can't pass SYSTEM and TARGET to
|
|
|
|
|
;; 'operating-system-derivation'.
|
2022-06-14 02:55:03 -04:00
|
|
|
|
(parameterize ((%current-system system)
|
|
|
|
|
(%current-target-system target))
|
|
|
|
|
(run-with-store store
|
|
|
|
|
(mbegin %store-monad
|
|
|
|
|
(set-guile-for-build (default-guile))
|
|
|
|
|
(operating-system-derivation os))
|
|
|
|
|
#:system system
|
|
|
|
|
#:target target))))))
|
2017-09-12 16:20:08 -04:00
|
|
|
|
|
2013-12-09 15:32:36 -05:00
|
|
|
|
;;; system.scm ends here
|