2013-12-09 20:32:36 +00:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2021-01-21 15:05:37 +00:00
|
|
|
|
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
|
2015-02-25 04:54:29 +00:00
|
|
|
|
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
|
2016-02-11 10:52:48 +00:00
|
|
|
|
;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
|
2016-10-28 10:07:18 +00:00
|
|
|
|
;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
|
2017-04-02 13:52:29 +00:00
|
|
|
|
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
2019-01-05 13:06:47 +00:00
|
|
|
|
;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
|
2020-12-21 12:02:01 +00:00
|
|
|
|
;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
|
2020-02-18 09:42:07 +00:00
|
|
|
|
;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
|
2021-07-06 20:03:19 +00:00
|
|
|
|
;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re>
|
2020-04-29 15:17:55 +00:00
|
|
|
|
;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
|
2019-07-14 11:50:23 +00:00
|
|
|
|
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
2020-05-03 12:13:58 +00:00
|
|
|
|
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <jannek@gnu.org>
|
2020-10-09 09:47:34 +00:00
|
|
|
|
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
|
2021-01-22 19:06:55 +00:00
|
|
|
|
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
|
2021-03-22 03:23:32 +00:00
|
|
|
|
;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com>
|
2013-12-09 20:32:36 +00: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 20:22:20 +00:00
|
|
|
|
#:use-module (guix inferior)
|
2013-12-09 20:32:36 +00:00
|
|
|
|
#:use-module (guix store)
|
|
|
|
|
#:use-module (guix monads)
|
2014-04-26 14:36:48 +00:00
|
|
|
|
#:use-module (guix gexp)
|
2013-12-09 20:32:36 +00:00
|
|
|
|
#:use-module (guix records)
|
|
|
|
|
#:use-module (guix packages)
|
|
|
|
|
#:use-module (guix derivations)
|
2014-08-11 20:18:33 +00:00
|
|
|
|
#:use-module (guix profiles)
|
2020-07-24 20:58:08 +00:00
|
|
|
|
#:use-module ((guix utils) #:select (substitute-keyword-arguments))
|
|
|
|
|
#:use-module (guix i18n)
|
|
|
|
|
#:use-module (guix diagnostics)
|
2020-10-09 09:47:34 +00:00
|
|
|
|
#:use-module (gnu packages admin)
|
2013-12-09 20:32:36 +00:00
|
|
|
|
#:use-module (gnu packages base)
|
|
|
|
|
#:use-module (gnu packages bash)
|
2020-10-09 09:47:34 +00:00
|
|
|
|
#:use-module (gnu packages compression)
|
2020-05-26 15:38:30 +00:00
|
|
|
|
#:use-module (gnu packages cross-base)
|
2020-10-09 09:47:34 +00:00
|
|
|
|
#:use-module (gnu packages cryptsetup)
|
|
|
|
|
#:use-module (gnu packages disk)
|
|
|
|
|
#:use-module (gnu packages file-systems)
|
|
|
|
|
#: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 22:25:17 +00:00
|
|
|
|
#:use-module (gnu packages guile)
|
2019-04-24 10:35:06 +00:00
|
|
|
|
#:use-module (gnu packages guile-xyz)
|
2020-05-26 15:38:30 +00:00
|
|
|
|
#:use-module (gnu packages hurd)
|
2014-06-04 12:59:24 +00:00
|
|
|
|
#:use-module (gnu packages less)
|
2020-10-09 09:47:34 +00:00
|
|
|
|
#:use-module (gnu packages linux)
|
2014-12-07 21:59:46 +00:00
|
|
|
|
#:use-module (gnu packages man)
|
2020-10-09 09:47:34 +00: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 09:51:26 +00:00
|
|
|
|
#:use-module (gnu packages nvi)
|
2020-10-09 09:47:34 +00:00
|
|
|
|
#:use-module (gnu packages package-management)
|
|
|
|
|
#:use-module (gnu packages pciutils)
|
2016-02-08 22:34:50 +00:00
|
|
|
|
#:use-module (gnu packages texinfo)
|
2021-07-09 08:20:39 +00:00
|
|
|
|
#:use-module (gnu packages text-editors)
|
2021-05-07 16:17:26 +00:00
|
|
|
|
#:use-module (gnu packages wget)
|
2014-02-19 19:58:24 +00:00
|
|
|
|
#:use-module (gnu services)
|
2016-01-27 12:45:01 +00:00
|
|
|
|
#:use-module (gnu services shepherd)
|
2014-02-19 19:58:24 +00:00
|
|
|
|
#:use-module (gnu services base)
|
2017-05-15 20:24:18 +00:00
|
|
|
|
#:use-module (gnu bootloader)
|
2013-12-09 20:32:36 +00:00
|
|
|
|
#:use-module (gnu system shadow)
|
2015-02-04 20:58:15 +00:00
|
|
|
|
#:use-module (gnu system nss)
|
2014-11-26 21:49:11 +00:00
|
|
|
|
#:use-module (gnu system locale)
|
2015-11-03 17:08:47 +00:00
|
|
|
|
#:use-module (gnu system pam)
|
2014-01-29 12:04:00 +00:00
|
|
|
|
#:use-module (gnu system linux-initrd)
|
2021-07-06 20:03:19 +00:00
|
|
|
|
#:use-module (gnu system setuid)
|
2017-09-06 07:28:28 +00:00
|
|
|
|
#:use-module (gnu system uuid)
|
2014-05-20 19:59:08 +00:00
|
|
|
|
#:use-module (gnu system file-systems)
|
2016-04-17 15:53:20 +00:00
|
|
|
|
#:use-module (gnu system mapped-devices)
|
2013-12-09 20:32:36 +00:00
|
|
|
|
#:use-module (ice-9 match)
|
|
|
|
|
#:use-module (srfi srfi-1)
|
|
|
|
|
#:use-module (srfi srfi-26)
|
2014-11-26 21:49:11 +00:00
|
|
|
|
#:use-module (srfi srfi-34)
|
|
|
|
|
#:use-module (srfi srfi-35)
|
2016-11-03 13:10:28 +00:00
|
|
|
|
#:use-module (rnrs bytevectors)
|
2013-12-09 20:32:36 +00:00
|
|
|
|
#:export (operating-system
|
|
|
|
|
operating-system?
|
2019-03-29 22:22:27 +00:00
|
|
|
|
this-operating-system
|
2014-05-18 19:58:01 +00:00
|
|
|
|
|
|
|
|
|
operating-system-bootloader
|
2013-12-09 20:32:36 +00:00
|
|
|
|
operating-system-services
|
2019-03-22 16:48:37 +00:00
|
|
|
|
operating-system-essential-services
|
2019-05-10 15:45:06 +00:00
|
|
|
|
operating-system-default-essential-services
|
2014-05-09 20:58:46 +00:00
|
|
|
|
operating-system-user-services
|
2013-12-09 20:32:36 +00:00
|
|
|
|
operating-system-packages
|
2014-01-31 13:36:48 +00:00
|
|
|
|
operating-system-host-name
|
2014-09-11 20:03:24 +00:00
|
|
|
|
operating-system-hosts-file
|
2020-05-03 13:09:15 +00:00
|
|
|
|
operating-system-hurd
|
2014-01-31 13:36:48 +00:00
|
|
|
|
operating-system-kernel
|
2016-09-09 21:27:00 +00:00
|
|
|
|
operating-system-kernel-file
|
2017-04-21 12:37:08 +00:00
|
|
|
|
operating-system-kernel-arguments
|
2019-04-15 09:30:50 +00:00
|
|
|
|
operating-system-label
|
|
|
|
|
operating-system-default-label
|
2018-02-27 10:42:09 +00:00
|
|
|
|
operating-system-initrd-modules
|
2014-01-31 13:36:48 +00:00
|
|
|
|
operating-system-initrd
|
|
|
|
|
operating-system-users
|
|
|
|
|
operating-system-groups
|
2014-05-31 20:01:05 +00:00
|
|
|
|
operating-system-issue
|
2014-01-31 13:36:48 +00:00
|
|
|
|
operating-system-timezone
|
|
|
|
|
operating-system-locale
|
2014-11-26 21:49:11 +00:00
|
|
|
|
operating-system-locale-definitions
|
2015-10-30 22:05:52 +00:00
|
|
|
|
operating-system-locale-libcs
|
2014-09-11 21:39:15 +00:00
|
|
|
|
operating-system-mapped-devices
|
2014-05-02 22:26:07 +00:00
|
|
|
|
operating-system-file-systems
|
2016-01-21 21:45:54 +00:00
|
|
|
|
operating-system-store-file-system
|
2016-07-17 22:51:02 +00:00
|
|
|
|
operating-system-user-mapped-devices
|
|
|
|
|
operating-system-boot-mapped-devices
|
2020-12-21 12:02:01 +00:00
|
|
|
|
operating-system-bootloader-crypto-devices
|
2014-06-26 22:06:46 +00:00
|
|
|
|
operating-system-activation-script
|
2016-05-04 20:48:28 +00:00
|
|
|
|
operating-system-user-accounts
|
|
|
|
|
operating-system-shepherd-service-names
|
2018-01-09 08:24:00 +00:00
|
|
|
|
operating-system-user-kernel-arguments
|
2020-03-05 10:38:42 +00: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 17:32:02 +00:00
|
|
|
|
operating-system-kernel-loadable-modules
|
2020-07-14 23:31:23 +00:00
|
|
|
|
operating-system-location
|
2013-12-09 20:32:36 +00:00
|
|
|
|
|
2014-04-27 12:58:15 +00:00
|
|
|
|
operating-system-derivation
|
2014-05-02 22:26:07 +00:00
|
|
|
|
operating-system-profile
|
2017-04-02 13:52:29 +00:00
|
|
|
|
operating-system-bootcfg
|
2015-06-08 12:59:00 +00:00
|
|
|
|
operating-system-etc-directory
|
|
|
|
|
operating-system-locale-directory
|
|
|
|
|
operating-system-boot-script
|
2020-04-28 12:12:34 +00:00
|
|
|
|
operating-system-uuid
|
2015-06-08 12:59:00 +00:00
|
|
|
|
|
2017-02-14 15:28:31 +00:00
|
|
|
|
system-linux-image-file-name
|
2019-05-10 20:29:10 +00:00
|
|
|
|
operating-system-with-gc-roots
|
2019-11-30 17:05:07 +00:00
|
|
|
|
operating-system-with-provenance
|
2017-02-14 15:28:31 +00:00
|
|
|
|
|
2020-05-03 12:13:58 +00:00
|
|
|
|
hurd-default-essential-services
|
|
|
|
|
|
2016-01-07 23:48:17 +00:00
|
|
|
|
boot-parameters
|
|
|
|
|
boot-parameters?
|
|
|
|
|
boot-parameters-label
|
|
|
|
|
boot-parameters-root-device
|
2017-06-10 08:47:25 +00:00
|
|
|
|
boot-parameters-bootloader-name
|
2019-08-28 21:27:20 +00:00
|
|
|
|
boot-parameters-bootloader-menu-entries
|
2020-12-21 12:02:01 +00:00
|
|
|
|
boot-parameters-store-crypto-devices
|
2016-10-28 10:07:18 +00:00
|
|
|
|
boot-parameters-store-device
|
2020-10-24 16:15:53 +00:00
|
|
|
|
boot-parameters-store-directory-prefix
|
2016-10-28 10:07:18 +00:00
|
|
|
|
boot-parameters-store-mount-point
|
2019-10-21 10:23:40 +00:00
|
|
|
|
boot-parameters-locale
|
2016-01-07 23:48:17 +00:00
|
|
|
|
boot-parameters-kernel
|
|
|
|
|
boot-parameters-kernel-arguments
|
2016-09-24 08:39:00 +00:00
|
|
|
|
boot-parameters-initrd
|
2020-05-26 15:38:30 +00:00
|
|
|
|
boot-parameters-multiboot-modules
|
2017-05-08 19:03:37 +00:00
|
|
|
|
read-boot-parameters
|
2017-04-21 12:37:09 +00:00
|
|
|
|
read-boot-parameters-file
|
2017-06-29 10:42:59 +00:00
|
|
|
|
boot-parameters->menu-entry
|
2016-01-07 23:48:17 +00:00
|
|
|
|
|
2014-10-07 19:17:22 +00:00
|
|
|
|
local-host-aliases
|
2018-11-16 11:43:55 +00:00
|
|
|
|
%root-account
|
2014-09-09 15:12:33 +00:00
|
|
|
|
%setuid-programs
|
2020-03-18 02:10:40 +00:00
|
|
|
|
%sudoers-specification
|
2014-09-11 21:39:15 +00:00
|
|
|
|
%base-packages
|
2021-09-28 10:18:40 +00:00
|
|
|
|
%base-packages-artwork
|
2020-04-04 07:59:48 +00:00
|
|
|
|
%base-packages-interactive
|
|
|
|
|
%base-packages-linux
|
|
|
|
|
%base-packages-networking
|
2020-10-09 09:47:34 +00:00
|
|
|
|
%base-packages-disk-utilities
|
2020-04-04 07:59:48 +00:00
|
|
|
|
%base-packages-utils
|
2020-04-29 15:17:55 +00:00
|
|
|
|
%base-firmware
|
|
|
|
|
%default-kernel-arguments))
|
2013-12-09 20:32:36 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;;
|
|
|
|
|
;;; This module supports whole-system configuration.
|
|
|
|
|
;;;
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2018-11-15 13:36:16 +00:00
|
|
|
|
(define (bootable-kernel-arguments system root-device)
|
|
|
|
|
"Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE."
|
|
|
|
|
(list (string-append "--root="
|
2020-02-12 04:56:45 +00:00
|
|
|
|
;; Note: Always use the DCE format because that's what
|
|
|
|
|
;; (gnu build linux-boot) expects for the '--root'
|
|
|
|
|
;; kernel command-line option.
|
|
|
|
|
(file-system-device->string root-device
|
|
|
|
|
#:uuid-type 'dce))
|
2018-11-15 13:36:16 +00:00
|
|
|
|
#~(string-append "--system=" #$system)
|
|
|
|
|
#~(string-append "--load=" #$system "/boot")))
|
2017-04-21 12:37:08 +00:00
|
|
|
|
|
2013-12-09 20:32:36 +00:00
|
|
|
|
;; System-wide configuration.
|
|
|
|
|
;; TODO: Add per-field docstrings/stexi.
|
|
|
|
|
(define-record-type* <operating-system> operating-system
|
|
|
|
|
make-operating-system
|
|
|
|
|
operating-system?
|
2019-03-29 22:22:27 +00:00
|
|
|
|
this-operating-system
|
|
|
|
|
|
2013-12-09 20:32:36 +00:00
|
|
|
|
(kernel operating-system-kernel ; package
|
2015-08-04 14:38:06 +00:00
|
|
|
|
(default linux-libre))
|
2020-02-18 09:42:07 +00:00
|
|
|
|
(kernel-loadable-modules operating-system-kernel-loadable-modules
|
|
|
|
|
(default '())) ; list of packages
|
2017-04-21 02:21:20 +00:00
|
|
|
|
(kernel-arguments operating-system-user-kernel-arguments
|
2020-04-29 15:17:55 +00:00
|
|
|
|
(default %default-kernel-arguments)) ; list of gexps/strings
|
2020-05-03 13:09:15 +00:00
|
|
|
|
(hurd operating-system-hurd
|
|
|
|
|
(default #f)) ; package
|
2017-05-15 20:24:18 +00:00
|
|
|
|
(bootloader operating-system-bootloader) ; <bootloader-configuration>
|
2019-04-15 09:30:50 +00:00
|
|
|
|
(label operating-system-label ; string
|
|
|
|
|
(thunked)
|
|
|
|
|
(default (operating-system-default-label this-operating-system)))
|
2014-05-18 19:58:01 +00:00
|
|
|
|
|
2019-03-20 11:19:14 +00:00
|
|
|
|
(keyboard-layout operating-system-keyboard-layout ;#f | <keyboard-layout>
|
|
|
|
|
(default #f))
|
2018-11-15 17:39:18 +00:00
|
|
|
|
(initrd operating-system-initrd ; (list fs) -> file-like
|
2014-06-30 18:56:45 +00:00
|
|
|
|
(default base-initrd))
|
2018-02-27 10:42:09 +00:00
|
|
|
|
(initrd-modules operating-system-initrd-modules ; list of strings
|
|
|
|
|
(thunked) ; it's system-dependent
|
|
|
|
|
(default %base-initrd-modules))
|
|
|
|
|
|
2014-11-11 21:42:15 +00:00
|
|
|
|
(firmware operating-system-firmware ; list of packages
|
|
|
|
|
(default %base-firmware))
|
2013-12-09 20:32:36 +00:00
|
|
|
|
|
|
|
|
|
(host-name operating-system-host-name) ; string
|
2015-06-05 20:41:55 +00:00
|
|
|
|
(hosts-file operating-system-hosts-file ; file-like | #f
|
2014-09-11 20:03:24 +00:00
|
|
|
|
(default #f))
|
2013-12-09 20:32:36 +00:00
|
|
|
|
|
2014-09-11 21:39:15 +00:00
|
|
|
|
(mapped-devices operating-system-mapped-devices ; list of <mapped-device>
|
|
|
|
|
(default '()))
|
2014-06-26 22:11:38 +00:00
|
|
|
|
(file-systems operating-system-file-systems) ; list of fs
|
2021-11-15 20:26:27 +00:00
|
|
|
|
(swap-devices operating-system-swap-devices ; list of string | <swap-space>
|
|
|
|
|
(default '())
|
2021-11-15 20:26:28 +00:00
|
|
|
|
(delayed)
|
|
|
|
|
(sanitize warn-swap-devices-change))
|
2013-12-09 20:32:36 +00:00
|
|
|
|
|
|
|
|
|
(users operating-system-users ; list of user accounts
|
2015-05-25 14:54:05 +00:00
|
|
|
|
(default %base-user-accounts))
|
2013-12-09 20:32:36 +00:00
|
|
|
|
(groups operating-system-groups ; list of user groups
|
2014-06-22 20:16:14 +00:00
|
|
|
|
(default %base-groups))
|
2013-12-09 20:32:36 +00:00
|
|
|
|
|
2019-03-22 12:53:47 +00:00
|
|
|
|
(skeletons operating-system-skeletons ; list of name/file-like value
|
2014-05-12 21:37:13 +00:00
|
|
|
|
(default (default-skeletons)))
|
2014-05-31 20:01:05 +00:00
|
|
|
|
(issue operating-system-issue ; string
|
|
|
|
|
(default %default-issue))
|
2014-05-12 21:37:13 +00:00
|
|
|
|
|
2013-12-09 20:32:36 +00:00
|
|
|
|
(packages operating-system-packages ; list of (PACKAGE OUTPUT...)
|
2014-06-04 12:59:24 +00:00
|
|
|
|
(default %base-packages)) ; or just PACKAGE
|
2013-12-09 20:32:36 +00:00
|
|
|
|
|
|
|
|
|
(timezone operating-system-timezone) ; string
|
2014-06-26 22:11:38 +00:00
|
|
|
|
(locale operating-system-locale ; string
|
2014-11-26 21:49:11 +00:00
|
|
|
|
(default "en_US.utf8"))
|
|
|
|
|
(locale-definitions operating-system-locale-definitions ; list of <locale-definition>
|
|
|
|
|
(default %default-locale-definitions))
|
2015-10-30 22:05:52 +00:00
|
|
|
|
(locale-libcs operating-system-locale-libcs ; list of <packages>
|
|
|
|
|
(default %default-locale-libcs))
|
2015-02-04 20:58:15 +00:00
|
|
|
|
(name-service-switch operating-system-name-service-switch ; <name-service-switch>
|
|
|
|
|
(default %default-nss))
|
2013-12-09 20:32:36 +00:00
|
|
|
|
|
2019-03-22 16:48:37 +00:00
|
|
|
|
(essential-services operating-system-essential-services ; list of services
|
|
|
|
|
(thunked)
|
2019-05-10 15:45:06 +00:00
|
|
|
|
(default (operating-system-default-essential-services
|
|
|
|
|
this-operating-system)))
|
2019-03-22 12:53:47 +00:00
|
|
|
|
(services operating-system-user-services ; list of services
|
2021-12-08 14:27:06 +00:00
|
|
|
|
(thunked) ;allow for system-dependent services
|
2014-04-30 20:17:56 +00:00
|
|
|
|
(default %base-services))
|
|
|
|
|
|
|
|
|
|
(pam-services operating-system-pam-services ; list of PAM services
|
|
|
|
|
(default (base-pam-services)))
|
2021-08-12 09:58:47 +00:00
|
|
|
|
(setuid-programs operating-system-setuid-programs
|
|
|
|
|
(default %setuid-programs) ; list of <setuid-program>
|
|
|
|
|
(sanitize ensure-setuid-program-list))
|
2013-12-09 20:32:36 +00:00
|
|
|
|
|
2015-06-15 10:18:20 +00:00
|
|
|
|
(sudoers-file operating-system-sudoers-file ; file-like
|
2020-07-14 23:31:23 +00:00
|
|
|
|
(default %sudoers-specification))
|
|
|
|
|
|
|
|
|
|
(location operating-system-location ; <location>
|
|
|
|
|
(default (and=> (current-source-location)
|
|
|
|
|
source-properties->location))
|
|
|
|
|
(innate)))
|
2013-12-09 20:32:36 +00:00
|
|
|
|
|
2018-11-15 13:36:16 +00:00
|
|
|
|
(define (operating-system-kernel-arguments os root-device)
|
2017-04-21 12:37:08 +00:00
|
|
|
|
"Return all the kernel arguments, including the ones not specified
|
|
|
|
|
directly by the user."
|
2018-11-15 13:36:16 +00:00
|
|
|
|
(append (bootable-kernel-arguments os root-device)
|
|
|
|
|
(operating-system-user-kernel-arguments os)))
|
2017-04-21 12:37:08 +00:00
|
|
|
|
|
2014-05-12 21:37:13 +00:00
|
|
|
|
|
|
|
|
|
;;;
|
2017-05-07 09:30:24 +00:00
|
|
|
|
;;; Boot parameters
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define-record-type* <boot-parameters>
|
|
|
|
|
boot-parameters make-boot-parameters boot-parameters?
|
|
|
|
|
(label boot-parameters-label)
|
|
|
|
|
;; Because we will use the 'store-device' to create the GRUB search command,
|
|
|
|
|
;; the 'store-device' has slightly different semantics than 'root-device'.
|
|
|
|
|
;; The 'store-device' can be a file system uuid, a file system label, or #f,
|
2020-11-02 17:22:33 +00: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 09:30:24 +00:00
|
|
|
|
;; exactly to the device field of the <file-system> object representing the
|
2020-11-02 17:22:33 +00: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 16:15:53 +00:00
|
|
|
|
;; partition.
|
2017-05-07 09:30:24 +00:00
|
|
|
|
(root-device boot-parameters-root-device)
|
2017-06-10 08:47:25 +00:00
|
|
|
|
(bootloader-name boot-parameters-bootloader-name)
|
2019-08-28 21:27:20 +00:00
|
|
|
|
(bootloader-menu-entries ;list of <menu-entry>
|
|
|
|
|
boot-parameters-bootloader-menu-entries)
|
2017-05-07 09:30:24 +00:00
|
|
|
|
(store-device boot-parameters-store-device)
|
|
|
|
|
(store-mount-point boot-parameters-store-mount-point)
|
2020-10-24 16:15:53 +00:00
|
|
|
|
(store-directory-prefix boot-parameters-store-directory-prefix)
|
2020-12-21 12:02:01 +00:00
|
|
|
|
(store-crypto-devices boot-parameters-store-crypto-devices
|
|
|
|
|
(default '()))
|
2019-10-21 10:23:40 +00:00
|
|
|
|
(locale boot-parameters-locale)
|
2017-05-07 09:30:24 +00:00
|
|
|
|
(kernel boot-parameters-kernel)
|
|
|
|
|
(kernel-arguments boot-parameters-kernel-arguments)
|
2020-05-26 15:38:30 +00:00
|
|
|
|
(initrd boot-parameters-initrd)
|
|
|
|
|
(multiboot-modules boot-parameters-multiboot-modules))
|
2017-05-07 09:30:24 +00:00
|
|
|
|
|
2017-10-06 21:09:48 +00: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 09:30:24 +00:00
|
|
|
|
(define (read-boot-parameters port)
|
|
|
|
|
"Read boot parameters from PORT and return the corresponding
|
|
|
|
|
<boot-parameters> object or #f if the format is unrecognized."
|
2017-09-06 08:22:58 +00:00
|
|
|
|
(define device-sexp->device
|
|
|
|
|
(match-lambda
|
|
|
|
|
(('uuid (? symbol? type) (? bytevector? bv))
|
|
|
|
|
(bytevector->uuid bv type))
|
2018-05-18 11:43:07 +00:00
|
|
|
|
(('file-system-label (? string? label))
|
|
|
|
|
(file-system-label label))
|
2017-09-06 08:22:58 +00:00
|
|
|
|
((? bytevector? bv) ;old format
|
|
|
|
|
(bytevector->uuid bv 'dce))
|
|
|
|
|
((? string? device)
|
2020-09-07 08:04:19 +00: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 12:02:01 +00: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 08:22:58 +00:00
|
|
|
|
|
2017-05-07 09:30:24 +00:00
|
|
|
|
(match (read port)
|
|
|
|
|
(('boot-parameters ('version 0)
|
|
|
|
|
('label label) ('root-device root)
|
2020-05-26 15:38:30 +00:00
|
|
|
|
('kernel kernel)
|
2017-05-07 09:30:24 +00:00
|
|
|
|
rest ...)
|
|
|
|
|
(boot-parameters
|
|
|
|
|
(label label)
|
2017-09-11 21:00:40 +00:00
|
|
|
|
(root-device (device-sexp->device root))
|
2017-05-07 09:30:24 +00:00
|
|
|
|
|
2017-06-10 08:47:25 +00:00
|
|
|
|
(bootloader-name
|
|
|
|
|
(match (assq 'bootloader-name rest)
|
2017-04-02 13:10:52 +00:00
|
|
|
|
((_ args) args)
|
|
|
|
|
(#f 'grub))) ; for compatibility reasons.
|
|
|
|
|
|
2019-08-28 21:27:20 +00:00
|
|
|
|
(bootloader-menu-entries
|
|
|
|
|
(match (assq 'bootloader-menu-entries rest)
|
|
|
|
|
((_ entries) (map sexp->menu-entry entries))
|
|
|
|
|
(#f '())))
|
|
|
|
|
|
2020-05-26 15:38:30 +00: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 09:30:24 +00:00
|
|
|
|
(system-linux-image-file-name))
|
2020-05-26 15:38:30 +00:00
|
|
|
|
kernel))
|
2017-05-07 09:30:24 +00: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 13:24:45 +00:00
|
|
|
|
file)
|
|
|
|
|
(#f #f)))
|
2017-05-07 09:30:24 +00:00
|
|
|
|
|
2020-06-29 13:24:45 +00:00
|
|
|
|
(multiboot-modules
|
|
|
|
|
(match (assq 'multiboot-modules rest)
|
|
|
|
|
((_ args) args)
|
|
|
|
|
(#f '())))
|
2020-05-26 15:38:30 +00:00
|
|
|
|
|
2019-10-21 10:23:40 +00:00
|
|
|
|
(locale
|
|
|
|
|
(match (assq 'locale rest)
|
|
|
|
|
((_ locale) locale)
|
|
|
|
|
(#f #f)))
|
|
|
|
|
|
2017-05-07 09:30:24 +00:00
|
|
|
|
(store-device
|
2017-09-21 20:30:59 +00: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 09:30:24 +00:00
|
|
|
|
|
2020-10-24 16:15:53 +00: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 12:02:01 +00: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 09:30:24 +00:00
|
|
|
|
(store-mount-point
|
|
|
|
|
(match (assq 'store rest)
|
|
|
|
|
(('store ('device _) ('mount-point mount-point) _ ...)
|
|
|
|
|
mount-point)
|
|
|
|
|
(_ ;the old format
|
|
|
|
|
"/")))))
|
|
|
|
|
(x ;unsupported format
|
2018-05-31 15:31:19 +00:00
|
|
|
|
(warning (G_ "unrecognized boot parameters at '~a'~%")
|
|
|
|
|
(port-filename port))
|
2017-05-07 09:30:24 +00:00
|
|
|
|
#f)))
|
|
|
|
|
|
|
|
|
|
(define (read-boot-parameters-file system)
|
|
|
|
|
"Read boot parameters from SYSTEM's (system or generation) \"parameters\"
|
|
|
|
|
file and returns the corresponding <boot-parameters> object or #f if the
|
|
|
|
|
format is unrecognized.
|
|
|
|
|
The object has its kernel-arguments extended in order to make it bootable."
|
|
|
|
|
(let* ((file (string-append system "/parameters"))
|
|
|
|
|
(params (call-with-input-file file read-boot-parameters))
|
2018-11-15 13:36:16 +00:00
|
|
|
|
(root (boot-parameters-root-device params)))
|
|
|
|
|
(boot-parameters
|
|
|
|
|
(inherit params)
|
|
|
|
|
(kernel-arguments (append (bootable-kernel-arguments system root)
|
|
|
|
|
(boot-parameters-kernel-arguments params))))))
|
2017-05-29 12:24:20 +00:00
|
|
|
|
|
2017-06-29 10:42:59 +00:00
|
|
|
|
(define (boot-parameters->menu-entry conf)
|
2020-05-26 15:38:30 +00: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-09 01:12:24 +00:00
|
|
|
|
(linux-arguments (if (not multiboot?)
|
2020-05-26 15:38:30 +00: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 12:24:20 +00:00
|
|
|
|
|
2017-05-07 09:30:24 +00:00
|
|
|
|
|
|
|
|
|
;;;
|
2014-05-12 21:37:13 +00:00
|
|
|
|
;;; Services.
|
|
|
|
|
;;;
|
|
|
|
|
|
2016-08-21 16:50:14 +00: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 21:33:52 +00:00
|
|
|
|
(define file-systems
|
2014-11-25 15:01:21 +00:00
|
|
|
|
(remove file-system-needed-for-boot?
|
2014-05-10 21:33:52 +00:00
|
|
|
|
(operating-system-file-systems os)))
|
|
|
|
|
|
2018-06-21 21:50:47 +00:00
|
|
|
|
(define mapped-devices-for-boot
|
|
|
|
|
(operating-system-boot-mapped-devices os))
|
|
|
|
|
|
2014-09-11 21:39:15 +00:00
|
|
|
|
(define (device-mappings fs)
|
2015-12-21 23:29:43 +00:00
|
|
|
|
(let ((device (file-system-device fs)))
|
2016-01-01 21:29:33 +00:00
|
|
|
|
(if (string? device) ;title is 'device
|
2015-12-21 23:29:43 +00:00
|
|
|
|
(filter (lambda (md)
|
2020-11-06 09:47:37 +00:00
|
|
|
|
(any (cut string=? device <>)
|
|
|
|
|
(map (cut string-append "/dev/mapper" <>)
|
|
|
|
|
(mapped-device-targets md))))
|
2015-12-21 23:29:43 +00:00
|
|
|
|
(operating-system-mapped-devices os))
|
|
|
|
|
'())))
|
2014-09-11 21:39:15 +00:00
|
|
|
|
|
2015-10-29 17:22:19 +00:00
|
|
|
|
(define (add-dependencies fs)
|
|
|
|
|
;; Add the dependencies due to device mappings to FS.
|
|
|
|
|
(file-system
|
|
|
|
|
(inherit fs)
|
|
|
|
|
(dependencies
|
2018-06-21 21:50:47 +00:00
|
|
|
|
(delete-duplicates
|
|
|
|
|
(remove (cut member <> mapped-devices-for-boot)
|
|
|
|
|
(append (device-mappings fs)
|
|
|
|
|
(file-system-dependencies fs)))
|
|
|
|
|
eq?))))
|
2015-10-29 17:22:19 +00:00
|
|
|
|
|
2016-08-21 16:50:14 +00:00
|
|
|
|
(service file-system-service-type
|
|
|
|
|
(map add-dependencies file-systems)))
|
2014-05-10 21:33:52 +00:00
|
|
|
|
|
2018-06-21 21:50:47 +00:00
|
|
|
|
(define (mapped-device-users device file-systems)
|
|
|
|
|
"Return the subset of FILE-SYSTEMS that use DEVICE."
|
2020-11-06 09:47:37 +00:00
|
|
|
|
(let ((targets (map (cut string-append "/dev/mapper/" <>)
|
|
|
|
|
(mapped-device-targets device))))
|
2018-06-21 21:50:47 +00:00
|
|
|
|
(filter (lambda (fs)
|
|
|
|
|
(or (member device (file-system-dependencies fs))
|
|
|
|
|
(and (string? (file-system-device fs))
|
2020-11-06 09:47:37 +00:00
|
|
|
|
(any (cut string=? (file-system-device fs) <>) targets))))
|
2018-06-21 21:50:47 +00:00
|
|
|
|
file-systems)))
|
2014-09-22 09:06:42 +00: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 16:50:07 +00:00
|
|
|
|
(let ((devices (operating-system-mapped-devices os))
|
|
|
|
|
(file-systems (operating-system-file-systems os)))
|
|
|
|
|
(filter (lambda (md)
|
2018-06-21 21:50:47 +00:00
|
|
|
|
(let ((users (mapped-device-users md file-systems)))
|
|
|
|
|
(not (any file-system-needed-for-boot? users))))
|
2014-11-30 16:50:07 +00:00
|
|
|
|
devices)))
|
2014-09-22 09:06:42 +00: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 16:50:07 +00:00
|
|
|
|
(let ((devices (operating-system-mapped-devices os))
|
|
|
|
|
(file-systems (operating-system-file-systems os)))
|
|
|
|
|
(filter (lambda (md)
|
2018-06-21 21:50:47 +00:00
|
|
|
|
(let ((users (mapped-device-users md file-systems)))
|
|
|
|
|
(any file-system-needed-for-boot? users)))
|
2014-11-30 16:50:07 +00:00
|
|
|
|
devices)))
|
2014-09-22 09:06:42 +00:00
|
|
|
|
|
2020-12-21 12:02:01 +00:00
|
|
|
|
(define (operating-system-bootloader-crypto-devices os)
|
|
|
|
|
"Return the subset of mapped devices that the bootloader must open.
|
|
|
|
|
Only devices specified by uuid are supported."
|
|
|
|
|
(define (valid-crypto-device? dev)
|
|
|
|
|
(or (uuid? dev)
|
|
|
|
|
(begin
|
|
|
|
|
(warning (G_ "\
|
|
|
|
|
mapped-device '~a' may not be mounted by the bootloader.~%")
|
|
|
|
|
dev)
|
|
|
|
|
#f)))
|
|
|
|
|
(filter-map (match-lambda
|
|
|
|
|
((and (= mapped-device-type type)
|
|
|
|
|
(= mapped-device-source source))
|
|
|
|
|
(and (eq? luks-device-mapping type)
|
|
|
|
|
(valid-crypto-device? source)
|
|
|
|
|
source))
|
|
|
|
|
(_ #f))
|
|
|
|
|
;; XXX: Ordering is important, we trust the returned one.
|
|
|
|
|
(operating-system-boot-mapped-devices os)))
|
|
|
|
|
|
2014-09-11 21:39:15 +00: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 07:17:31 +00:00
|
|
|
|
"Return the list of device-mapping services for OS as a list."
|
2016-04-17 16:26:50 +00: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 07:17:31 +00:00
|
|
|
|
(operating-system-user-mapped-devices os)))
|
2014-09-11 21:39:15 +00:00
|
|
|
|
|
2021-11-15 20:26:28 +00: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 20:51:48 +00: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 07:17:31 +00:00
|
|
|
|
"Return the list of swap services for OS."
|
2021-11-15 20:26:30 +00: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 20:51:48 +00:00
|
|
|
|
|
2020-05-27 15:40:14 +00: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")
|
|
|
|
|
(else "bzImage")))
|
2016-09-09 21:27:00 +00:00
|
|
|
|
|
|
|
|
|
(define (operating-system-kernel-file os)
|
|
|
|
|
"Return an object representing the absolute file name of the kernel image of
|
|
|
|
|
OS."
|
2020-05-26 15:38:30 +00: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 21:27:00 +00:00
|
|
|
|
|
2020-04-29 15:17:55 +00:00
|
|
|
|
(define %default-modprobe-blacklist
|
|
|
|
|
;; List of kernel modules to blacklist by default.
|
2020-05-01 09:08:07 +00: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 15:17:55 +00: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 16:48:37 +00:00
|
|
|
|
(define* (operating-system-directory-base-entries os)
|
2015-11-02 17:44:17 +00: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 13:51:26 +00:00
|
|
|
|
(let* ((locale (operating-system-locale-directory os))
|
|
|
|
|
(kernel (operating-system-kernel os))
|
2020-06-28 16:51:25 +00:00
|
|
|
|
(hurd (operating-system-hurd os))
|
|
|
|
|
(initrd (and (not hurd) (operating-system-initrd-file os)))
|
2020-04-22 13:51:26 +00:00
|
|
|
|
(params (operating-system-boot-parameters-file os)))
|
2021-03-22 03:23:32 +00:00
|
|
|
|
`(,@(if hurd
|
|
|
|
|
`(("hurd" ,hurd)
|
|
|
|
|
("kernel" ,kernel))
|
|
|
|
|
'())
|
2020-04-22 14:22:33 +00:00
|
|
|
|
("parameters" ,params)
|
2020-06-28 16:51:25 +00:00
|
|
|
|
,@(if initrd `(("initrd" ,initrd)) '())
|
2020-04-22 14:22:33 +00:00
|
|
|
|
("locale" ,locale)))) ;used by libc
|
2019-03-22 16:48:37 +00:00
|
|
|
|
|
2019-05-10 15:45:06 +00:00
|
|
|
|
(define (operating-system-default-essential-services os)
|
2014-05-09 20:58:46 +00: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 16:48:37 +00:00
|
|
|
|
bookkeeping."
|
2014-11-10 21:25:39 +00:00
|
|
|
|
(define known-fs
|
|
|
|
|
(map file-system-mount-point (operating-system-file-systems os)))
|
|
|
|
|
|
system: Make service procedures non-monadic.
* gnu/services/avahi.scm (configuration-file): Use 'plain-file' instead
of 'text-file'.
(avahi-service): Turn into a regular procedure that returns a <service>.
* gnu/services/base.scm (root-file-system-service, file-system-service,
user-unmount-service, user-processes-service, host-name-service,
console-keymap-service, console-font-service, mingetty-service,
nscd.conf-file, nscd-service): Likewise.
(%default-syslog.conf): New variable.
(syslog-service): Use it. Turn into a regular procedure.
(guix-service, udev-rules-union, kvm-udev-rule, udev-service,
device-mapping-service, swap-service): Likewise.
* gnu/services/databases.scm (%default-postgres-hba,
%default-postgres-ident): Use 'plain-file' instead of 'text-file'.
(%default-postgres-config): Use 'mixed-text-file' instead of
'text-file*'.
(postgresql-service): Use 'program-file' instead of 'gexp->script'.
Turn into a regular procedure.
* gnu/services/desktop.scm (dbus-configuration-directory): Use
'computed-file' instead of 'gexp->derivation'.
(upower-configuration-file, geoclue-configuration-file,
elogind-configuration-file): Use 'plain-file' instead of 'text-file'.
(dbus-service, upower-service, colord-service, geoclue-service,
polkit-service, elogind-service): Turn into regular procedures.
(%desktop-services): Remove use of 'mlet' when iterating on
%BASE-SERVICES.
* gnu/services/lirc.scm (lirc-service): Turn into a regular procedure.
* gnu/services/networking.scm (static-networking-service,
dhcp-client-service, ntp-service, tor-service, bitlbee-service,
wicd-service): Likewise.
* gnu/services/ssh.scm (lsh-service): Likewise.
* gnu/services/web.scm (nginx-service): Likewise.
* gnu/services/xorg.scm (xorg-configuration-file): Use 'mixed-text-file'
instead of 'text-file*'.
(xorg-start-command, slim-service): Turn into regular procedures.
(xinitrc): Use 'program-file' instead of 'gexp->script'.
* gnu/system/install.scm (cow-store-service,
configuration-template-service): Turn into regular procedures.
* gnu/system.scm (other-file-system-services, device-mapping-services,
swap-services, essential-services, operating-system-services,
user-shells, operating-system-accounts): Remove now unnecessary
'mlet' and turn into regular procedures.
(operating-system-etc-directory, operating-system-activation-script,
operating-system-boot-script): Adjust accordingly.
* doc/guix.texi (Base Services, Networking Services, X Window, Desktop
Services, Database Services, Web Services, Various Services, Name
Service Switch): Adjust accordingly.
2015-09-09 07:17:31 +00:00
|
|
|
|
(let* ((mappings (device-mapping-services os))
|
|
|
|
|
(root-fs (root-file-system-service))
|
2016-08-21 16:50:14 +00:00
|
|
|
|
(other-fs (non-boot-file-system-service os))
|
system: Make service procedures non-monadic.
* gnu/services/avahi.scm (configuration-file): Use 'plain-file' instead
of 'text-file'.
(avahi-service): Turn into a regular procedure that returns a <service>.
* gnu/services/base.scm (root-file-system-service, file-system-service,
user-unmount-service, user-processes-service, host-name-service,
console-keymap-service, console-font-service, mingetty-service,
nscd.conf-file, nscd-service): Likewise.
(%default-syslog.conf): New variable.
(syslog-service): Use it. Turn into a regular procedure.
(guix-service, udev-rules-union, kvm-udev-rule, udev-service,
device-mapping-service, swap-service): Likewise.
* gnu/services/databases.scm (%default-postgres-hba,
%default-postgres-ident): Use 'plain-file' instead of 'text-file'.
(%default-postgres-config): Use 'mixed-text-file' instead of
'text-file*'.
(postgresql-service): Use 'program-file' instead of 'gexp->script'.
Turn into a regular procedure.
* gnu/services/desktop.scm (dbus-configuration-directory): Use
'computed-file' instead of 'gexp->derivation'.
(upower-configuration-file, geoclue-configuration-file,
elogind-configuration-file): Use 'plain-file' instead of 'text-file'.
(dbus-service, upower-service, colord-service, geoclue-service,
polkit-service, elogind-service): Turn into regular procedures.
(%desktop-services): Remove use of 'mlet' when iterating on
%BASE-SERVICES.
* gnu/services/lirc.scm (lirc-service): Turn into a regular procedure.
* gnu/services/networking.scm (static-networking-service,
dhcp-client-service, ntp-service, tor-service, bitlbee-service,
wicd-service): Likewise.
* gnu/services/ssh.scm (lsh-service): Likewise.
* gnu/services/web.scm (nginx-service): Likewise.
* gnu/services/xorg.scm (xorg-configuration-file): Use 'mixed-text-file'
instead of 'text-file*'.
(xorg-start-command, slim-service): Turn into regular procedures.
(xinitrc): Use 'program-file' instead of 'gexp->script'.
* gnu/system/install.scm (cow-store-service,
configuration-template-service): Turn into regular procedures.
* gnu/system.scm (other-file-system-services, device-mapping-services,
swap-services, essential-services, operating-system-services,
user-shells, operating-system-accounts): Remove now unnecessary
'mlet' and turn into regular procedures.
(operating-system-etc-directory, operating-system-activation-script,
operating-system-boot-script): Adjust accordingly.
* doc/guix.texi (Base Services, Networking Services, X Window, Desktop
Services, Database Services, Web Services, Various Services, Name
Service Switch): Adjust accordingly.
2015-09-09 07:17:31 +00:00
|
|
|
|
(swaps (swap-services os))
|
2017-12-20 10:05:11 +00:00
|
|
|
|
(procs (service user-processes-service-type))
|
2015-11-02 17:44:17 +00:00
|
|
|
|
(host-name (host-name-service (operating-system-host-name os)))
|
2019-03-22 16:48:37 +00:00
|
|
|
|
(entries (operating-system-directory-base-entries os)))
|
2015-11-02 17:44:17 +00:00
|
|
|
|
(cons* (service system-service-type entries)
|
2021-03-22 03:23:32 +00:00
|
|
|
|
(service linux-builder-service-type
|
|
|
|
|
(linux-builder-configuration
|
|
|
|
|
(kernel (operating-system-kernel os))
|
|
|
|
|
(modules (operating-system-kernel-loadable-modules os))))
|
2015-11-02 17:44:17 +00: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 21:44:26 +00:00
|
|
|
|
|
2018-06-20 07:44:27 +00: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 20:02:31 +00:00
|
|
|
|
;; execs shepherd comes last in the boot script (XXX). Likewise,
|
2018-06-20 07:44:27 +00: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 20:02:31 +00:00
|
|
|
|
;; activation code.
|
2016-01-04 21:58:05 +00:00
|
|
|
|
(service cleanup-service-type #f)
|
2018-06-20 07:44:27 +00: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 21:44:26 +00: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)
|
2019-04-26 21:53:53 +00:00
|
|
|
|
(service fstab-service-type
|
|
|
|
|
(filter file-system-needed-for-boot?
|
|
|
|
|
(operating-system-file-systems os)))
|
2015-12-02 13:14:02 +00:00
|
|
|
|
(session-environment-service
|
|
|
|
|
(operating-system-environment-variables os))
|
2018-03-07 09:00:07 +00:00
|
|
|
|
host-name 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 21:44:26 +00:00
|
|
|
|
(service setuid-program-service-type
|
2021-08-12 09:58:47 +00:00
|
|
|
|
(operating-system-setuid-programs os))
|
2015-11-02 20:52:28 +00:00
|
|
|
|
(service profile-service-type
|
|
|
|
|
(operating-system-packages os))
|
2016-08-21 16:50:14 +00:00
|
|
|
|
other-fs
|
|
|
|
|
(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 21:44:26 +00:00
|
|
|
|
|
2019-03-22 16:48:37 +00:00
|
|
|
|
;; Add the firmware service.
|
|
|
|
|
(list %linux-bare-metal-service
|
|
|
|
|
(service firmware-service-type
|
|
|
|
|
(operating-system-firmware os)))))))
|
|
|
|
|
|
2020-05-03 12:13:58 +00:00
|
|
|
|
(define (hurd-default-essential-services os)
|
2020-06-28 16:51:25 +00:00
|
|
|
|
(let ((entries (operating-system-directory-base-entries os)))
|
|
|
|
|
(list (service system-service-type entries)
|
|
|
|
|
%boot-service
|
|
|
|
|
%hurd-startup-service
|
|
|
|
|
%activation-service
|
|
|
|
|
%shepherd-root-service
|
|
|
|
|
(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)
|
2020-10-09 20:55:46 +00:00
|
|
|
|
(service setuid-program-service-type
|
2021-08-12 09:58:47 +00:00
|
|
|
|
(operating-system-setuid-programs os))
|
2020-06-28 16:51:25 +00:00
|
|
|
|
(service profile-service-type (operating-system-packages os)))))
|
2020-05-03 12:13:58 +00:00
|
|
|
|
|
2019-03-22 16:48:37 +00:00
|
|
|
|
(define* (operating-system-services os)
|
|
|
|
|
"Return all the services of OS, including \"essential\" services."
|
2018-01-20 23:05:09 +00:00
|
|
|
|
(instantiate-missing-services
|
|
|
|
|
(append (operating-system-user-services os)
|
2019-03-22 16:48:37 +00:00
|
|
|
|
(operating-system-essential-services os))))
|
2014-05-09 20:58:46 +00:00
|
|
|
|
|
2019-05-10 20:29:10 +00: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 20:36:20 +00: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 17:05:07 +00: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 21:37:13 +00:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; /etc.
|
|
|
|
|
;;;
|
|
|
|
|
|
2014-11-11 21:42:15 +00:00
|
|
|
|
(define %base-firmware
|
|
|
|
|
;; Firmware usable by default.
|
2016-11-19 19:25:02 +00:00
|
|
|
|
(list ath9k-htc-firmware
|
|
|
|
|
openfwwf-firmware))
|
2014-11-11 21:42:15 +00:00
|
|
|
|
|
2021-09-28 10:18:40 +00:00
|
|
|
|
(define %base-packages-artwork
|
|
|
|
|
;; Default set of artwork packages.
|
|
|
|
|
(list guix-icons))
|
|
|
|
|
|
2020-04-04 07:59:48 +00:00
|
|
|
|
(define %base-packages-utils
|
|
|
|
|
;; Default set of utilities packages.
|
|
|
|
|
(cons* procps psmisc which
|
|
|
|
|
(@ (gnu packages admin) shadow) ;for 'passwd'
|
|
|
|
|
|
2020-10-08 10:07:51 +00:00
|
|
|
|
guile-3.0-latest
|
2020-04-04 07:59:48 +00:00
|
|
|
|
|
|
|
|
|
;; The packages below are also in %FINAL-INPUTS, so take them from
|
|
|
|
|
;; there to avoid duplication.
|
2020-04-23 11:33:09 +00:00
|
|
|
|
(list bash coreutils findutils grep sed
|
|
|
|
|
diffutils patch gawk tar gzip bzip2 xz lzip)))
|
2020-04-04 07:59:48 +00: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 08:20:39 +00: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 09:51:26 +00:00
|
|
|
|
nvi
|
2020-04-04 07:59:48 +00: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 16:17:26 +00:00
|
|
|
|
wget
|
2020-04-04 07:59:48 +00: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))
|
|
|
|
|
|
2020-10-09 09:47:34 +00:00
|
|
|
|
(define %base-packages-disk-utilities
|
|
|
|
|
;; A well-rounded set of packages for interacting with disks, partitions
|
|
|
|
|
;; and filesystems.
|
|
|
|
|
(list parted gptfdisk ddrescue
|
|
|
|
|
;; We used to provide fdisk from GNU fdisk, but as of version 2.0.0a
|
|
|
|
|
;; it pulls Guile 1.8, which takes unreasonable space; furthermore
|
|
|
|
|
;; util-linux's fdisk is already available, in %base-packages-linux.
|
|
|
|
|
cryptsetup mdadm
|
|
|
|
|
dosfstools
|
|
|
|
|
btrfs-progs
|
|
|
|
|
f2fs-tools
|
2021-09-23 11:21:11 +00:00
|
|
|
|
jfsutils
|
|
|
|
|
xfsprogs))
|
2020-10-09 09:47:34 +00:00
|
|
|
|
|
2014-06-04 12:59:24 +00:00
|
|
|
|
(define %base-packages
|
|
|
|
|
;; Default set of packages globally visible. It should include anything
|
|
|
|
|
;; required for basic administrator tasks.
|
2020-04-04 07:59:48 +00:00
|
|
|
|
(append (list e2fsprogs)
|
2021-09-28 10:18:40 +00:00
|
|
|
|
%base-packages-artwork
|
2020-04-04 07:59:48 +00:00
|
|
|
|
%base-packages-interactive
|
|
|
|
|
%base-packages-linux
|
|
|
|
|
%base-packages-networking
|
|
|
|
|
%base-packages-utils))
|
2014-06-04 12:59:24 +00:00
|
|
|
|
|
2014-05-31 20:01:05 +00:00
|
|
|
|
(define %default-issue
|
|
|
|
|
;; Default contents for /etc/issue.
|
|
|
|
|
"
|
|
|
|
|
This is the GNU system. Welcome.\n")
|
|
|
|
|
|
2014-10-07 19:17:22 +00:00
|
|
|
|
(define (local-host-aliases host-name)
|
|
|
|
|
"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"))
|
|
|
|
|
|
2014-09-11 20:03:24 +00:00
|
|
|
|
(define (default-/etc/hosts host-name)
|
|
|
|
|
"Return the default /etc/hosts file."
|
2015-06-05 20:41:55 +00:00
|
|
|
|
(plain-file "hosts" (local-host-aliases host-name)))
|
2014-09-11 20:03:24 +00:00
|
|
|
|
|
2020-08-24 15:02:48 +00: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)))))
|
|
|
|
|
|
2021-09-28 10:19:26 +00:00
|
|
|
|
(define (os-release)
|
|
|
|
|
(plain-file "os-release"
|
|
|
|
|
"\
|
|
|
|
|
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 21:44:26 +00:00
|
|
|
|
(define* (operating-system-etc-service os)
|
2021-01-21 15:05:37 +00:00
|
|
|
|
"Return a <service> that builds a directory containing the static part of
|
|
|
|
|
the /etc directory."
|
2020-04-25 09:55:56 +00:00
|
|
|
|
(let* ((login.defs
|
2018-04-08 18:30:05 +00: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 16:45:12 +00: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 21:44:26 +00:00
|
|
|
|
|
2020-04-25 09:55:56 +00:00
|
|
|
|
(hurd (operating-system-hurd os))
|
|
|
|
|
(issue (plain-file "issue" (operating-system-issue os)))
|
|
|
|
|
(nsswitch (operating-system-name-service-switch os))
|
|
|
|
|
(nsswitch (and nsswitch
|
|
|
|
|
(plain-file "nsswitch.conf"
|
|
|
|
|
(name-service-switch->string nsswitch))))
|
|
|
|
|
(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 21:44:26 +00:00
|
|
|
|
|
|
|
|
|
;; Startup file for POSIX-compliant login shells, which set system-wide
|
|
|
|
|
;; environment variables.
|
|
|
|
|
(profile (mixed-text-file "profile" "\
|
2015-07-07 18:24:57 +00:00
|
|
|
|
# Crucial variables that could be missing in the profiles' 'etc/profile'
|
2015-05-06 16:23:27 +00:00
|
|
|
|
# because they would require combining both profiles.
|
|
|
|
|
# FIXME: See <http://bugs.gnu.org/20255>.
|
2014-12-12 22:52:27 +00:00
|
|
|
|
export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/man
|
2018-06-12 13:04:52 +00:00
|
|
|
|
export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
|
2015-01-27 05:37:53 +00: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 15:21:09 +00: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 16:23:27 +00:00
|
|
|
|
# Ignore the default value of 'PATH'.
|
|
|
|
|
unset PATH
|
|
|
|
|
|
|
|
|
|
# Load the system profile's settings.
|
2017-11-20 17:41:47 +00:00
|
|
|
|
GUIX_PROFILE=/run/current-system/profile ; \\
|
2015-05-07 07:45:45 +00:00
|
|
|
|
. /run/current-system/profile/etc/profile
|
2015-05-06 16:23:27 +00:00
|
|
|
|
|
2016-07-27 12:27:00 +00: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 13:04:52 +00:00
|
|
|
|
# Arrange so that ~/.config/guix/current comes first.
|
|
|
|
|
for profile in \"$HOME/.guix-profile\" \"$HOME/.config/guix/current\"
|
2018-06-09 08:36:38 +00: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 16:23:27 +00:00
|
|
|
|
|
2018-06-18 20:57:22 +00:00
|
|
|
|
# Prepend setuid programs.
|
|
|
|
|
export PATH=/run/setuid-programs:$PATH
|
|
|
|
|
|
2018-06-12 13:04:52 +00:00
|
|
|
|
# Arrange so that ~/.config/guix/current/share/info comes first.
|
|
|
|
|
export INFOPATH=\"$HOME/.config/guix/current/share/info:$INFOPATH\"
|
|
|
|
|
|
2016-03-08 22:30:53 +00:00
|
|
|
|
# Set the umask, notably for users logging in via 'lsh'.
|
|
|
|
|
# See <http://bugs.gnu.org/22650>.
|
|
|
|
|
umask 022
|
2016-02-03 08:07:35 +00:00
|
|
|
|
|
2017-09-18 07:50:52 +00: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 21:06:20 +00:00
|
|
|
|
# Allow GStreamer-based applications to find plugins.
|
|
|
|
|
export GST_PLUGIN_PATH=\"$HOME/.guix-profile/lib/gstreamer-1.0\"
|
|
|
|
|
|
2015-03-12 21:11:18 +00:00
|
|
|
|
if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ]
|
|
|
|
|
then
|
|
|
|
|
# Load Bash-specific initialization code.
|
2015-05-07 07:45:45 +00:00
|
|
|
|
. /etc/bashrc
|
2015-03-12 21:11:18 +00:00
|
|
|
|
fi
|
2014-05-12 21:37:13 +00:00
|
|
|
|
"))
|
2015-03-12 21:11:18 +00: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 21:44:26 +00:00
|
|
|
|
(bashrc (plain-file "bashrc" "\
|
2015-03-12 21:11:18 +00:00
|
|
|
|
# Bash-specific initialization.
|
|
|
|
|
|
|
|
|
|
# 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 21:44:26 +00:00
|
|
|
|
fi\n")))
|
|
|
|
|
(etc-service
|
2021-09-28 10:19:26 +00:00
|
|
|
|
`(("os-release" ,#~#$(os-release))
|
|
|
|
|
("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 10:03:47 +00:00
|
|
|
|
("protocols" ,(file-append net-base "/etc/protocols"))
|
|
|
|
|
("rpc" ,(file-append net-base "/etc/rpc"))
|
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 21:44:26 +00:00
|
|
|
|
("login.defs" ,#~#$login.defs)
|
|
|
|
|
("issue" ,#~#$issue)
|
2020-04-25 09:55:56 +00:00
|
|
|
|
,@(if nsswitch `(("nsswitch.conf" ,#~#$nsswitch)) '())
|
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 21:44:26 +00:00
|
|
|
|
("profile" ,#~#$profile)
|
|
|
|
|
("bashrc" ,#~#$bashrc)
|
|
|
|
|
("hosts" ,#~#$(or (operating-system-hosts-file os)
|
|
|
|
|
(default-/etc/hosts (operating-system-host-name os))))
|
2017-09-16 11:54:40 +00: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 14:04:58 +00: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 09:35:54 +00: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 10:03:47 +00:00
|
|
|
|
("localtime" ,(file-append tzdata "/share/zoneinfo/"
|
|
|
|
|
(operating-system-timezone os)))
|
2020-08-24 15:02:48 +00:00
|
|
|
|
,@(if sudoers
|
|
|
|
|
`(("sudoers" ,(validated-sudoers-file sudoers)))
|
|
|
|
|
'())
|
2020-04-25 09:55:56 +00:00
|
|
|
|
,@(if hurd
|
|
|
|
|
`(("login" ,(file-append hurd "/etc/login"))
|
2020-06-09 15:44:52 +00:00
|
|
|
|
("motd" ,(file-append hurd "/etc/motd"))
|
|
|
|
|
("ttys" ,(file-append hurd "/etc/ttys")))
|
2020-04-25 09:55:56 +00:00
|
|
|
|
'())))))
|
2013-12-09 20:32:36 +00: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 20:41:01 +00: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 13:47:42 +00: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 21:44:26 +00: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 13:47:42 +00:00
|
|
|
|
|
2015-06-05 18:22:47 +00: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 13:57:02 +00:00
|
|
|
|
(warning (G_ "using a string for file '~a' is deprecated; \
|
2015-06-05 18:22:47 +00:00
|
|
|
|
use 'plain-file' instead~%")
|
|
|
|
|
file-name)
|
|
|
|
|
(plain-file file-name thing))
|
|
|
|
|
(x
|
|
|
|
|
x)))
|
|
|
|
|
|
2015-06-05 20:41:55 +00: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 13:57:02 +00:00
|
|
|
|
(warning (G_ "using a monadic value for '~a' is deprecated; \
|
2015-06-05 20:41:55 +00:00
|
|
|
|
use 'plain-file' instead~%")
|
|
|
|
|
file-name)
|
|
|
|
|
thing)
|
|
|
|
|
(x
|
|
|
|
|
(return x)))))
|
|
|
|
|
|
2014-04-23 13:47:42 +00: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 21:44:26 +00:00
|
|
|
|
(etc-directory
|
|
|
|
|
(fold-services (operating-system-services os)
|
|
|
|
|
#:target-type etc-service-type)))
|
2013-12-09 20:32:36 +00:00
|
|
|
|
|
2015-12-02 13:14:02 +00: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 08:58:33 +00: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 10:03:47 +00:00
|
|
|
|
("TZDIR" . ,(file-append tzdata "/share/zoneinfo"))
|
2015-12-02 13:14:02 +00: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 20:27:15 +00:00
|
|
|
|
|
|
|
|
|
;; 'GTK_DATA_PREFIX' must name one directory where GTK+ themes are
|
|
|
|
|
;; searched for.
|
|
|
|
|
("GTK_DATA_PREFIX" . "/run/current-system/profile")
|
|
|
|
|
|
2015-12-02 13:14:02 +00: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.
|
2016-11-08 22:20:11 +00:00
|
|
|
|
("DBUS_FATAL_WARNINGS" . "0")
|
|
|
|
|
|
|
|
|
|
;; XXX: Normally we wouldn't need to do this, but our glibc@2.23 package
|
|
|
|
|
;; used to look things up in 'PREFIX/lib/locale' instead of
|
|
|
|
|
;; '/run/current-system/locale' as was intended. Keep this hack around so
|
|
|
|
|
;; that people who still have glibc@2.23-using packages in their profiles
|
|
|
|
|
;; can use them correctly.
|
|
|
|
|
;; TODO: Remove when glibc@2.23 is long gone.
|
|
|
|
|
("GUIX_LOCPATH" . "/run/current-system/locale")))
|
2015-12-02 13:14:02 +00:00
|
|
|
|
|
2021-11-17 14:43:48 +00: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 09:58:47 +00:00
|
|
|
|
|
2021-11-17 14:43:48 +00:00
|
|
|
|
;; We want to be able to use defines, so define a procedure.
|
|
|
|
|
(define (%ensure-setuid-program-list lst properties)
|
2021-08-12 09:58:47 +00:00
|
|
|
|
(define warned? #f)
|
|
|
|
|
|
|
|
|
|
(define (warn-once)
|
|
|
|
|
(unless warned?
|
2021-11-17 14:43:48 +00:00
|
|
|
|
(warning (source-properties->location properties)
|
2021-08-12 09:58:47 +00: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 10:08:55 +00: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 09:58:47 +00:00
|
|
|
|
lst))
|
2021-07-06 20:03:19 +00:00
|
|
|
|
|
2014-04-30 20:17:56 +00:00
|
|
|
|
(define %setuid-programs
|
|
|
|
|
;; Default set of setuid-root programs.
|
2015-08-19 03:56:16 +00:00
|
|
|
|
(let ((shadow (@ (gnu packages admin) shadow)))
|
2021-07-06 20:03:20 +00:00
|
|
|
|
(map file-like->setuid-program
|
|
|
|
|
(list (file-append shadow "/bin/passwd")
|
2021-12-31 16:45:12 +00:00
|
|
|
|
(file-append shadow "/bin/chfn")
|
2021-07-06 20:03:20 +00: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")
|
|
|
|
|
(file-append fuse "/bin/fusermount")
|
|
|
|
|
|
|
|
|
|
;; 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 13:29:24 +00: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 18:22:47 +00:00
|
|
|
|
(plain-file "sudoers" "\
|
|
|
|
|
root ALL=(ALL) ALL
|
|
|
|
|
%wheel ALL=(ALL) ALL\n"))
|
2014-04-30 20:17:56 +00:00
|
|
|
|
|
2019-03-22 16:48:37 +00:00
|
|
|
|
(define* (operating-system-activation-script os)
|
2014-05-24 13:51:57 +00: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 16:48:37 +00: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 21:44:26 +00:00
|
|
|
|
(activation (fold-services services
|
|
|
|
|
#:target-type activation-service-type)))
|
|
|
|
|
(activation-service->script activation)))
|
2014-05-24 13:51:57 +00:00
|
|
|
|
|
2019-03-22 16:48:37 +00:00
|
|
|
|
(define* (operating-system-boot-script os)
|
2014-05-24 13:51:57 +00:00
|
|
|
|
"Return the boot script for OS---i.e., the code started by the initrd once
|
2019-03-22 16:48:37 +00:00
|
|
|
|
we're running in the final root."
|
|
|
|
|
(let* ((services (operating-system-services os))
|
2015-11-02 17:44:17 +00:00
|
|
|
|
(boot (fold-services services #:target-type boot-service-type)))
|
2017-04-15 20:12:37 +00:00
|
|
|
|
(service-value boot)))
|
2014-04-23 14:52:14 +00:00
|
|
|
|
|
2016-05-04 20:48:28 +00: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 20:12:37 +00:00
|
|
|
|
(service-value account))))
|
2016-05-04 20:48:28 +00: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 19:06:55 +00:00
|
|
|
|
(shepherd-configuration-services
|
|
|
|
|
(service-value
|
|
|
|
|
(fold-services (operating-system-services os)
|
|
|
|
|
#:target-type
|
|
|
|
|
shepherd-root-service-type)))))
|
2016-05-04 20:48:28 +00:00
|
|
|
|
|
2019-03-22 16:48:37 +00:00
|
|
|
|
(define* (operating-system-derivation os)
|
2015-11-02 17:44:17 +00:00
|
|
|
|
"Return a derivation that builds OS."
|
2019-03-22 16:48:37 +00:00
|
|
|
|
(let* ((services (operating-system-services os))
|
2015-11-02 17:44:17 +00:00
|
|
|
|
(system (fold-services services)))
|
|
|
|
|
;; SYSTEM contains the derivation as a monadic value.
|
2017-04-15 20:12:37 +00:00
|
|
|
|
(service-value system)))
|
2015-11-02 17:44:17 +00:00
|
|
|
|
|
2019-03-22 16:48:37 +00:00
|
|
|
|
(define* (operating-system-profile os)
|
2015-11-02 20:52:28 +00:00
|
|
|
|
"Return a derivation that builds the system profile of OS."
|
|
|
|
|
(mlet* %store-monad
|
2019-03-22 16:48:37 +00:00
|
|
|
|
((services -> (operating-system-services os))
|
2015-11-02 20:52:28 +00:00
|
|
|
|
(profile (fold-services services
|
|
|
|
|
#:target-type profile-service-type)))
|
|
|
|
|
(match profile
|
|
|
|
|
(("profile" profile)
|
|
|
|
|
(return profile)))))
|
|
|
|
|
|
2014-05-02 22:26:07 +00:00
|
|
|
|
(define (operating-system-root-file-system os)
|
|
|
|
|
"Return the root file system of OS."
|
2020-07-14 23:32:25 +00: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 22:26:07 +00:00
|
|
|
|
|
2014-05-17 15:39:30 +00:00
|
|
|
|
(define (operating-system-initrd-file os)
|
|
|
|
|
"Return a gexp denoting the initrd file of OS."
|
2014-05-02 22:26:07 +00:00
|
|
|
|
(define boot-file-systems
|
2014-11-25 15:01:21 +00:00
|
|
|
|
(filter file-system-needed-for-boot?
|
2014-05-02 22:26:07 +00:00
|
|
|
|
(operating-system-file-systems os)))
|
|
|
|
|
|
2014-09-22 09:06:42 +00:00
|
|
|
|
(define mapped-devices
|
|
|
|
|
(operating-system-boot-mapped-devices os))
|
|
|
|
|
|
|
|
|
|
(define make-initrd
|
|
|
|
|
(operating-system-initrd os))
|
|
|
|
|
|
2018-11-21 15:19:09 +00:00
|
|
|
|
(make-initrd boot-file-systems
|
|
|
|
|
#:linux (operating-system-kernel os)
|
|
|
|
|
#:linux-modules
|
|
|
|
|
(operating-system-initrd-modules os)
|
2019-03-20 11:19:14 +00:00
|
|
|
|
#:mapped-devices mapped-devices
|
|
|
|
|
#:keyboard-layout (operating-system-keyboard-layout os)))
|
2014-05-17 15:39:30 +00:00
|
|
|
|
|
2020-04-28 12:12:34 +00: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 10:01:54 +00: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 16:26:18 +00:00
|
|
|
|
(raise (formatted-message (G_ "~a: invalid locale name") name)))
|
2016-02-10 10:01:54 +00:00
|
|
|
|
(def def)))
|
|
|
|
|
|
2014-11-26 21:49:11 +00: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 10:01:54 +00: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 22:05:52 +00:00
|
|
|
|
#:libcs (operating-system-locale-libcs os)))
|
2014-11-26 21:49:11 +00:00
|
|
|
|
|
2020-05-10 13:31:45 +00:00
|
|
|
|
(define* (kernel->boot-label kernel #:key hurd)
|
2017-04-02 13:52:34 +00:00
|
|
|
|
"Return a label for the bootloader menu entry that boots KERNEL."
|
2020-05-10 13:31:45 +00:00
|
|
|
|
(cond ((package? hurd)
|
|
|
|
|
(string-append "GNU with the "
|
|
|
|
|
(string-titlecase (package-name hurd)) " "
|
|
|
|
|
(package-version hurd)))
|
|
|
|
|
((package? kernel)
|
2018-12-19 20:22:20 +00:00
|
|
|
|
(string-append "GNU with "
|
|
|
|
|
(string-titlecase (package-name kernel)) " "
|
2019-04-14 21:30:52 +00:00
|
|
|
|
(package-version kernel)))
|
2018-12-19 20:22:20 +00:00
|
|
|
|
((inferior-package? kernel)
|
|
|
|
|
(string-append "GNU with "
|
2018-12-24 19:52:59 +00:00
|
|
|
|
(string-titlecase (inferior-package-name kernel)) " "
|
2019-04-14 21:30:52 +00:00
|
|
|
|
(inferior-package-version kernel)))
|
2018-12-19 20:22:20 +00:00
|
|
|
|
(else "GNU")))
|
2014-06-25 20:46:44 +00:00
|
|
|
|
|
2019-04-15 09:30:50 +00: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 13:31:45 +00:00
|
|
|
|
(kernel->boot-label (operating-system-kernel os)
|
|
|
|
|
#:hurd (operating-system-hurd os)))
|
2019-04-15 09:30:50 +00:00
|
|
|
|
|
2016-01-21 21:45:54 +00: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 13:52:29 +00:00
|
|
|
|
(define* (operating-system-bootcfg os #:optional (old-entries '()))
|
2018-11-16 07:39:07 +00: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 11:50:23 +00:00
|
|
|
|
(let* ((file-systems (operating-system-file-systems os))
|
|
|
|
|
(root-fs (operating-system-root-file-system os))
|
2018-11-16 07:50:44 +00:00
|
|
|
|
(root-device (file-system-device root-fs))
|
2019-04-22 12:44:22 +00:00
|
|
|
|
(locale (operating-system-locale os))
|
2020-12-21 12:02:01 +00:00
|
|
|
|
(crypto-devices (operating-system-bootloader-crypto-devices os))
|
2018-11-16 07:50:44 +00: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 11:50:23 +00:00
|
|
|
|
|
2018-11-15 12:32:07 +00:00
|
|
|
|
(define generate-config-file
|
|
|
|
|
(bootloader-configuration-file-generator
|
|
|
|
|
(bootloader-configuration-bootloader bootloader-conf)))
|
|
|
|
|
|
2018-11-16 07:50:44 +00:00
|
|
|
|
(generate-config-file bootloader-conf (list entry)
|
2019-07-14 11:50:23 +00:00
|
|
|
|
#:old-entries old-entries
|
2019-04-22 12:44:22 +00:00
|
|
|
|
#:locale locale
|
2020-12-21 12:02:01 +00:00
|
|
|
|
#:store-crypto-devices crypto-devices
|
2020-05-28 02:44:28 +00:00
|
|
|
|
#:store-directory-prefix
|
2019-07-14 11:50:23 +00:00
|
|
|
|
(btrfs-store-subvolume-file-name file-systems))))
|
2014-05-17 15:39:30 +00:00
|
|
|
|
|
2020-05-26 15:38:30 +00: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))
|
|
|
|
|
(root-file-system-command
|
|
|
|
|
(list (file-append hurd "/hurd/ext2fs.static")
|
|
|
|
|
"ext2fs"
|
|
|
|
|
"--multiboot-command-line='${kernel-command-line}'"
|
|
|
|
|
"--host-priv-port='${host-port}'"
|
|
|
|
|
"--device-master-port='${device-port}'"
|
|
|
|
|
"--exec-server-task='${exec-task}'"
|
|
|
|
|
"--store-type=typed"
|
2020-06-08 10:25:24 +00:00
|
|
|
|
"--x-xattr-translator-records"
|
2020-05-26 15:38:30 +00:00
|
|
|
|
"'${root}'" "'$(task-create)'" "'$(task-resume)'"))
|
|
|
|
|
(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
|
|
|
|
|
(list (file-append libc "/lib/ld.so.1") "exec"
|
|
|
|
|
(file-append hurd "/hurd/exec") "'$(exec-task=task-create)'")))
|
|
|
|
|
(list root-file-system-command exec-server-command)))
|
|
|
|
|
|
2018-11-15 13:36:16 +00:00
|
|
|
|
(define* (operating-system-boot-parameters os root-device
|
|
|
|
|
#:key system-kernel-arguments?)
|
|
|
|
|
"Return a monadic <boot-parameters> record that describes the boot
|
|
|
|
|
parameters of OS. When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments
|
|
|
|
|
such as '--root' and '--load' to <boot-parameters>."
|
2020-07-05 07:40:34 +00:00
|
|
|
|
(let* ((initrd (and (not (operating-system-hurd os))
|
2020-05-26 15:38:30 +00:00
|
|
|
|
(operating-system-initrd-file os)))
|
2018-11-15 17:52:38 +00:00
|
|
|
|
(store (operating-system-store-file-system os))
|
2020-10-24 16:15:53 +00:00
|
|
|
|
(file-systems (operating-system-file-systems os))
|
2020-12-21 12:02:01 +00:00
|
|
|
|
(crypto-devices (operating-system-bootloader-crypto-devices os))
|
2019-10-21 10:23:40 +00:00
|
|
|
|
(locale (operating-system-locale os))
|
2018-11-15 17:52:38 +00:00
|
|
|
|
(bootloader (bootloader-configuration-bootloader
|
|
|
|
|
(operating-system-bootloader os)))
|
|
|
|
|
(bootloader-name (bootloader-name bootloader))
|
2020-05-26 15:38:30 +00:00
|
|
|
|
(label (operating-system-label os))
|
|
|
|
|
(multiboot-modules (operating-system-multiboot-modules os)))
|
2018-11-15 17:52:38 +00: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 15:38:30 +00:00
|
|
|
|
(multiboot-modules multiboot-modules)
|
2018-11-15 17:52:38 +00:00
|
|
|
|
(bootloader-name bootloader-name)
|
2019-08-28 21:27:20 +00:00
|
|
|
|
(bootloader-menu-entries
|
|
|
|
|
(bootloader-configuration-menu-entries (operating-system-bootloader os)))
|
2019-10-21 10:23:40 +00:00
|
|
|
|
(locale locale)
|
2018-11-15 17:52:38 +00:00
|
|
|
|
(store-device (ensure-not-/dev (file-system-device store)))
|
2020-10-24 16:15:53 +00:00
|
|
|
|
(store-directory-prefix (btrfs-store-subvolume-file-name file-systems))
|
2020-12-21 12:02:01 +00:00
|
|
|
|
(store-crypto-devices crypto-devices)
|
2018-11-15 17:52:38 +00:00
|
|
|
|
(store-mount-point (file-system-mount-point store)))))
|
2017-04-21 12:37:07 +00:00
|
|
|
|
|
2017-09-06 07:28:28 +00: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 08:22:58 +00:00
|
|
|
|
`(uuid ,(uuid-type uuid) ,(uuid-bytevector uuid)))
|
2018-05-18 11:43:07 +00:00
|
|
|
|
((? file-system-label? label)
|
|
|
|
|
`(file-system-label ,(file-system-label->string label)))
|
2017-09-06 07:28:28 +00:00
|
|
|
|
(_
|
|
|
|
|
device)))
|
|
|
|
|
|
2018-11-15 13:36:16 +00:00
|
|
|
|
(define* (operating-system-boot-parameters-file os
|
|
|
|
|
#:key system-kernel-arguments?)
|
2017-04-21 12:37:07 +00:00
|
|
|
|
"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 13:36:16 +00:00
|
|
|
|
|
|
|
|
|
When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments such as '--root'
|
|
|
|
|
and '--load' to the returned file (since the returned file is then usually
|
|
|
|
|
stored into the content-addressed \"system\" directory, it's usually not a
|
|
|
|
|
good idea to give it because the content hash would change by the content hash
|
2017-04-21 12:37:07 +00:00
|
|
|
|
being stored into the \"parameters\" file)."
|
2018-11-15 17:52:38 +00:00
|
|
|
|
(let* ((root (operating-system-root-file-system os))
|
|
|
|
|
(device (file-system-device root))
|
|
|
|
|
(params (operating-system-boot-parameters
|
|
|
|
|
os device
|
|
|
|
|
#:system-kernel-arguments?
|
|
|
|
|
system-kernel-arguments?)))
|
2020-04-22 13:03:51 +00:00
|
|
|
|
(scheme-file "parameters"
|
|
|
|
|
#~(boot-parameters
|
|
|
|
|
(version 0)
|
|
|
|
|
(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 16:51:25 +00: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 13:03:51 +00: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 10:23:40 +00:00
|
|
|
|
(locale #$(boot-parameters-locale params))
|
2020-04-22 13:03:51 +00:00
|
|
|
|
(store
|
|
|
|
|
(device
|
|
|
|
|
#$(device->sexp (boot-parameters-store-device params)))
|
|
|
|
|
(mount-point #$(boot-parameters-store-mount-point
|
2020-10-24 16:15:53 +00:00
|
|
|
|
params))
|
|
|
|
|
(directory-prefix
|
2020-12-21 12:02:01 +00:00
|
|
|
|
#$(boot-parameters-store-directory-prefix params))
|
|
|
|
|
(crypto-devices
|
|
|
|
|
#$(map device->sexp
|
|
|
|
|
(boot-parameters-store-crypto-devices params)))))
|
2020-04-22 13:03:51 +00:00
|
|
|
|
#:set-load-path? #f)))
|
2014-06-25 20:48:25 +00:00
|
|
|
|
|
2017-09-12 20:20:08 +00: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'.
|
|
|
|
|
(run-with-store store (operating-system-derivation os)
|
|
|
|
|
#:system system
|
|
|
|
|
#:target target)))))
|
|
|
|
|
|
2013-12-09 20:32:36 +00:00
|
|
|
|
;;; system.scm ends here
|