2013-12-09 15:32:36 -05:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2020-04-22 09:51:26 -04:00
|
|
|
|
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
2015-02-24 23:54:29 -05:00
|
|
|
|
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
|
2016-02-11 05:52:48 -05:00
|
|
|
|
;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
|
2016-10-28 06:07:18 -04:00
|
|
|
|
;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
|
2017-04-02 09:52:29 -04:00
|
|
|
|
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
2019-01-05 08:06:47 -05:00
|
|
|
|
;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
|
2020-02-18 04:42:07 -05:00
|
|
|
|
;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
|
2020-04-04 03:59:48 -04:00
|
|
|
|
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
|
2020-04-29 11:17:55 -04:00
|
|
|
|
;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
|
2019-07-14 07:50:23 -04:00
|
|
|
|
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
2013-12-09 15:32:36 -05:00
|
|
|
|
;;;
|
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
|
;;; your option) any later version.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
|
;;;
|
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
(define-module (gnu system)
|
2018-12-19 15:22:20 -05:00
|
|
|
|
#:use-module (guix inferior)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (guix store)
|
|
|
|
|
#:use-module (guix monads)
|
2014-04-26 10:36:48 -04:00
|
|
|
|
#:use-module (guix gexp)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (guix records)
|
|
|
|
|
#:use-module (guix packages)
|
|
|
|
|
#:use-module (guix derivations)
|
2014-08-11 16:18:33 -04:00
|
|
|
|
#:use-module (guix profiles)
|
2015-06-05 14:22:47 -04:00
|
|
|
|
#:use-module (guix ui)
|
2020-04-22 16:58:11 -04:00
|
|
|
|
#:use-module (guix utils)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (gnu packages base)
|
|
|
|
|
#:use-module (gnu packages bash)
|
gnu: Split (gnu packages base), adding (gnu packages commencement).
* gnu/packages/base.scm (gnu-make-boot0, diffutils-boot0,
findutils-boot0, %boot0-inputs, nix-system->gnu-triplet, boot-triplet,
binutils-boot0, gcc-boot0, perl-boot0, linux-libre-headers-boot0,
texinfo-boot0, %boot1-inputs, glibc-final-with-bootstrap-bash,
cross-gcc-wrapper, static-bash-for-glibc, glibc-final,
gcc-boot0-wrapped, %boot2-inputs, binutils-final, libstdc++,
gcc-final, ld-wrapper-boot3, %boot3-inputs, bash-final, %boot4-inputs,
guile-final, gnu-make-final, ld-wrapper, coreutils-final, grep-final,
%boot5-inputs, %final-inputs, canonical-package, gcc-toolchain,
gcc-toolchain-4.8, gcc-toolchain-4.9): Move to...
* gnu/packages/commencement.scm: ... here. New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* build-aux/check-final-inputs-self-contained.scm: Adjust accordingly.
* gnu/packages/cross-base.scm: Likewise.
* gnu/packages/make-bootstrap.scm: Likewise.
* guix/build-system/cmake.scm (cmake-build): Likewise.
* guix/build-system/gnu.scm (standard-packages, gnu-build,
gnu-cross-build): Likewise.
* guix/build-system/perl.scm (perl-build): Likewise.
* guix/build-system/python.scm (python-build): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Likewise.
* guix/download.scm (url-fetch): Likewise.
* guix/gexp.scm (default-guile): Likewise.
* guix/git-download.scm (git-fetch): Likewise.
* guix/monads.scm (run-with-store): Likewise.
* guix/packages.scm (default-guile): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/scripts/refresh.scm: Likewise.
* guix/svn-download.scm (svn-fetch): Likewise.
* tests/builders.scm (%bootstrap-inputs, %bootstrap-search-paths):
Likewise.
* tests/packages.scm ("GNU Make, bootstrap"): Likewise.
* tests/guix-package.sh: Likewise.
* gnu/services/base.scm: Use 'canonical-package' instead of xxx-final.
* gnu/services/xorg.scm: Likewise.
* gnu/system/vm.scm: Likewise.
* guix/scripts/pull.scm (guix-pull): Likewise.
2014-08-26 18:25:17 -04:00
|
|
|
|
#:use-module (gnu packages guile)
|
2019-04-24 06:35:06 -04:00
|
|
|
|
#:use-module (gnu packages guile-xyz)
|
2014-01-13 17:21:47 -05:00
|
|
|
|
#:use-module (gnu packages admin)
|
2014-05-29 17:13:11 -04:00
|
|
|
|
#:use-module (gnu packages linux)
|
2014-10-28 18:40:32 -04:00
|
|
|
|
#:use-module (gnu packages pciutils)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (gnu packages package-management)
|
2014-06-04 08:59:24 -04:00
|
|
|
|
#:use-module (gnu packages less)
|
|
|
|
|
#:use-module (gnu packages zile)
|
2014-07-14 09:35:57 -04:00
|
|
|
|
#:use-module (gnu packages nano)
|
2014-09-12 16:13:23 -04:00
|
|
|
|
#:use-module (gnu packages gawk)
|
2014-12-07 16:59:46 -05:00
|
|
|
|
#:use-module (gnu packages man)
|
2016-02-08 17:34:50 -05:00
|
|
|
|
#:use-module (gnu packages texinfo)
|
2014-09-12 16:13:23 -04:00
|
|
|
|
#:use-module (gnu packages compression)
|
2014-11-11 16:42:15 -05:00
|
|
|
|
#:use-module (gnu packages firmware)
|
2014-02-19 14:58:24 -05:00
|
|
|
|
#:use-module (gnu services)
|
2016-01-27 07:45:01 -05:00
|
|
|
|
#:use-module (gnu services shepherd)
|
2014-02-19 14:58:24 -05:00
|
|
|
|
#:use-module (gnu services base)
|
2017-05-15 16:24:18 -04:00
|
|
|
|
#:use-module (gnu bootloader)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (gnu system shadow)
|
2015-02-04 15:58:15 -05:00
|
|
|
|
#:use-module (gnu system nss)
|
2014-11-26 16:49:11 -05:00
|
|
|
|
#:use-module (gnu system locale)
|
2015-11-03 12:08:47 -05:00
|
|
|
|
#:use-module (gnu system pam)
|
2014-01-29 07:04:00 -05:00
|
|
|
|
#:use-module (gnu system linux-initrd)
|
2017-09-06 03:28:28 -04:00
|
|
|
|
#:use-module (gnu system uuid)
|
2014-05-20 15:59:08 -04:00
|
|
|
|
#:use-module (gnu system file-systems)
|
2016-04-17 11:53:20 -04:00
|
|
|
|
#:use-module (gnu system mapped-devices)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:use-module (ice-9 match)
|
|
|
|
|
#:use-module (srfi srfi-1)
|
|
|
|
|
#:use-module (srfi srfi-26)
|
2014-11-26 16:49:11 -05:00
|
|
|
|
#:use-module (srfi srfi-34)
|
|
|
|
|
#:use-module (srfi srfi-35)
|
2016-11-03 09:10:28 -04:00
|
|
|
|
#:use-module (rnrs bytevectors)
|
2013-12-09 15:32:36 -05:00
|
|
|
|
#:export (operating-system
|
|
|
|
|
operating-system?
|
2019-03-29 18:22:27 -04:00
|
|
|
|
this-operating-system
|
2014-05-18 15:58:01 -04:00
|
|
|
|
|
|
|
|
|
operating-system-bootloader
|
2013-12-09 15:32:36 -05:00
|
|
|
|
operating-system-services
|
2019-03-22 12:48:37 -04:00
|
|
|
|
operating-system-essential-services
|
2019-05-10 11:45:06 -04:00
|
|
|
|
operating-system-default-essential-services
|
2014-05-09 16:58:46 -04:00
|
|
|
|
operating-system-user-services
|
2013-12-09 15:32:36 -05:00
|
|
|
|
operating-system-packages
|
2014-01-31 08:36:48 -05:00
|
|
|
|
operating-system-host-name
|
2014-09-11 16:03:24 -04:00
|
|
|
|
operating-system-hosts-file
|
2014-01-31 08:36:48 -05:00
|
|
|
|
operating-system-kernel
|
2016-09-09 17:27:00 -04:00
|
|
|
|
operating-system-kernel-file
|
2017-04-21 08:37:08 -04:00
|
|
|
|
operating-system-kernel-arguments
|
2019-04-15 05:30:50 -04:00
|
|
|
|
operating-system-label
|
|
|
|
|
operating-system-default-label
|
2018-02-27 05:42:09 -05:00
|
|
|
|
operating-system-initrd-modules
|
2014-01-31 08:36:48 -05:00
|
|
|
|
operating-system-initrd
|
|
|
|
|
operating-system-users
|
|
|
|
|
operating-system-groups
|
2014-05-31 16:01:05 -04:00
|
|
|
|
operating-system-issue
|
2014-01-31 08:36:48 -05:00
|
|
|
|
operating-system-timezone
|
|
|
|
|
operating-system-locale
|
2014-11-26 16:49:11 -05:00
|
|
|
|
operating-system-locale-definitions
|
2015-10-30 18:05:52 -04:00
|
|
|
|
operating-system-locale-libcs
|
2014-09-11 17:39:15 -04:00
|
|
|
|
operating-system-mapped-devices
|
2014-05-02 18:26:07 -04:00
|
|
|
|
operating-system-file-systems
|
2016-01-21 16:45:54 -05:00
|
|
|
|
operating-system-store-file-system
|
2016-07-17 18:51:02 -04:00
|
|
|
|
operating-system-user-mapped-devices
|
|
|
|
|
operating-system-boot-mapped-devices
|
2014-06-26 18:06:46 -04:00
|
|
|
|
operating-system-activation-script
|
2016-05-04 16:48:28 -04:00
|
|
|
|
operating-system-user-accounts
|
|
|
|
|
operating-system-shepherd-service-names
|
2018-01-09 03:24:00 -05:00
|
|
|
|
operating-system-user-kernel-arguments
|
2020-03-05 05:38:42 -05:00
|
|
|
|
operating-system-firmware
|
|
|
|
|
operating-system-keyboard-layout
|
|
|
|
|
operating-system-name-service-switch
|
|
|
|
|
operating-system-pam-services
|
|
|
|
|
operating-system-setuid-programs
|
|
|
|
|
operating-system-skeletons
|
|
|
|
|
operating-system-sudoers-file
|
|
|
|
|
operating-system-swap-devices
|
2020-03-23 13:32:02 -04:00
|
|
|
|
operating-system-kernel-loadable-modules
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2014-04-27 08:58:15 -04:00
|
|
|
|
operating-system-derivation
|
2014-05-02 18:26:07 -04:00
|
|
|
|
operating-system-profile
|
2017-04-02 09:52:29 -04:00
|
|
|
|
operating-system-bootcfg
|
2015-06-08 08:59:00 -04:00
|
|
|
|
operating-system-etc-directory
|
|
|
|
|
operating-system-locale-directory
|
|
|
|
|
operating-system-boot-script
|
2020-04-28 08:12:34 -04:00
|
|
|
|
operating-system-uuid
|
2015-06-08 08:59:00 -04:00
|
|
|
|
|
2017-02-14 10:28:31 -05:00
|
|
|
|
system-linux-image-file-name
|
2019-05-10 16:29:10 -04:00
|
|
|
|
operating-system-with-gc-roots
|
2019-11-30 12:05:07 -05:00
|
|
|
|
operating-system-with-provenance
|
2017-02-14 10:28:31 -05:00
|
|
|
|
|
2016-01-07 18:48:17 -05:00
|
|
|
|
boot-parameters
|
|
|
|
|
boot-parameters?
|
|
|
|
|
boot-parameters-label
|
|
|
|
|
boot-parameters-root-device
|
2017-06-10 04:47:25 -04:00
|
|
|
|
boot-parameters-bootloader-name
|
2019-08-28 17:27:20 -04:00
|
|
|
|
boot-parameters-bootloader-menu-entries
|
2016-10-28 06:07:18 -04:00
|
|
|
|
boot-parameters-store-device
|
|
|
|
|
boot-parameters-store-mount-point
|
2016-01-07 18:48:17 -05:00
|
|
|
|
boot-parameters-kernel
|
|
|
|
|
boot-parameters-kernel-arguments
|
2016-09-24 04:39:00 -04:00
|
|
|
|
boot-parameters-initrd
|
2017-05-08 15:03:37 -04:00
|
|
|
|
read-boot-parameters
|
2017-04-21 08:37:09 -04:00
|
|
|
|
read-boot-parameters-file
|
2017-06-29 06:42:59 -04:00
|
|
|
|
boot-parameters->menu-entry
|
2016-01-07 18:48:17 -05:00
|
|
|
|
|
2014-10-07 15:17:22 -04:00
|
|
|
|
local-host-aliases
|
2018-11-16 06:43:55 -05:00
|
|
|
|
%root-account
|
2014-09-09 11:12:33 -04:00
|
|
|
|
%setuid-programs
|
2020-03-17 22:10:40 -04:00
|
|
|
|
%sudoers-specification
|
2014-09-11 17:39:15 -04:00
|
|
|
|
%base-packages
|
2020-04-04 03:59:48 -04:00
|
|
|
|
%base-packages-interactive
|
|
|
|
|
%base-packages-linux
|
|
|
|
|
%base-packages-networking
|
|
|
|
|
%base-packages-utils
|
2020-04-29 11:17:55 -04:00
|
|
|
|
%base-firmware
|
|
|
|
|
%default-kernel-arguments))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;;
|
|
|
|
|
;;; This module supports whole-system configuration.
|
|
|
|
|
;;;
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2018-11-15 08:36:16 -05: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-11 23:56:45 -05: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 08:36:16 -05:00
|
|
|
|
#~(string-append "--system=" #$system)
|
|
|
|
|
#~(string-append "--load=" #$system "/boot")))
|
2017-04-21 08:37:08 -04:00
|
|
|
|
|
2013-12-09 15:32:36 -05: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 18:22:27 -04:00
|
|
|
|
this-operating-system
|
|
|
|
|
|
2013-12-09 15:32:36 -05:00
|
|
|
|
(kernel operating-system-kernel ; package
|
2015-08-04 10:38:06 -04:00
|
|
|
|
(default linux-libre))
|
2020-02-18 04:42:07 -05:00
|
|
|
|
(kernel-loadable-modules operating-system-kernel-loadable-modules
|
|
|
|
|
(default '())) ; list of packages
|
2017-04-20 22:21:20 -04:00
|
|
|
|
(kernel-arguments operating-system-user-kernel-arguments
|
2020-04-29 11:17:55 -04:00
|
|
|
|
(default %default-kernel-arguments)) ; list of gexps/strings
|
2017-05-15 16:24:18 -04:00
|
|
|
|
(bootloader operating-system-bootloader) ; <bootloader-configuration>
|
2019-04-15 05:30:50 -04:00
|
|
|
|
(label operating-system-label ; string
|
|
|
|
|
(thunked)
|
|
|
|
|
(default (operating-system-default-label this-operating-system)))
|
2014-05-18 15:58:01 -04:00
|
|
|
|
|
2019-03-20 07:19:14 -04:00
|
|
|
|
(keyboard-layout operating-system-keyboard-layout ;#f | <keyboard-layout>
|
|
|
|
|
(default #f))
|
2018-11-15 12:39:18 -05:00
|
|
|
|
(initrd operating-system-initrd ; (list fs) -> file-like
|
2014-06-30 14:56:45 -04:00
|
|
|
|
(default base-initrd))
|
2018-02-27 05:42:09 -05:00
|
|
|
|
(initrd-modules operating-system-initrd-modules ; list of strings
|
|
|
|
|
(thunked) ; it's system-dependent
|
|
|
|
|
(default %base-initrd-modules))
|
|
|
|
|
|
2014-11-11 16:42:15 -05:00
|
|
|
|
(firmware operating-system-firmware ; list of packages
|
|
|
|
|
(default %base-firmware))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
|
|
|
|
(host-name operating-system-host-name) ; string
|
2015-06-05 16:41:55 -04:00
|
|
|
|
(hosts-file operating-system-hosts-file ; file-like | #f
|
2014-09-11 16:03:24 -04:00
|
|
|
|
(default #f))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2014-09-11 17:39:15 -04:00
|
|
|
|
(mapped-devices operating-system-mapped-devices ; list of <mapped-device>
|
|
|
|
|
(default '()))
|
2014-06-26 18:11:38 -04:00
|
|
|
|
(file-systems operating-system-file-systems) ; list of fs
|
2014-09-18 16:51:48 -04:00
|
|
|
|
(swap-devices operating-system-swap-devices ; list of strings
|
|
|
|
|
(default '()))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
|
|
|
|
(users operating-system-users ; list of user accounts
|
2015-05-25 10:54:05 -04:00
|
|
|
|
(default %base-user-accounts))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
(groups operating-system-groups ; list of user groups
|
2014-06-22 16:16:14 -04:00
|
|
|
|
(default %base-groups))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2019-03-22 08:53:47 -04:00
|
|
|
|
(skeletons operating-system-skeletons ; list of name/file-like value
|
2014-05-12 17:37:13 -04:00
|
|
|
|
(default (default-skeletons)))
|
2014-05-31 16:01:05 -04:00
|
|
|
|
(issue operating-system-issue ; string
|
|
|
|
|
(default %default-issue))
|
2014-05-12 17:37:13 -04:00
|
|
|
|
|
2013-12-09 15:32:36 -05:00
|
|
|
|
(packages operating-system-packages ; list of (PACKAGE OUTPUT...)
|
2014-06-04 08:59:24 -04:00
|
|
|
|
(default %base-packages)) ; or just PACKAGE
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
|
|
|
|
(timezone operating-system-timezone) ; string
|
2014-06-26 18:11:38 -04:00
|
|
|
|
(locale operating-system-locale ; string
|
2014-11-26 16:49:11 -05:00
|
|
|
|
(default "en_US.utf8"))
|
|
|
|
|
(locale-definitions operating-system-locale-definitions ; list of <locale-definition>
|
|
|
|
|
(default %default-locale-definitions))
|
2015-10-30 18:05:52 -04:00
|
|
|
|
(locale-libcs operating-system-locale-libcs ; list of <packages>
|
|
|
|
|
(default %default-locale-libcs))
|
2015-02-04 15:58:15 -05:00
|
|
|
|
(name-service-switch operating-system-name-service-switch ; <name-service-switch>
|
|
|
|
|
(default %default-nss))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(essential-services operating-system-essential-services ; list of services
|
|
|
|
|
(thunked)
|
2019-05-10 11:45:06 -04:00
|
|
|
|
(default (operating-system-default-essential-services
|
|
|
|
|
this-operating-system)))
|
2019-03-22 08:53:47 -04:00
|
|
|
|
(services operating-system-user-services ; list of services
|
2014-04-30 16:17:56 -04:00
|
|
|
|
(default %base-services))
|
|
|
|
|
|
|
|
|
|
(pam-services operating-system-pam-services ; list of PAM services
|
|
|
|
|
(default (base-pam-services)))
|
|
|
|
|
(setuid-programs operating-system-setuid-programs
|
2014-05-01 09:29:24 -04:00
|
|
|
|
(default %setuid-programs)) ; list of string-valued gexps
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2015-06-15 06:18:20 -04:00
|
|
|
|
(sudoers-file operating-system-sudoers-file ; file-like
|
|
|
|
|
(default %sudoers-specification)))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2018-11-15 08:36:16 -05:00
|
|
|
|
(define (operating-system-kernel-arguments os root-device)
|
2017-04-21 08:37:08 -04:00
|
|
|
|
"Return all the kernel arguments, including the ones not specified
|
|
|
|
|
directly by the user."
|
2018-11-15 08:36:16 -05:00
|
|
|
|
(append (bootable-kernel-arguments os root-device)
|
|
|
|
|
(operating-system-user-kernel-arguments os)))
|
2017-04-21 08:37:08 -04:00
|
|
|
|
|
2014-05-12 17:37:13 -04:00
|
|
|
|
|
|
|
|
|
;;;
|
2017-05-07 05:30:24 -04:00
|
|
|
|
;;; Boot parameters
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define-record-type* <boot-parameters>
|
|
|
|
|
boot-parameters make-boot-parameters boot-parameters?
|
|
|
|
|
(label boot-parameters-label)
|
|
|
|
|
;; Because we will use the 'store-device' to create the GRUB search command,
|
|
|
|
|
;; the 'store-device' has slightly different semantics than 'root-device'.
|
|
|
|
|
;; The 'store-device' can be a file system uuid, a file system label, or #f,
|
|
|
|
|
;; but it cannot be a device path such as "/dev/sda3", since GRUB would not
|
|
|
|
|
;; understand that. The 'root-device', on the other hand, corresponds
|
|
|
|
|
;; exactly to the device field of the <file-system> object representing the
|
|
|
|
|
;; OS's root file system, so it might be a device path like "/dev/sda3".
|
|
|
|
|
(root-device boot-parameters-root-device)
|
2017-06-10 04:47:25 -04:00
|
|
|
|
(bootloader-name boot-parameters-bootloader-name)
|
2019-08-28 17:27:20 -04:00
|
|
|
|
(bootloader-menu-entries ;list of <menu-entry>
|
|
|
|
|
boot-parameters-bootloader-menu-entries)
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(store-device boot-parameters-store-device)
|
|
|
|
|
(store-mount-point boot-parameters-store-mount-point)
|
|
|
|
|
(kernel boot-parameters-kernel)
|
|
|
|
|
(kernel-arguments boot-parameters-kernel-arguments)
|
|
|
|
|
(initrd boot-parameters-initrd))
|
|
|
|
|
|
2017-10-06 17:09:48 -04:00
|
|
|
|
(define (ensure-not-/dev device)
|
|
|
|
|
"If DEVICE starts with a slash, return #f. This is meant to filter out
|
|
|
|
|
Linux device names such as /dev/sda, and to preserve GRUB device names and
|
|
|
|
|
file system labels."
|
|
|
|
|
(if (and (string? device) (string-prefix? "/" device))
|
|
|
|
|
#f
|
|
|
|
|
device))
|
|
|
|
|
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(define (read-boot-parameters port)
|
|
|
|
|
"Read boot parameters from PORT and return the corresponding
|
|
|
|
|
<boot-parameters> object or #f if the format is unrecognized."
|
2017-09-06 04:22:58 -04:00
|
|
|
|
(define device-sexp->device
|
|
|
|
|
(match-lambda
|
|
|
|
|
(('uuid (? symbol? type) (? bytevector? bv))
|
|
|
|
|
(bytevector->uuid bv type))
|
2018-05-18 07:43:07 -04:00
|
|
|
|
(('file-system-label (? string? label))
|
|
|
|
|
(file-system-label label))
|
2017-09-06 04:22:58 -04:00
|
|
|
|
((? bytevector? bv) ;old format
|
|
|
|
|
(bytevector->uuid bv 'dce))
|
|
|
|
|
((? string? device)
|
2018-05-18 07:43:07 -04:00
|
|
|
|
;; It used to be that we would not distinguish between labels and
|
|
|
|
|
;; device names. Try to infer the right thing here.
|
|
|
|
|
(if (string-prefix? "/dev/" device)
|
|
|
|
|
device
|
|
|
|
|
(file-system-label device)))))
|
2017-09-06 04:22:58 -04:00
|
|
|
|
|
2017-05-07 05:30:24 -04:00
|
|
|
|
(match (read port)
|
|
|
|
|
(('boot-parameters ('version 0)
|
|
|
|
|
('label label) ('root-device root)
|
|
|
|
|
('kernel linux)
|
|
|
|
|
rest ...)
|
|
|
|
|
(boot-parameters
|
|
|
|
|
(label label)
|
2017-09-11 17:00:40 -04:00
|
|
|
|
(root-device (device-sexp->device root))
|
2017-05-07 05:30:24 -04:00
|
|
|
|
|
2017-06-10 04:47:25 -04:00
|
|
|
|
(bootloader-name
|
|
|
|
|
(match (assq 'bootloader-name rest)
|
2017-04-02 09:10:52 -04:00
|
|
|
|
((_ args) args)
|
|
|
|
|
(#f 'grub))) ; for compatibility reasons.
|
|
|
|
|
|
2019-08-28 17:27:20 -04:00
|
|
|
|
(bootloader-menu-entries
|
|
|
|
|
(match (assq 'bootloader-menu-entries rest)
|
|
|
|
|
((_ entries) (map sexp->menu-entry entries))
|
|
|
|
|
(#f '())))
|
|
|
|
|
|
2017-05-07 05:30:24 -04:00
|
|
|
|
;; In the past, we would store the directory name of the kernel instead
|
|
|
|
|
;; of the absolute file name of its image. Detect that and correct it.
|
|
|
|
|
(kernel (if (string=? linux (direct-store-path linux))
|
|
|
|
|
(string-append linux "/"
|
|
|
|
|
(system-linux-image-file-name))
|
|
|
|
|
linux))
|
|
|
|
|
|
|
|
|
|
(kernel-arguments
|
|
|
|
|
(match (assq 'kernel-arguments rest)
|
|
|
|
|
((_ args) args)
|
|
|
|
|
(#f '()))) ;the old format
|
|
|
|
|
|
|
|
|
|
(initrd
|
|
|
|
|
(match (assq 'initrd rest)
|
|
|
|
|
(('initrd ('string-append directory file)) ;the old format
|
|
|
|
|
(string-append directory file))
|
|
|
|
|
(('initrd (? string? file))
|
|
|
|
|
file)))
|
|
|
|
|
|
|
|
|
|
(store-device
|
2017-09-21 16:30:59 -04:00
|
|
|
|
;; Linux device names like "/dev/sda1" are not suitable GRUB device
|
|
|
|
|
;; identifiers, so we just filter them out.
|
|
|
|
|
(ensure-not-/dev
|
|
|
|
|
(match (assq 'store rest)
|
|
|
|
|
(('store ('device #f) _ ...)
|
|
|
|
|
root-device)
|
|
|
|
|
(('store ('device device) _ ...)
|
|
|
|
|
(device-sexp->device device))
|
|
|
|
|
(_ ;the old format
|
|
|
|
|
root-device))))
|
2017-05-07 05:30:24 -04:00
|
|
|
|
|
|
|
|
|
(store-mount-point
|
|
|
|
|
(match (assq 'store rest)
|
|
|
|
|
(('store ('device _) ('mount-point mount-point) _ ...)
|
|
|
|
|
mount-point)
|
|
|
|
|
(_ ;the old format
|
|
|
|
|
"/")))))
|
|
|
|
|
(x ;unsupported format
|
2018-05-31 11:31:19 -04:00
|
|
|
|
(warning (G_ "unrecognized boot parameters at '~a'~%")
|
|
|
|
|
(port-filename port))
|
2017-05-07 05:30:24 -04: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 08:36:16 -05: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 08:24:20 -04:00
|
|
|
|
|
2017-06-29 06:42:59 -04:00
|
|
|
|
(define (boot-parameters->menu-entry conf)
|
|
|
|
|
(menu-entry
|
|
|
|
|
(label (boot-parameters-label conf))
|
|
|
|
|
(device (boot-parameters-store-device conf))
|
|
|
|
|
(device-mount-point (boot-parameters-store-mount-point conf))
|
|
|
|
|
(linux (boot-parameters-kernel conf))
|
|
|
|
|
(linux-arguments (boot-parameters-kernel-arguments conf))
|
|
|
|
|
(initrd (boot-parameters-initrd conf))))
|
|
|
|
|
|
2017-05-29 08:24:20 -04:00
|
|
|
|
|
2017-05-07 05:30:24 -04:00
|
|
|
|
|
|
|
|
|
;;;
|
2014-05-12 17:37:13 -04:00
|
|
|
|
;;; Services.
|
|
|
|
|
;;;
|
|
|
|
|
|
2016-08-21 12:50:14 -04:00
|
|
|
|
(define (non-boot-file-system-service os)
|
|
|
|
|
"Return the file system service for the file systems of OS that are not
|
|
|
|
|
marked as 'needed-for-boot'."
|
2014-05-10 17:33:52 -04:00
|
|
|
|
(define file-systems
|
2014-11-25 10:01:21 -05:00
|
|
|
|
(remove file-system-needed-for-boot?
|
2014-05-10 17:33:52 -04:00
|
|
|
|
(operating-system-file-systems os)))
|
|
|
|
|
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(define mapped-devices-for-boot
|
|
|
|
|
(operating-system-boot-mapped-devices os))
|
|
|
|
|
|
2014-09-11 17:39:15 -04:00
|
|
|
|
(define (device-mappings fs)
|
2015-12-21 18:29:43 -05:00
|
|
|
|
(let ((device (file-system-device fs)))
|
2016-01-01 16:29:33 -05:00
|
|
|
|
(if (string? device) ;title is 'device
|
2015-12-21 18:29:43 -05:00
|
|
|
|
(filter (lambda (md)
|
|
|
|
|
(string=? (string-append "/dev/mapper/"
|
|
|
|
|
(mapped-device-target md))
|
|
|
|
|
device))
|
|
|
|
|
(operating-system-mapped-devices os))
|
|
|
|
|
'())))
|
2014-09-11 17:39:15 -04:00
|
|
|
|
|
2015-10-29 13:22:19 -04:00
|
|
|
|
(define (add-dependencies fs)
|
|
|
|
|
;; Add the dependencies due to device mappings to FS.
|
|
|
|
|
(file-system
|
|
|
|
|
(inherit fs)
|
|
|
|
|
(dependencies
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(delete-duplicates
|
|
|
|
|
(remove (cut member <> mapped-devices-for-boot)
|
|
|
|
|
(append (device-mappings fs)
|
|
|
|
|
(file-system-dependencies fs)))
|
|
|
|
|
eq?))))
|
2015-10-29 13:22:19 -04:00
|
|
|
|
|
2016-08-21 12:50:14 -04:00
|
|
|
|
(service file-system-service-type
|
|
|
|
|
(map add-dependencies file-systems)))
|
2014-05-10 17:33:52 -04:00
|
|
|
|
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(define (mapped-device-users device file-systems)
|
|
|
|
|
"Return the subset of FILE-SYSTEMS that use DEVICE."
|
2014-09-22 05:06:42 -04:00
|
|
|
|
(let ((target (string-append "/dev/mapper/" (mapped-device-target device))))
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(filter (lambda (fs)
|
|
|
|
|
(or (member device (file-system-dependencies fs))
|
|
|
|
|
(and (string? (file-system-device fs))
|
|
|
|
|
(string=? (file-system-device fs) target))))
|
|
|
|
|
file-systems)))
|
2014-09-22 05:06:42 -04:00
|
|
|
|
|
|
|
|
|
(define (operating-system-user-mapped-devices os)
|
|
|
|
|
"Return the subset of mapped devices that can be installed in
|
|
|
|
|
user-land--i.e., those not needed during boot."
|
2014-11-30 11:50:07 -05:00
|
|
|
|
(let ((devices (operating-system-mapped-devices os))
|
|
|
|
|
(file-systems (operating-system-file-systems os)))
|
|
|
|
|
(filter (lambda (md)
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(let ((users (mapped-device-users md file-systems)))
|
|
|
|
|
(not (any file-system-needed-for-boot? users))))
|
2014-11-30 11:50:07 -05:00
|
|
|
|
devices)))
|
2014-09-22 05:06:42 -04:00
|
|
|
|
|
|
|
|
|
(define (operating-system-boot-mapped-devices os)
|
|
|
|
|
"Return the subset of mapped devices that must be installed during boot,
|
|
|
|
|
from the initrd."
|
2014-11-30 11:50:07 -05:00
|
|
|
|
(let ((devices (operating-system-mapped-devices os))
|
|
|
|
|
(file-systems (operating-system-file-systems os)))
|
|
|
|
|
(filter (lambda (md)
|
2018-06-21 17:50:47 -04:00
|
|
|
|
(let ((users (mapped-device-users md file-systems)))
|
|
|
|
|
(any file-system-needed-for-boot? users)))
|
2014-11-30 11:50:07 -05:00
|
|
|
|
devices)))
|
2014-09-22 05:06:42 -04:00
|
|
|
|
|
2014-09-11 17:39:15 -04:00
|
|
|
|
(define (device-mapping-services os)
|
system: Make service procedures non-monadic.
* gnu/services/avahi.scm (configuration-file): Use 'plain-file' instead
of 'text-file'.
(avahi-service): Turn into a regular procedure that returns a <service>.
* gnu/services/base.scm (root-file-system-service, file-system-service,
user-unmount-service, user-processes-service, host-name-service,
console-keymap-service, console-font-service, mingetty-service,
nscd.conf-file, nscd-service): Likewise.
(%default-syslog.conf): New variable.
(syslog-service): Use it. Turn into a regular procedure.
(guix-service, udev-rules-union, kvm-udev-rule, udev-service,
device-mapping-service, swap-service): Likewise.
* gnu/services/databases.scm (%default-postgres-hba,
%default-postgres-ident): Use 'plain-file' instead of 'text-file'.
(%default-postgres-config): Use 'mixed-text-file' instead of
'text-file*'.
(postgresql-service): Use 'program-file' instead of 'gexp->script'.
Turn into a regular procedure.
* gnu/services/desktop.scm (dbus-configuration-directory): Use
'computed-file' instead of 'gexp->derivation'.
(upower-configuration-file, geoclue-configuration-file,
elogind-configuration-file): Use 'plain-file' instead of 'text-file'.
(dbus-service, upower-service, colord-service, geoclue-service,
polkit-service, elogind-service): Turn into regular procedures.
(%desktop-services): Remove use of 'mlet' when iterating on
%BASE-SERVICES.
* gnu/services/lirc.scm (lirc-service): Turn into a regular procedure.
* gnu/services/networking.scm (static-networking-service,
dhcp-client-service, ntp-service, tor-service, bitlbee-service,
wicd-service): Likewise.
* gnu/services/ssh.scm (lsh-service): Likewise.
* gnu/services/web.scm (nginx-service): Likewise.
* gnu/services/xorg.scm (xorg-configuration-file): Use 'mixed-text-file'
instead of 'text-file*'.
(xorg-start-command, slim-service): Turn into regular procedures.
(xinitrc): Use 'program-file' instead of 'gexp->script'.
* gnu/system/install.scm (cow-store-service,
configuration-template-service): Turn into regular procedures.
* gnu/system.scm (other-file-system-services, device-mapping-services,
swap-services, essential-services, operating-system-services,
user-shells, operating-system-accounts): Remove now unnecessary
'mlet' and turn into regular procedures.
(operating-system-etc-directory, operating-system-activation-script,
operating-system-boot-script): Adjust accordingly.
* doc/guix.texi (Base Services, Networking Services, X Window, Desktop
Services, Database Services, Web Services, Various Services, Name
Service Switch): Adjust accordingly.
2015-09-09 03:17:31 -04:00
|
|
|
|
"Return the list of device-mapping services for OS as a list."
|
2016-04-17 12:26:50 -04:00
|
|
|
|
(map device-mapping-service
|
system: Make service procedures non-monadic.
* gnu/services/avahi.scm (configuration-file): Use 'plain-file' instead
of 'text-file'.
(avahi-service): Turn into a regular procedure that returns a <service>.
* gnu/services/base.scm (root-file-system-service, file-system-service,
user-unmount-service, user-processes-service, host-name-service,
console-keymap-service, console-font-service, mingetty-service,
nscd.conf-file, nscd-service): Likewise.
(%default-syslog.conf): New variable.
(syslog-service): Use it. Turn into a regular procedure.
(guix-service, udev-rules-union, kvm-udev-rule, udev-service,
device-mapping-service, swap-service): Likewise.
* gnu/services/databases.scm (%default-postgres-hba,
%default-postgres-ident): Use 'plain-file' instead of 'text-file'.
(%default-postgres-config): Use 'mixed-text-file' instead of
'text-file*'.
(postgresql-service): Use 'program-file' instead of 'gexp->script'.
Turn into a regular procedure.
* gnu/services/desktop.scm (dbus-configuration-directory): Use
'computed-file' instead of 'gexp->derivation'.
(upower-configuration-file, geoclue-configuration-file,
elogind-configuration-file): Use 'plain-file' instead of 'text-file'.
(dbus-service, upower-service, colord-service, geoclue-service,
polkit-service, elogind-service): Turn into regular procedures.
(%desktop-services): Remove use of 'mlet' when iterating on
%BASE-SERVICES.
* gnu/services/lirc.scm (lirc-service): Turn into a regular procedure.
* gnu/services/networking.scm (static-networking-service,
dhcp-client-service, ntp-service, tor-service, bitlbee-service,
wicd-service): Likewise.
* gnu/services/ssh.scm (lsh-service): Likewise.
* gnu/services/web.scm (nginx-service): Likewise.
* gnu/services/xorg.scm (xorg-configuration-file): Use 'mixed-text-file'
instead of 'text-file*'.
(xorg-start-command, slim-service): Turn into regular procedures.
(xinitrc): Use 'program-file' instead of 'gexp->script'.
* gnu/system/install.scm (cow-store-service,
configuration-template-service): Turn into regular procedures.
* gnu/system.scm (other-file-system-services, device-mapping-services,
swap-services, essential-services, operating-system-services,
user-shells, operating-system-accounts): Remove now unnecessary
'mlet' and turn into regular procedures.
(operating-system-etc-directory, operating-system-activation-script,
operating-system-boot-script): Adjust accordingly.
* doc/guix.texi (Base Services, Networking Services, X Window, Desktop
Services, Database Services, Web Services, Various Services, Name
Service Switch): Adjust accordingly.
2015-09-09 03:17:31 -04:00
|
|
|
|
(operating-system-user-mapped-devices os)))
|
2014-09-11 17:39:15 -04:00
|
|
|
|
|
2014-09-18 16:51:48 -04:00
|
|
|
|
(define (swap-services os)
|
system: Make service procedures non-monadic.
* gnu/services/avahi.scm (configuration-file): Use 'plain-file' instead
of 'text-file'.
(avahi-service): Turn into a regular procedure that returns a <service>.
* gnu/services/base.scm (root-file-system-service, file-system-service,
user-unmount-service, user-processes-service, host-name-service,
console-keymap-service, console-font-service, mingetty-service,
nscd.conf-file, nscd-service): Likewise.
(%default-syslog.conf): New variable.
(syslog-service): Use it. Turn into a regular procedure.
(guix-service, udev-rules-union, kvm-udev-rule, udev-service,
device-mapping-service, swap-service): Likewise.
* gnu/services/databases.scm (%default-postgres-hba,
%default-postgres-ident): Use 'plain-file' instead of 'text-file'.
(%default-postgres-config): Use 'mixed-text-file' instead of
'text-file*'.
(postgresql-service): Use 'program-file' instead of 'gexp->script'.
Turn into a regular procedure.
* gnu/services/desktop.scm (dbus-configuration-directory): Use
'computed-file' instead of 'gexp->derivation'.
(upower-configuration-file, geoclue-configuration-file,
elogind-configuration-file): Use 'plain-file' instead of 'text-file'.
(dbus-service, upower-service, colord-service, geoclue-service,
polkit-service, elogind-service): Turn into regular procedures.
(%desktop-services): Remove use of 'mlet' when iterating on
%BASE-SERVICES.
* gnu/services/lirc.scm (lirc-service): Turn into a regular procedure.
* gnu/services/networking.scm (static-networking-service,
dhcp-client-service, ntp-service, tor-service, bitlbee-service,
wicd-service): Likewise.
* gnu/services/ssh.scm (lsh-service): Likewise.
* gnu/services/web.scm (nginx-service): Likewise.
* gnu/services/xorg.scm (xorg-configuration-file): Use 'mixed-text-file'
instead of 'text-file*'.
(xorg-start-command, slim-service): Turn into regular procedures.
(xinitrc): Use 'program-file' instead of 'gexp->script'.
* gnu/system/install.scm (cow-store-service,
configuration-template-service): Turn into regular procedures.
* gnu/system.scm (other-file-system-services, device-mapping-services,
swap-services, essential-services, operating-system-services,
user-shells, operating-system-accounts): Remove now unnecessary
'mlet' and turn into regular procedures.
(operating-system-etc-directory, operating-system-activation-script,
operating-system-boot-script): Adjust accordingly.
* doc/guix.texi (Base Services, Networking Services, X Window, Desktop
Services, Database Services, Web Services, Various Services, Name
Service Switch): Adjust accordingly.
2015-09-09 03:17:31 -04:00
|
|
|
|
"Return the list of swap services for OS."
|
|
|
|
|
(map swap-service (operating-system-swap-devices os)))
|
2014-09-18 16:51:48 -04:00
|
|
|
|
|
2019-08-21 03:19:58 -04:00
|
|
|
|
(define* (system-linux-image-file-name)
|
2016-09-09 17:27:00 -04:00
|
|
|
|
"Return the basename of the kernel image file for SYSTEM."
|
|
|
|
|
;; FIXME: Evaluate the conditional based on the actual current system.
|
2019-08-21 03:19:58 -04:00
|
|
|
|
(let ((target (or (%current-target-system) (%current-system))))
|
|
|
|
|
(cond
|
|
|
|
|
((string-prefix? "arm" target) "zImage")
|
|
|
|
|
((string-prefix? "mips" target) "vmlinuz")
|
|
|
|
|
((string-prefix? "aarch64" target) "Image")
|
|
|
|
|
(else "bzImage"))))
|
2016-09-09 17:27:00 -04:00
|
|
|
|
|
|
|
|
|
(define (operating-system-kernel-file os)
|
|
|
|
|
"Return an object representing the absolute file name of the kernel image of
|
|
|
|
|
OS."
|
|
|
|
|
(file-append (operating-system-kernel os)
|
2019-08-21 03:19:58 -04:00
|
|
|
|
"/" (system-linux-image-file-name)))
|
2016-09-09 17:27:00 -04:00
|
|
|
|
|
2020-04-22 16:58:11 -04:00
|
|
|
|
(define (package-for-kernel target-kernel module-package)
|
|
|
|
|
"Return a package like MODULE-PACKAGE, adapted for TARGET-KERNEL, if
|
|
|
|
|
possible (that is if there's a LINUX keyword argument in the build system)."
|
|
|
|
|
(package
|
|
|
|
|
(inherit module-package)
|
|
|
|
|
(arguments
|
|
|
|
|
(substitute-keyword-arguments (package-arguments module-package)
|
|
|
|
|
((#:linux kernel #f)
|
|
|
|
|
target-kernel)))))
|
|
|
|
|
|
2020-04-29 11:17:55 -04:00
|
|
|
|
(define %default-modprobe-blacklist
|
|
|
|
|
;; List of kernel modules to blacklist by default.
|
2020-05-01 05:08:07 -04:00
|
|
|
|
'("usbmouse" ;races with bcm5974, see <https://bugs.gnu.org/35574>
|
|
|
|
|
"usbkbd")) ;races with usbhid, see <https://issues.guix.gnu.org/35574#18>
|
2020-04-29 11:17:55 -04:00
|
|
|
|
|
|
|
|
|
(define %default-kernel-arguments
|
|
|
|
|
;; Default arguments passed to the kernel.
|
|
|
|
|
(list (string-append "modprobe.blacklist="
|
|
|
|
|
(string-join %default-modprobe-blacklist ","))
|
|
|
|
|
"quiet"))
|
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(define* (operating-system-directory-base-entries os)
|
2015-11-02 12:44:17 -05:00
|
|
|
|
"Return the basic entries of the 'system' directory of OS for use as the
|
|
|
|
|
value of the SYSTEM-SERVICE-TYPE service."
|
2020-04-22 09:51:26 -04:00
|
|
|
|
(let* ((locale (operating-system-locale-directory os))
|
|
|
|
|
(kernel (operating-system-kernel os))
|
|
|
|
|
(modules (operating-system-kernel-loadable-modules os))
|
|
|
|
|
(kernel (profile
|
|
|
|
|
(content (packages->manifest
|
|
|
|
|
(cons kernel
|
|
|
|
|
(map (lambda (module)
|
|
|
|
|
(if (package? module)
|
|
|
|
|
(package-for-kernel kernel
|
|
|
|
|
module)
|
|
|
|
|
module))
|
|
|
|
|
modules))))
|
|
|
|
|
(hooks (list linux-module-database))))
|
|
|
|
|
(initrd (operating-system-initrd-file os))
|
|
|
|
|
(params (operating-system-boot-parameters-file os)))
|
2020-04-22 10:22:33 -04:00
|
|
|
|
`(("kernel" ,kernel)
|
|
|
|
|
("parameters" ,params)
|
|
|
|
|
("initrd" ,initrd)
|
|
|
|
|
("locale" ,locale)))) ;used by libc
|
2019-03-22 12:48:37 -04:00
|
|
|
|
|
2019-05-10 11:45:06 -04:00
|
|
|
|
(define (operating-system-default-essential-services os)
|
2014-05-09 16:58:46 -04:00
|
|
|
|
"Return the list of essential services for OS. These are special services
|
|
|
|
|
that implement part of what's declared in OS are responsible for low-level
|
2019-03-22 12:48:37 -04:00
|
|
|
|
bookkeeping."
|
2014-11-10 16:25:39 -05:00
|
|
|
|
(define known-fs
|
|
|
|
|
(map file-system-mount-point (operating-system-file-systems os)))
|
|
|
|
|
|
system: Make service procedures non-monadic.
* gnu/services/avahi.scm (configuration-file): Use 'plain-file' instead
of 'text-file'.
(avahi-service): Turn into a regular procedure that returns a <service>.
* gnu/services/base.scm (root-file-system-service, file-system-service,
user-unmount-service, user-processes-service, host-name-service,
console-keymap-service, console-font-service, mingetty-service,
nscd.conf-file, nscd-service): Likewise.
(%default-syslog.conf): New variable.
(syslog-service): Use it. Turn into a regular procedure.
(guix-service, udev-rules-union, kvm-udev-rule, udev-service,
device-mapping-service, swap-service): Likewise.
* gnu/services/databases.scm (%default-postgres-hba,
%default-postgres-ident): Use 'plain-file' instead of 'text-file'.
(%default-postgres-config): Use 'mixed-text-file' instead of
'text-file*'.
(postgresql-service): Use 'program-file' instead of 'gexp->script'.
Turn into a regular procedure.
* gnu/services/desktop.scm (dbus-configuration-directory): Use
'computed-file' instead of 'gexp->derivation'.
(upower-configuration-file, geoclue-configuration-file,
elogind-configuration-file): Use 'plain-file' instead of 'text-file'.
(dbus-service, upower-service, colord-service, geoclue-service,
polkit-service, elogind-service): Turn into regular procedures.
(%desktop-services): Remove use of 'mlet' when iterating on
%BASE-SERVICES.
* gnu/services/lirc.scm (lirc-service): Turn into a regular procedure.
* gnu/services/networking.scm (static-networking-service,
dhcp-client-service, ntp-service, tor-service, bitlbee-service,
wicd-service): Likewise.
* gnu/services/ssh.scm (lsh-service): Likewise.
* gnu/services/web.scm (nginx-service): Likewise.
* gnu/services/xorg.scm (xorg-configuration-file): Use 'mixed-text-file'
instead of 'text-file*'.
(xorg-start-command, slim-service): Turn into regular procedures.
(xinitrc): Use 'program-file' instead of 'gexp->script'.
* gnu/system/install.scm (cow-store-service,
configuration-template-service): Turn into regular procedures.
* gnu/system.scm (other-file-system-services, device-mapping-services,
swap-services, essential-services, operating-system-services,
user-shells, operating-system-accounts): Remove now unnecessary
'mlet' and turn into regular procedures.
(operating-system-etc-directory, operating-system-activation-script,
operating-system-boot-script): Adjust accordingly.
* doc/guix.texi (Base Services, Networking Services, X Window, Desktop
Services, Database Services, Web Services, Various Services, Name
Service Switch): Adjust accordingly.
2015-09-09 03:17:31 -04:00
|
|
|
|
(let* ((mappings (device-mapping-services os))
|
|
|
|
|
(root-fs (root-file-system-service))
|
2016-08-21 12:50:14 -04: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 03:17:31 -04:00
|
|
|
|
(swaps (swap-services os))
|
2017-12-20 05:05:11 -05:00
|
|
|
|
(procs (service user-processes-service-type))
|
2015-11-02 12:44:17 -05:00
|
|
|
|
(host-name (host-name-service (operating-system-host-name os)))
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(entries (operating-system-directory-base-entries os)))
|
2015-11-02 12:44:17 -05:00
|
|
|
|
(cons* (service system-service-type entries)
|
|
|
|
|
%boot-service
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
|
2018-06-20 03:44:27 -04:00
|
|
|
|
;; %SHEPHERD-ROOT-SERVICE must come last so that the gexp that
|
services: Rename 'dmd' services to 'shepherd'.
* gnu/services/shepherd.scm (dmd-root-service-type, %dmd-root-service)
(dmd-service-type, <dmd-service>, dmd-service, dmd-service?)
(make-dmd-service, dmd-service-documentation, dmd-service-provision)
(dmd-service-requirement, dmd-service-respawn, dmd-service-start)
(dmd-service-stop, dmd-service-auto-start?, dmd-service-modules)
(dmd-service-imported-modules, dmd-service-file-name, dmd-service-file)
(dmd-service-back-edges): Rename to...
(shepherd-root-service-type, %shepherd-root-service, shepherd-service-type)
(<shepherd-service>, shepherd-service, shepherd-service?)
(make-shepherd-service, shepherd-service-documentation)
(shepherd-service-provision, shepherd-service-requirement)
(shepherd-service-respawn, shepherd-service-start)
(shepherd-service-stop, shepherd-service-auto-start?)
(shepherd-service-modules, shepherd-service-imported-modules)
(shepherd-service-file-name, shepherd-service-file)
(shepherd-service-back-edges): ...this
* gnu/services.scm: Adjust comments.
* gnu/services/avahi.scm (avahi-dmd-service): Rename to...
(avahi-shepherd-service): ... this.
* gnu/services/base.scm (%root-file-system-dmd-service)
(file-system->dmd-service-name, mapped-device->dmd-service-name)
(dependency->dmd-service-name, file-system-dmd-service)
(mingetty-dmd-service, nscd-dmd-service, guix-dmd-service)
(guix-publish-dmd-service, udev-dmd-service, gpm-dmd-service): Rename to...
(%root-file-system-shepherd-service)
(file-system->shepherd-service-name, mapped-device->shepherd-service-name)
(dependency->shepherd-service-name, file-system-shepherd-service)
(mingetty-shepherd-service, nscd-shepherd-service, guix-shepherd-service)
(guix-publish-shepherd-service, udev-shepherd-service)
(gpm-shepherd-service): ... this.
* gnu/services/databases.scm (postgresql-dmd-service): Rename to...
(postgresql-shepherd-service): ... this.
* gnu/services/desktop.scm (upower-dmd-service, elogind-dmd-service):
Rename to...
(upower-shepherd-service, elogind-shepherd-service): ... this.
* gnu/services/dbus.scm (dbus-dmd-service): Rename to...
(dbus-shepherd-service): ... this.
* gnu/services/lirc.scm (lirc-dmd-service): Rename to...
(lirc-shepherd-service): ... this.
* gnu/services/mail.scm (dovecot-dmd-service): Rename to...
(dovecot-shepherd-service): ... this.
* gnu/services/networking.scm (ntp-dmd-service, tor-dmd-service)
(bitlbee-dmd-service, wicd-dmd-service, network-manager-dmd-service): Rename to...
(dbus-shepherd-service): ... this.
* gnu/services/ssh.scm (lsh-dmd-service): Rename to...
(lsh-shepherd-service): ... this.
* gnu/services/web.scm (nginx-dmd-service): Rename to...
(nginx-shepherd-service): ... this.
* gnu/services/xorg.scm (slim-dmd-service): Rename to...
(slim-shepherd-service): ... this.
* gnu/system.scm (essential-services): Use '%shepherd-root-service'.
* gnu/system/install.scm (cow-store-service-type): Adjust accordingly.
* guix/scripts/system.scm (dmd-service-node-label, dmd-service-node-type)
(export-dmd-graph): Likewise.
* tests/guix-system.sh: Likewise.
* tests/services.scm ("dmd-service-back-edges"): Rename to...
("shepherd-service-back-edges"): Adjust accordingly.
* doc/guix.texi: Likewise.
* doc/images/service-graph.dot: Use 'shepherd' service name.
2016-01-27 15:02:31 -05:00
|
|
|
|
;; execs shepherd comes last in the boot script (XXX). Likewise,
|
2018-06-20 03:44:27 -04:00
|
|
|
|
;; the cleanup service must come first so that its gexp runs before
|
services: Rename 'dmd' services to 'shepherd'.
* gnu/services/shepherd.scm (dmd-root-service-type, %dmd-root-service)
(dmd-service-type, <dmd-service>, dmd-service, dmd-service?)
(make-dmd-service, dmd-service-documentation, dmd-service-provision)
(dmd-service-requirement, dmd-service-respawn, dmd-service-start)
(dmd-service-stop, dmd-service-auto-start?, dmd-service-modules)
(dmd-service-imported-modules, dmd-service-file-name, dmd-service-file)
(dmd-service-back-edges): Rename to...
(shepherd-root-service-type, %shepherd-root-service, shepherd-service-type)
(<shepherd-service>, shepherd-service, shepherd-service?)
(make-shepherd-service, shepherd-service-documentation)
(shepherd-service-provision, shepherd-service-requirement)
(shepherd-service-respawn, shepherd-service-start)
(shepherd-service-stop, shepherd-service-auto-start?)
(shepherd-service-modules, shepherd-service-imported-modules)
(shepherd-service-file-name, shepherd-service-file)
(shepherd-service-back-edges): ...this
* gnu/services.scm: Adjust comments.
* gnu/services/avahi.scm (avahi-dmd-service): Rename to...
(avahi-shepherd-service): ... this.
* gnu/services/base.scm (%root-file-system-dmd-service)
(file-system->dmd-service-name, mapped-device->dmd-service-name)
(dependency->dmd-service-name, file-system-dmd-service)
(mingetty-dmd-service, nscd-dmd-service, guix-dmd-service)
(guix-publish-dmd-service, udev-dmd-service, gpm-dmd-service): Rename to...
(%root-file-system-shepherd-service)
(file-system->shepherd-service-name, mapped-device->shepherd-service-name)
(dependency->shepherd-service-name, file-system-shepherd-service)
(mingetty-shepherd-service, nscd-shepherd-service, guix-shepherd-service)
(guix-publish-shepherd-service, udev-shepherd-service)
(gpm-shepherd-service): ... this.
* gnu/services/databases.scm (postgresql-dmd-service): Rename to...
(postgresql-shepherd-service): ... this.
* gnu/services/desktop.scm (upower-dmd-service, elogind-dmd-service):
Rename to...
(upower-shepherd-service, elogind-shepherd-service): ... this.
* gnu/services/dbus.scm (dbus-dmd-service): Rename to...
(dbus-shepherd-service): ... this.
* gnu/services/lirc.scm (lirc-dmd-service): Rename to...
(lirc-shepherd-service): ... this.
* gnu/services/mail.scm (dovecot-dmd-service): Rename to...
(dovecot-shepherd-service): ... this.
* gnu/services/networking.scm (ntp-dmd-service, tor-dmd-service)
(bitlbee-dmd-service, wicd-dmd-service, network-manager-dmd-service): Rename to...
(dbus-shepherd-service): ... this.
* gnu/services/ssh.scm (lsh-dmd-service): Rename to...
(lsh-shepherd-service): ... this.
* gnu/services/web.scm (nginx-dmd-service): Rename to...
(nginx-shepherd-service): ... this.
* gnu/services/xorg.scm (slim-dmd-service): Rename to...
(slim-shepherd-service): ... this.
* gnu/system.scm (essential-services): Use '%shepherd-root-service'.
* gnu/system/install.scm (cow-store-service-type): Adjust accordingly.
* guix/scripts/system.scm (dmd-service-node-label, dmd-service-node-type)
(export-dmd-graph): Likewise.
* tests/guix-system.sh: Likewise.
* tests/services.scm ("dmd-service-back-edges"): Rename to...
("shepherd-service-back-edges"): Adjust accordingly.
* doc/guix.texi: Likewise.
* doc/images/service-graph.dot: Use 'shepherd' service name.
2016-01-27 15:02:31 -05:00
|
|
|
|
;; activation code.
|
2016-01-04 16:58:05 -05:00
|
|
|
|
(service cleanup-service-type #f)
|
2018-06-20 03:44:27 -04:00
|
|
|
|
%activation-service
|
|
|
|
|
%shepherd-root-service
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
|
|
|
|
|
(pam-root-service (operating-system-pam-services os))
|
|
|
|
|
(account-service (append (operating-system-accounts os)
|
|
|
|
|
(operating-system-groups os))
|
|
|
|
|
(operating-system-skeletons os))
|
|
|
|
|
(operating-system-etc-service os)
|
2019-04-26 17:53:53 -04:00
|
|
|
|
(service fstab-service-type
|
|
|
|
|
(filter file-system-needed-for-boot?
|
|
|
|
|
(operating-system-file-systems os)))
|
2015-12-02 08:14:02 -05:00
|
|
|
|
(session-environment-service
|
|
|
|
|
(operating-system-environment-variables os))
|
2018-03-07 04:00:07 -05: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 17:44:26 -04:00
|
|
|
|
(service setuid-program-service-type
|
|
|
|
|
(operating-system-setuid-programs os))
|
2015-11-02 15:52:28 -05:00
|
|
|
|
(service profile-service-type
|
|
|
|
|
(operating-system-packages os))
|
2016-08-21 12:50:14 -04: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 17:44:26 -04:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
;; Add the firmware service.
|
|
|
|
|
(list %linux-bare-metal-service
|
|
|
|
|
(service firmware-service-type
|
|
|
|
|
(operating-system-firmware os)))))))
|
|
|
|
|
|
|
|
|
|
(define* (operating-system-services os)
|
|
|
|
|
"Return all the services of OS, including \"essential\" services."
|
2018-01-20 18:05:09 -05:00
|
|
|
|
(instantiate-missing-services
|
|
|
|
|
(append (operating-system-user-services os)
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(operating-system-essential-services os))))
|
2014-05-09 16:58:46 -04:00
|
|
|
|
|
2019-05-10 16:29:10 -04:00
|
|
|
|
(define (operating-system-with-gc-roots os roots)
|
|
|
|
|
"Return a variant of OS where ROOTS are registered as GC roots."
|
|
|
|
|
(operating-system
|
|
|
|
|
(inherit os)
|
|
|
|
|
|
|
|
|
|
;; We use this procedure for the installation OS, which already defines GC
|
|
|
|
|
;; roots. Add ROOTS to those.
|
|
|
|
|
(services (cons (simple-service 'extra-root
|
|
|
|
|
gc-root-service-type roots)
|
|
|
|
|
(operating-system-user-services os)))))
|
|
|
|
|
|
2019-11-30 12:05:07 -05:00
|
|
|
|
(define* (operating-system-with-provenance os #:optional config-file)
|
|
|
|
|
"Return a variant of OS that stores its own provenance information,
|
|
|
|
|
including CONFIG-FILE, if available. This is achieved by adding an instance
|
|
|
|
|
of PROVENANCE-SERVICE-TYPE to its services."
|
|
|
|
|
(operating-system
|
|
|
|
|
(inherit os)
|
|
|
|
|
(services (cons (service provenance-service-type config-file)
|
|
|
|
|
(operating-system-user-services os)))))
|
|
|
|
|
|
2014-05-12 17:37:13 -04:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; /etc.
|
|
|
|
|
;;;
|
|
|
|
|
|
2014-11-11 16:42:15 -05:00
|
|
|
|
(define %base-firmware
|
|
|
|
|
;; Firmware usable by default.
|
2016-11-19 14:25:02 -05:00
|
|
|
|
(list ath9k-htc-firmware
|
|
|
|
|
openfwwf-firmware))
|
2014-11-11 16:42:15 -05:00
|
|
|
|
|
2020-04-04 03:59:48 -04:00
|
|
|
|
(define %base-packages-utils
|
|
|
|
|
;; Default set of utilities packages.
|
|
|
|
|
(cons* procps psmisc which
|
|
|
|
|
(@ (gnu packages admin) shadow) ;for 'passwd'
|
|
|
|
|
|
2020-04-23 07:33:09 -04:00
|
|
|
|
guile-3.0
|
2020-04-04 03:59:48 -04:00
|
|
|
|
|
|
|
|
|
;; The packages below are also in %FINAL-INPUTS, so take them from
|
|
|
|
|
;; there to avoid duplication.
|
2020-04-23 07:33:09 -04:00
|
|
|
|
(list bash coreutils findutils grep sed
|
|
|
|
|
diffutils patch gawk tar gzip bzip2 xz lzip)))
|
2020-04-04 03:59:48 -04:00
|
|
|
|
|
|
|
|
|
(define %base-packages-linux
|
|
|
|
|
;; Default set of linux specific packages.
|
|
|
|
|
(list pciutils usbutils
|
|
|
|
|
util-linux+udev
|
|
|
|
|
;; Get 'insmod' & co. from kmod, not module-init-tools, since udev
|
|
|
|
|
;; already depends on it anyway.
|
|
|
|
|
kmod eudev))
|
|
|
|
|
|
|
|
|
|
(define %base-packages-interactive
|
|
|
|
|
;; Default set of common interactive packages.
|
|
|
|
|
(list less zile nano
|
|
|
|
|
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
|
|
|
|
|
;; 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))
|
|
|
|
|
|
2014-06-04 08:59:24 -04:00
|
|
|
|
(define %base-packages
|
|
|
|
|
;; Default set of packages globally visible. It should include anything
|
|
|
|
|
;; required for basic administrator tasks.
|
2020-04-04 03:59:48 -04:00
|
|
|
|
(append (list e2fsprogs)
|
|
|
|
|
%base-packages-interactive
|
|
|
|
|
%base-packages-linux
|
|
|
|
|
%base-packages-networking
|
|
|
|
|
%base-packages-utils))
|
2014-06-04 08:59:24 -04:00
|
|
|
|
|
2014-05-31 16:01:05 -04:00
|
|
|
|
(define %default-issue
|
|
|
|
|
;; Default contents for /etc/issue.
|
|
|
|
|
"
|
|
|
|
|
This is the GNU system. Welcome.\n")
|
|
|
|
|
|
2014-10-07 15:17:22 -04: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 16:03:24 -04:00
|
|
|
|
(define (default-/etc/hosts host-name)
|
|
|
|
|
"Return the default /etc/hosts file."
|
2015-06-05 16:41:55 -04:00
|
|
|
|
(plain-file "hosts" (local-host-aliases host-name)))
|
2014-09-11 16:03:24 -04:00
|
|
|
|
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
(define* (operating-system-etc-service os)
|
|
|
|
|
"Return a <service> that builds containing the static part of the /etc
|
|
|
|
|
directory."
|
2018-04-08 14:30:05 -04:00
|
|
|
|
(let ((login.defs
|
|
|
|
|
(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:"
|
|
|
|
|
"/run/current-system/profile/sbin\n")))
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
|
|
|
|
|
(issue (plain-file "issue" (operating-system-issue os)))
|
|
|
|
|
(nsswitch (plain-file "nsswitch.conf"
|
|
|
|
|
(name-service-switch->string
|
|
|
|
|
(operating-system-name-service-switch os))))
|
|
|
|
|
|
|
|
|
|
;; Startup file for POSIX-compliant login shells, which set system-wide
|
|
|
|
|
;; environment variables.
|
|
|
|
|
(profile (mixed-text-file "profile" "\
|
2015-07-07 14:24:57 -04:00
|
|
|
|
# Crucial variables that could be missing in the profiles' 'etc/profile'
|
2015-05-06 12:23:27 -04:00
|
|
|
|
# because they would require combining both profiles.
|
|
|
|
|
# FIXME: See <http://bugs.gnu.org/20255>.
|
2014-12-12 17:52:27 -05:00
|
|
|
|
export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/man
|
2018-06-12 09:04:52 -04:00
|
|
|
|
export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
|
2015-01-27 00:37:53 -05:00
|
|
|
|
export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share
|
|
|
|
|
export XDG_CONFIG_DIRS=$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg
|
|
|
|
|
|
2017-10-08 11:21:09 -04:00
|
|
|
|
# Make sure libXcursor finds cursors installed into user or system profiles. See <http://bugs.gnu.org/24445>
|
|
|
|
|
export XCURSOR_PATH=$HOME/.icons:$HOME/.guix-profile/share/icons:/run/current-system/profile/share/icons
|
|
|
|
|
|
2015-05-06 12:23:27 -04:00
|
|
|
|
# Ignore the default value of 'PATH'.
|
|
|
|
|
unset PATH
|
|
|
|
|
|
|
|
|
|
# Load the system profile's settings.
|
2017-11-20 12:41:47 -05:00
|
|
|
|
GUIX_PROFILE=/run/current-system/profile ; \\
|
2015-05-07 03:45:45 -04:00
|
|
|
|
. /run/current-system/profile/etc/profile
|
2015-05-06 12:23:27 -04:00
|
|
|
|
|
2016-07-27 08:27:00 -04:00
|
|
|
|
# Since 'lshd' does not use pam_env, /etc/environment must be explicitly
|
|
|
|
|
# loaded when someone logs in via SSH. See <http://bugs.gnu.org/22175>.
|
|
|
|
|
# We need 'PATH' to be defined here, for 'cat' and 'cut'. Do this before
|
|
|
|
|
# reading the user's 'etc/profile' to allow variables to be overridden.
|
|
|
|
|
if [ -f /etc/environment -a -n \"$SSH_CLIENT\" \\
|
|
|
|
|
-a -z \"$LINUX_MODULE_DIRECTORY\" ]
|
|
|
|
|
then
|
|
|
|
|
. /etc/environment
|
|
|
|
|
export `cat /etc/environment | cut -d= -f1`
|
|
|
|
|
fi
|
|
|
|
|
|
2018-06-12 09:04:52 -04:00
|
|
|
|
# Arrange so that ~/.config/guix/current comes first.
|
|
|
|
|
for profile in \"$HOME/.guix-profile\" \"$HOME/.config/guix/current\"
|
2018-06-09 04:36:38 -04:00
|
|
|
|
do
|
|
|
|
|
if [ -f \"$profile/etc/profile\" ]
|
|
|
|
|
then
|
|
|
|
|
# Load the user profile's settings.
|
|
|
|
|
GUIX_PROFILE=\"$profile\" ; \\
|
|
|
|
|
. \"$profile/etc/profile\"
|
|
|
|
|
else
|
|
|
|
|
# At least define this one so that basic things just work
|
|
|
|
|
# when the user installs their first package.
|
|
|
|
|
export PATH=\"$profile/bin:$PATH\"
|
|
|
|
|
fi
|
|
|
|
|
done
|
2015-05-06 12:23:27 -04:00
|
|
|
|
|
2018-06-18 16:57:22 -04:00
|
|
|
|
# Prepend setuid programs.
|
|
|
|
|
export PATH=/run/setuid-programs:$PATH
|
|
|
|
|
|
2018-06-12 09:04:52 -04:00
|
|
|
|
# Arrange so that ~/.config/guix/current/share/info comes first.
|
|
|
|
|
export INFOPATH=\"$HOME/.config/guix/current/share/info:$INFOPATH\"
|
|
|
|
|
|
2016-03-08 17:30:53 -05:00
|
|
|
|
# Set the umask, notably for users logging in via 'lsh'.
|
|
|
|
|
# See <http://bugs.gnu.org/22650>.
|
|
|
|
|
umask 022
|
2016-02-03 03:07:35 -05:00
|
|
|
|
|
2017-09-18 03:50:52 -04:00
|
|
|
|
# Allow Hunspell-based applications (IceCat, LibreOffice, etc.) to
|
|
|
|
|
# find dictionaries.
|
|
|
|
|
export DICPATH=\"$HOME/.guix-profile/share/hunspell:/run/current-system/profile/share/hunspell\"
|
|
|
|
|
|
2015-10-15 17:06:20 -04:00
|
|
|
|
# Allow GStreamer-based applications to find plugins.
|
|
|
|
|
export GST_PLUGIN_PATH=\"$HOME/.guix-profile/lib/gstreamer-1.0\"
|
|
|
|
|
|
2015-03-12 17:11:18 -04:00
|
|
|
|
if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ]
|
|
|
|
|
then
|
|
|
|
|
# Load Bash-specific initialization code.
|
2015-05-07 03:45:45 -04:00
|
|
|
|
. /etc/bashrc
|
2015-03-12 17:11:18 -04:00
|
|
|
|
fi
|
2014-05-12 17:37:13 -04:00
|
|
|
|
"))
|
2015-03-12 17:11:18 -04:00
|
|
|
|
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
(bashrc (plain-file "bashrc" "\
|
2015-03-12 17:11:18 -04:00
|
|
|
|
# Bash-specific initialization.
|
|
|
|
|
|
|
|
|
|
# The 'bash-completion' package.
|
|
|
|
|
if [ -f /run/current-system/profile/etc/profile.d/bash_completion.sh ]
|
|
|
|
|
then
|
|
|
|
|
# Bash-completion sources ~/.bash_completion. It installs a dynamic
|
|
|
|
|
# completion loader that searches its own completion files as well
|
|
|
|
|
# as those in ~/.guix-profile and /run/current-system/profile.
|
|
|
|
|
source /run/current-system/profile/etc/profile.d/bash_completion.sh
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
fi\n")))
|
|
|
|
|
(etc-service
|
system: Use 'file-append' to denote file names.
* gnu/services/avahi.scm, gnu/services/base.scm,
gnu/services/databases.scm, gnu/services/dbus.scm,
gnu/services/desktop.scm, gnu/services/dict.scm,
gnu/services/mail.scm, gnu/services/networking.scm,
gnu/services/sddm.scm, gnu/services/spice.scm,
gnu/services/ssh.scm, gnu/services/web.scm,
gnu/services/xorg.scm, gnu/system.scm: Replace the
#~(string-append #$pkg "/bin/foo") idiom with
(file-append pkg "/bin/foo").
2016-09-10 06:03:47 -04:00
|
|
|
|
`(("services" ,(file-append net-base "/etc/services"))
|
|
|
|
|
("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 17:44:26 -04:00
|
|
|
|
("login.defs" ,#~#$login.defs)
|
|
|
|
|
("issue" ,#~#$issue)
|
|
|
|
|
("nsswitch.conf" ,#~#$nsswitch)
|
|
|
|
|
("profile" ,#~#$profile)
|
|
|
|
|
("bashrc" ,#~#$bashrc)
|
|
|
|
|
("hosts" ,#~#$(or (operating-system-hosts-file os)
|
|
|
|
|
(default-/etc/hosts (operating-system-host-name os))))
|
2017-09-16 07:54:40 -04:00
|
|
|
|
;; Write the operating-system-host-name to /etc/hostname to prevent
|
|
|
|
|
;; NetworkManager from changing the system's hostname when connecting
|
|
|
|
|
;; to certain networks. Some discussion at
|
|
|
|
|
;; https://lists.gnu.org/archive/html/help-guix/2017-09/msg00037.html
|
|
|
|
|
("hostname" ,(plain-file "hostname" (operating-system-host-name os)))
|
2019-07-16 10:04:58 -04:00
|
|
|
|
;; Some programs (e.g., GLib) look at /etc/timezone to find the
|
|
|
|
|
;; name of the current timezone. For details, see
|
|
|
|
|
;; https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00166.html
|
|
|
|
|
("timezone" ,(plain-file "timezone" (operating-system-timezone os)))
|
system: Use 'file-append' to denote file names.
* gnu/services/avahi.scm, gnu/services/base.scm,
gnu/services/databases.scm, gnu/services/dbus.scm,
gnu/services/desktop.scm, gnu/services/dict.scm,
gnu/services/mail.scm, gnu/services/networking.scm,
gnu/services/sddm.scm, gnu/services/spice.scm,
gnu/services/ssh.scm, gnu/services/web.scm,
gnu/services/xorg.scm, gnu/system.scm: Replace the
#~(string-append #$pkg "/bin/foo") idiom with
(file-append pkg "/bin/foo").
2016-09-10 06:03:47 -04:00
|
|
|
|
("localtime" ,(file-append tzdata "/share/zoneinfo/"
|
|
|
|
|
(operating-system-timezone os)))
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
("sudoers" ,(operating-system-sudoers-file os))))))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
system: Make accounts and groups at activation time.
* gnu/services/base.scm (guix-build-accounts): Remove #:gid parameter;
add #:group. Remove 'password' and 'gid' fields in 'user-account'
form, and add 'group'.
(guix-service): Remove #:build-user-gid parameter. Remove 'id' field
in 'user-group' form.
* gnu/system.scm (etc-directory): Remove #:groups and #:accounts. No
longer produce files "passwd", "shadow", and "group". Adjust caller
accordingly.
(%root-account): New variable.
(operating-system-accounts): Add 'users' variable. Add %ROOT-ACCOUNT
only of 'operating-system-users' doesn't already contain a root
account.
(user-group->gexp, user-account->gexp): New procedures.
(operating-system-boot-script): Add calls to 'setenv' and
'activate-users+groups' in gexp.
* gnu/system/linux.scm (base-pam-services): Add PAM services for
"user{add,del,mode}" and "group{add,del,mod}".
* gnu/system/shadow.scm (<user-account>)[gid]: Rename to...
[group]: ... this.
[supplementary-groups]: New field.
[uid, password]: Default to #f.
(<user-group>)[id]: Default to #f.
(group-file, passwd-file): Remove.
* gnu/system/vm.scm (operating-system-default-contents)[user-directories]:
Remove. Add "/home" to the directives.
* guix/build/activation.scm (add-group, add-user,
activate-users+groups): New procedures.
2014-05-11 16:41:01 -04:00
|
|
|
|
(define %root-account
|
|
|
|
|
;; Default root account.
|
|
|
|
|
(user-account
|
|
|
|
|
(name "root")
|
|
|
|
|
(password "")
|
|
|
|
|
(uid 0) (group "root")
|
|
|
|
|
(comment "System administrator")
|
|
|
|
|
(home-directory "/root")))
|
|
|
|
|
|
2014-04-23 09:47:42 -04:00
|
|
|
|
(define (operating-system-accounts os)
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
"Return the user accounts for OS, including an obligatory 'root' account,
|
|
|
|
|
and excluding accounts requested by services."
|
|
|
|
|
;; Make sure there's a root account.
|
|
|
|
|
(if (find (lambda (user)
|
|
|
|
|
(and=> (user-account-uid user) zero?))
|
|
|
|
|
(operating-system-users os))
|
|
|
|
|
(operating-system-users os)
|
|
|
|
|
(cons %root-account (operating-system-users os))))
|
2014-04-23 09:47:42 -04:00
|
|
|
|
|
2015-06-05 14:22:47 -04:00
|
|
|
|
(define (maybe-string->file file-name thing)
|
|
|
|
|
"If THING is a string, return a <plain-file> with THING as its content.
|
|
|
|
|
Otherwise just return THING.
|
|
|
|
|
|
|
|
|
|
This is for backward-compatibility of fields that used to be strings and are
|
|
|
|
|
now file-like objects.."
|
|
|
|
|
(match thing
|
|
|
|
|
((? string?)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(warning (G_ "using a string for file '~a' is deprecated; \
|
2015-06-05 14:22:47 -04:00
|
|
|
|
use 'plain-file' instead~%")
|
|
|
|
|
file-name)
|
|
|
|
|
(plain-file file-name thing))
|
|
|
|
|
(x
|
|
|
|
|
x)))
|
|
|
|
|
|
2015-06-05 16:41:55 -04:00
|
|
|
|
(define (maybe-file->monadic file-name thing)
|
|
|
|
|
"If THING is a value in %STORE-MONAD, return it as is; otherwise return
|
|
|
|
|
THING in the %STORE-MONAD.
|
|
|
|
|
|
|
|
|
|
This is for backward-compatibility of fields that used to be monadic values
|
|
|
|
|
and are now file-like objects."
|
|
|
|
|
(with-monad %store-monad
|
|
|
|
|
(match thing
|
|
|
|
|
((? procedure?)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(warning (G_ "using a monadic value for '~a' is deprecated; \
|
2015-06-05 16:41:55 -04:00
|
|
|
|
use 'plain-file' instead~%")
|
|
|
|
|
file-name)
|
|
|
|
|
thing)
|
|
|
|
|
(x
|
|
|
|
|
(return x)))))
|
|
|
|
|
|
2014-04-23 09:47:42 -04:00
|
|
|
|
(define (operating-system-etc-directory os)
|
|
|
|
|
"Return that static part of the /etc directory of OS."
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
(etc-directory
|
|
|
|
|
(fold-services (operating-system-services os)
|
|
|
|
|
#:target-type etc-service-type)))
|
2013-12-09 15:32:36 -05:00
|
|
|
|
|
2015-12-02 08:14:02 -05:00
|
|
|
|
(define (operating-system-environment-variables os)
|
|
|
|
|
"Return the environment variables of OS for
|
|
|
|
|
@var{session-environment-service-type}, to be used in @file{/etc/environment}."
|
|
|
|
|
`(("LANG" . ,(operating-system-locale os))
|
2017-11-09 03:58:33 -05:00
|
|
|
|
;; Note: No need to set 'TZ' since (1) we provide /etc/localtime, and (2)
|
|
|
|
|
;; it doesn't work for setuid binaries. See <https://bugs.gnu.org/29212>.
|
system: Use 'file-append' to denote file names.
* gnu/services/avahi.scm, gnu/services/base.scm,
gnu/services/databases.scm, gnu/services/dbus.scm,
gnu/services/desktop.scm, gnu/services/dict.scm,
gnu/services/mail.scm, gnu/services/networking.scm,
gnu/services/sddm.scm, gnu/services/spice.scm,
gnu/services/ssh.scm, gnu/services/web.scm,
gnu/services/xorg.scm, gnu/system.scm: Replace the
#~(string-append #$pkg "/bin/foo") idiom with
(file-append pkg "/bin/foo").
2016-09-10 06:03:47 -04:00
|
|
|
|
("TZDIR" . ,(file-append tzdata "/share/zoneinfo"))
|
2015-12-02 08:14:02 -05:00
|
|
|
|
;; Tell 'modprobe' & co. where to look for modules.
|
|
|
|
|
("LINUX_MODULE_DIRECTORY" . "/run/booted-system/kernel/lib/modules")
|
|
|
|
|
;; These variables are honored by OpenSSL (libssl) and Git.
|
|
|
|
|
("SSL_CERT_DIR" . "/etc/ssl/certs")
|
|
|
|
|
("SSL_CERT_FILE" . "/etc/ssl/certs/ca-certificates.crt")
|
|
|
|
|
("GIT_SSL_CAINFO" . "/etc/ssl/certs/ca-certificates.crt")
|
2016-04-04 16:27:15 -04:00
|
|
|
|
|
|
|
|
|
;; 'GTK_DATA_PREFIX' must name one directory where GTK+ themes are
|
|
|
|
|
;; searched for.
|
|
|
|
|
("GTK_DATA_PREFIX" . "/run/current-system/profile")
|
|
|
|
|
|
2015-12-02 08:14:02 -05:00
|
|
|
|
;; By default, applications that use D-Bus, such as Emacs, abort at startup
|
|
|
|
|
;; when /etc/machine-id is missing. Make sure these warnings are non-fatal.
|
2016-11-08 17:20:11 -05: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 08:14:02 -05:00
|
|
|
|
|
2014-04-30 16:17:56 -04:00
|
|
|
|
(define %setuid-programs
|
|
|
|
|
;; Default set of setuid-root programs.
|
2015-08-18 23:56:16 -04:00
|
|
|
|
(let ((shadow (@ (gnu packages admin) shadow)))
|
system: Use 'file-append' to denote file names.
* gnu/services/avahi.scm, gnu/services/base.scm,
gnu/services/databases.scm, gnu/services/dbus.scm,
gnu/services/desktop.scm, gnu/services/dict.scm,
gnu/services/mail.scm, gnu/services/networking.scm,
gnu/services/sddm.scm, gnu/services/spice.scm,
gnu/services/ssh.scm, gnu/services/web.scm,
gnu/services/xorg.scm, gnu/system.scm: Replace the
#~(string-append #$pkg "/bin/foo") idiom with
(file-append pkg "/bin/foo").
2016-09-10 06:03:47 -04:00
|
|
|
|
(list (file-append shadow "/bin/passwd")
|
|
|
|
|
(file-append shadow "/bin/su")
|
2017-07-17 09:26:27 -04:00
|
|
|
|
(file-append shadow "/bin/newuidmap")
|
|
|
|
|
(file-append shadow "/bin/newgidmap")
|
system: Use 'file-append' to denote file names.
* gnu/services/avahi.scm, gnu/services/base.scm,
gnu/services/databases.scm, gnu/services/dbus.scm,
gnu/services/desktop.scm, gnu/services/dict.scm,
gnu/services/mail.scm, gnu/services/networking.scm,
gnu/services/sddm.scm, gnu/services/spice.scm,
gnu/services/ssh.scm, gnu/services/web.scm,
gnu/services/xorg.scm, gnu/system.scm: Replace the
#~(string-append #$pkg "/bin/foo") idiom with
(file-append pkg "/bin/foo").
2016-09-10 06:03:47 -04:00
|
|
|
|
(file-append inetutils "/bin/ping")
|
|
|
|
|
(file-append inetutils "/bin/ping6")
|
|
|
|
|
(file-append sudo "/bin/sudo")
|
2019-01-05 08:06:47 -05:00
|
|
|
|
(file-append sudo "/bin/sudoedit")
|
2019-10-06 05:44:06 -04:00
|
|
|
|
(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 09:29:24 -04:00
|
|
|
|
|
|
|
|
|
(define %sudoers-specification
|
|
|
|
|
;; Default /etc/sudoers contents: 'root' and all members of the 'wheel'
|
|
|
|
|
;; group can do anything. See
|
|
|
|
|
;; <http://www.sudo.ws/sudo/man/1.8.10/sudoers.man.html>.
|
|
|
|
|
;; TODO: Add a declarative API.
|
2015-06-05 14:22:47 -04:00
|
|
|
|
(plain-file "sudoers" "\
|
|
|
|
|
root ALL=(ALL) ALL
|
|
|
|
|
%wheel ALL=(ALL) ALL\n"))
|
2014-04-30 16:17:56 -04:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(define* (operating-system-activation-script os)
|
2014-05-24 09:51:57 -04:00
|
|
|
|
"Return the activation script for OS---i.e., the code that \"activates\" the
|
|
|
|
|
stateful part of OS, including user accounts and groups, special directories,
|
|
|
|
|
etc."
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(let* ((services (operating-system-services os))
|
services: Introduce extensible services.
This patch rewrites GuixSD services to make them extensible.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/services/dbus.scm.
* gnu/services.scm (<service>): Replace with new record type.
(<service-extension>, <service-type>): New record types.
(write-service-type, compute-boot-script, second-argument): New
procedures.
(%boot-service, boot-service-type): New variables.
(file-union, directory-union, modprobe-wrapper,
activation-service->script, activation-script,
gexps->activation-gexp): New procedures.
(activation-service-type, %activation-service): New variables.
(etc-directory, files->etc-directory, etc-service): New procedures.
(etc-service-type, setuid-program-service, firmware-service-type): New
variables.
(firmware->activation-gexp): New procedure.
(&service-error, &missing-target-service-error,
&ambiguous-target-service-error): New condition types.
(service-back-edges, fold-services): New procedures.
* gnu/services/avahi.scm (<avahi-configuration>): New record type.
(configuration-file): Replace keyword parameters with a single
'config' parameter.
(%avahi-accounts, %avahi-activation, avahi-service-type): New
variables.
(avahi-dmd-service): New procedure.
(avahi-service): Rewrite using 'service' and 'avahi-configuration'.
* gnu/services/base.scm (%root-file-system-dmd-service,
root-file-system-service-type): New variables.
(root-file-system-service): Use them.
(file-system->dmd-service-name): New procedure.
(file-system-service-type): New variable.
(file-system-service): Use it. Replace keyword parameters with a
single 'file-system' object.
(user-unmount-service-type): New variable.
(user-unmount-service): Use it.
(user-processes-service-type): New variable.
(user-processes-service): Use it.
(host-name-service-type): New variable.
(host-name-service): Use it.
(console-keymap-service-type): New variable.
(console-keymap-service): Use it.
(console-font-service-type): New variable.
(console-font-service): Use it.
(mingetty-pam-service, mingetty-dmd-service): New procedures.
(mingetty-service-type): New variable.
(mingetty-service): Use it.
(nscd-dmd-service): New procedure.
(nscd-activation, nscd-service-type): New variables.
(nscd-service): Use the latter.
(syslog-service-type): New variable.
(syslog-service): Use it.
(<guix-configuration>): New record type.
(%default-guix-configuration): New variable.
(guix-dmd-service, guix-accounts, guix-activation): New procedures.
(guix-service-type): New variable.
(guix-service): Replace list of keyword parameters with a single
'config' parameter. Rewrite using 'service'.
(<udev-configuration>): New record type.
(udev-dmd-service): New procedure.
(udev-service-type): New variable.
(udev-service): Use it.
(device-mapping-service-type): New variable.
(device-mapping-service): Use it.
(swap-service-type): New variable.
(swap-service): Use it.
* gnu/services/databases.scm (<postgresql-configuration>): New record
type.
(%postgresql-accounts, postgresql-activation): New variables.
(postgresql-dmd-service): New procedure.
(postgresql-service): Rewrite using 'service' and
'postgresql-configuration'.
* gnu/services/dbus.scm: New file.
* gnu/services/desktop.scm (dbus-configuration-directory, dbus-service):
Remove.
(wrapped-dbus-service): New procedure.
(<upower-configuration>): New record type.
(upower-configuration-file): Replace keyword parameters with single
<upower-configuration> parameter.
(%upower-accounts, %upower-activation): New variables.
(upower-dbus-service, upower-dmd-service): New procedures.
(upower-service-type): New variable.
(upower-service): Rewrite using 'service' and 'upower-configuration'.
(%colord-activation, %colord-accounts): New variables.
(colord-dmd-service): New procedure.
(colord-service-type): New variable.
(colord-service): Rewrite using 'service'.
(<geoclue-configuration>): New record type.
(geoclue-configuration-file): Replace keyword parameters with a single
'config' parameter.
(geoclue-dbus-service, geoclue-dmd-service): New procedures.
(%geoclue-accounts, geoclue-service-type): New variables.
(geoclue-service): Rewrite using 'service' and
'geoclue-configuration'.
(%polkit-accounts, %polkit-pam-services, polkit-service-type): New
variables.
(polkit-dmd-service): New procedure.
(polkit-service): Rewrite using 'service'.
(<elogind-configuration>)[elogind]: New field.
(elogind-dmd-service): New procedure.
(elogind-service-type): New variable.
(elogind-service): Rewrite using 'service'.
(%desktop-services): Remove argument to 'dbus-service'. Remove 'map'
over %BASE-SERVICES.
* gnu/services/dmd.scm (dmd-boot-gexp): New procedure.
(dmd-root-service-type, %dmd-root-service): New variables.
(dmd-service-type): New macro.
(<dmd-service>): New record type.
* gnu/services/lirc.scm (<lirc-configuration>): New record type.
(%lirc-activation): New variable.
(lirc-dmd-service): New procedure.
(lirc-service-type): New variable.
(lirc-service): Rewrite using 'service' and 'lirc-configuration'.
* gnu/services/networking.scm (<static-networking>): New record type.
(static-networking-service-type): New variable.
(static-networking-service): Rewrite using 'service' and
'static-networking'.
(dhcp-client-service-type): New variable.
(dhcp-client-service): Rewrite using 'service'.
(<ntp-configuration>): New record type.
(ntp-dmd-service): New procedure.
(ntp-service-type): New variable.
(ntp-service): New procedure.
(%tor-accounts, tor-service-type): New variable.
(tor-dmd-service): New procedure.
(tor-service): Rewrite using 'service'.
(<bitlbee-configuration>): New record type.
(bitlbee-dmd-service): New procedure.
(%bitlbee-accounts, %bitlbee-activation, bitlbee-service-type): New
variables.
(bitlbee-service): Rewrite using 'service'.
(%wicd-activation): New variable.
(wicd-dmd-service): New procedure.
(wicd-service-type): New variable.
(wicd-service): Rewrite using 'service'.
* gnu/services/ssh.scm (<lsh-configuration>): New record type.
(activation): Rename to...
(lsh-initialization): ... this.
(lsh-activation, lsh-dmd-service, lsh-pam-services): New procedures.
(lsh-service-type): New variable.
(lsh-service): Rewrite using 'service' and 'lsh-configuration'.
* gnu/services/web.scm (<nginx-configuration>): New record type.
(%nginx-accounts): New variable.
(nginx-activation, nginx-dmd-service): New procedures.
(nginx-service-type): New variable.
(nginx-service): Rewrite using 'service' and 'nginx-configuration'.
* gnu/services/xorg.scm (<slim-configuration>): New record type.
(slim-pam-service, slim-dmd-service): New procedures.
(slim-service-type): New variable.
(slim-service): Rewrite using 'service' and 'slim-configuration'.
* gnu/system.scm (file-union): Remove.
(other-file-system-services): Adjust to new 'file-system-service'
signature.
(essential-services): Add #:container? parameter. Add
%DMD-ROOT-SERVICE, %ACTIVATION-SERVICE, and calls to
'pam-root-service', 'account-service', 'operating-system-etc-service',
and a SETUID-PROGRAM-SERVICE instance.
(operating-system-services): Pass #:container? to 'essential-services.
(etc-directory): Remove.
(operating-system-etc-service): New procedure. Rewrite as a call to
'etc-service'.
(operating-system-accounts): Change to not return accounts required by
services.
(operating-system-etc-directory): Rewrite as a call to 'fold-services'
and 'etc-directory'.
(user-group->gexp, user-account->gexp, modprobe-wrapper): Remove.
(operating-system-activation-script): Rewrite as a call to
'fold-services' and 'activation-service->script'.
(operating-system-boot-script): Likewise.
(operating-system-derivation): Add call to 'lower-object'.
(emacs-site-file, emacs-site-directory, shells-file): Change to use
'computed-file' and 'scheme-file' instead of the monadic procedures.
* gnu/system/install.scm (cow-store-service-type): New variable.
(cow-store-service): Rewrite using 'service'.
(/etc/configuration-files): New procedure.
(configuration-template-service-type,
%configuration-template-service): New variables.
(configuration-template-service): Remove.
(installation-services): Adjust accordingly. Adjust argument to
'guix-service'.
* gnu/system/linux.scm (/etc-entry, pam-root-service): New procedures.
(pam-root-service-type): New variable.
* gnu/system/shadow.scm (user-group->gexp, user-account->gexp,
account-activation, etc-skel, account-service): New procedures.
(account-service-type): New variable.
* tests/services.scm: New file.
* doc/guix.texi (Base Services, Desktop Services): Adjust accordingly.
(Defining Services): Rewrite.
* doc/images/service-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
* po/guix/POTFILES.in: Add gnu/services.scm.
2015-09-17 17:44:26 -04:00
|
|
|
|
(activation (fold-services services
|
|
|
|
|
#:target-type activation-service-type)))
|
|
|
|
|
(activation-service->script activation)))
|
2014-05-24 09:51:57 -04:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(define* (operating-system-boot-script os)
|
2014-05-24 09:51:57 -04:00
|
|
|
|
"Return the boot script for OS---i.e., the code started by the initrd once
|
2019-03-22 12:48:37 -04:00
|
|
|
|
we're running in the final root."
|
|
|
|
|
(let* ((services (operating-system-services os))
|
2015-11-02 12:44:17 -05:00
|
|
|
|
(boot (fold-services services #:target-type boot-service-type)))
|
2017-04-15 16:12:37 -04:00
|
|
|
|
(service-value boot)))
|
2014-04-23 10:52:14 -04:00
|
|
|
|
|
2016-05-04 16:48:28 -04:00
|
|
|
|
(define (operating-system-user-accounts os)
|
|
|
|
|
"Return the list of user accounts of OS."
|
|
|
|
|
(let* ((services (operating-system-services os))
|
|
|
|
|
(account (fold-services services
|
|
|
|
|
#:target-type account-service-type)))
|
|
|
|
|
(filter user-account?
|
2017-04-15 16:12:37 -04:00
|
|
|
|
(service-value account))))
|
2016-05-04 16:48:28 -04:00
|
|
|
|
|
|
|
|
|
(define (operating-system-shepherd-service-names os)
|
|
|
|
|
"Return the list of Shepherd service names for OS."
|
|
|
|
|
(append-map shepherd-service-provision
|
2017-04-15 16:12:37 -04:00
|
|
|
|
(service-value
|
2016-05-04 16:48:28 -04:00
|
|
|
|
(fold-services (operating-system-services os)
|
|
|
|
|
#:target-type
|
|
|
|
|
shepherd-root-service-type))))
|
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(define* (operating-system-derivation os)
|
2015-11-02 12:44:17 -05:00
|
|
|
|
"Return a derivation that builds OS."
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(let* ((services (operating-system-services os))
|
2015-11-02 12:44:17 -05:00
|
|
|
|
(system (fold-services services)))
|
|
|
|
|
;; SYSTEM contains the derivation as a monadic value.
|
2017-04-15 16:12:37 -04:00
|
|
|
|
(service-value system)))
|
2015-11-02 12:44:17 -05:00
|
|
|
|
|
2019-03-22 12:48:37 -04:00
|
|
|
|
(define* (operating-system-profile os)
|
2015-11-02 15:52:28 -05:00
|
|
|
|
"Return a derivation that builds the system profile of OS."
|
|
|
|
|
(mlet* %store-monad
|
2019-03-22 12:48:37 -04:00
|
|
|
|
((services -> (operating-system-services os))
|
2015-11-02 15:52:28 -05:00
|
|
|
|
(profile (fold-services services
|
|
|
|
|
#:target-type profile-service-type)))
|
|
|
|
|
(match profile
|
|
|
|
|
(("profile" profile)
|
|
|
|
|
(return profile)))))
|
|
|
|
|
|
2014-05-02 18:26:07 -04:00
|
|
|
|
(define (operating-system-root-file-system os)
|
|
|
|
|
"Return the root file system of OS."
|
2018-05-18 04:11:17 -04:00
|
|
|
|
(find (lambda (fs)
|
|
|
|
|
(string=? "/" (file-system-mount-point fs)))
|
2014-05-02 18:26:07 -04:00
|
|
|
|
(operating-system-file-systems os)))
|
|
|
|
|
|
2014-05-17 11:39:30 -04:00
|
|
|
|
(define (operating-system-initrd-file os)
|
|
|
|
|
"Return a gexp denoting the initrd file of OS."
|
2014-05-02 18:26:07 -04:00
|
|
|
|
(define boot-file-systems
|
2014-11-25 10:01:21 -05:00
|
|
|
|
(filter file-system-needed-for-boot?
|
2014-05-02 18:26:07 -04:00
|
|
|
|
(operating-system-file-systems os)))
|
|
|
|
|
|
2014-09-22 05:06:42 -04:00
|
|
|
|
(define mapped-devices
|
|
|
|
|
(operating-system-boot-mapped-devices os))
|
|
|
|
|
|
|
|
|
|
(define make-initrd
|
|
|
|
|
(operating-system-initrd os))
|
|
|
|
|
|
2018-11-21 10:19:09 -05:00
|
|
|
|
(make-initrd boot-file-systems
|
|
|
|
|
#:linux (operating-system-kernel os)
|
|
|
|
|
#:linux-modules
|
|
|
|
|
(operating-system-initrd-modules os)
|
2019-03-20 07:19:14 -04:00
|
|
|
|
#:mapped-devices mapped-devices
|
|
|
|
|
#:keyboard-layout (operating-system-keyboard-layout os)))
|
2014-05-17 11:39:30 -04:00
|
|
|
|
|
2020-04-28 08:12:34 -04:00
|
|
|
|
(define* (operating-system-uuid os #:optional (type 'dce))
|
|
|
|
|
"Compute UUID object with a deterministic \"UUID\" for OS, of the given
|
|
|
|
|
TYPE (one of 'iso9660 or 'dce). Return a UUID object."
|
|
|
|
|
;; Note: For this to be deterministic, we must not hash things that contains
|
|
|
|
|
;; (directly or indirectly) procedures, for example. That rules out
|
|
|
|
|
;; anything that contains gexps, thunk or delayed record fields, etc.
|
|
|
|
|
|
|
|
|
|
(define service-name
|
|
|
|
|
(compose service-type-name service-kind))
|
|
|
|
|
|
|
|
|
|
(define (file-system-digest fs)
|
|
|
|
|
;; Return a hashable digest that does not contain 'dependencies' since
|
|
|
|
|
;; this field can contain procedures.
|
|
|
|
|
(let ((device (file-system-device fs)))
|
|
|
|
|
(list (file-system-mount-point fs)
|
|
|
|
|
(file-system-type fs)
|
|
|
|
|
(file-system-device->string device)
|
|
|
|
|
(file-system-options fs))))
|
|
|
|
|
|
|
|
|
|
(if (eq? type 'iso9660)
|
|
|
|
|
(let ((pad (compose (cut string-pad <> 2 #\0)
|
|
|
|
|
number->string))
|
|
|
|
|
(h (hash (map service-name (operating-system-services os))
|
|
|
|
|
3600)))
|
|
|
|
|
(bytevector->uuid
|
|
|
|
|
(string->iso9660-uuid
|
|
|
|
|
(string-append "1970-01-01-"
|
|
|
|
|
(pad (hash (operating-system-host-name os) 24)) "-"
|
|
|
|
|
(pad (quotient h 60)) "-"
|
|
|
|
|
(pad (modulo h 60)) "-"
|
|
|
|
|
(pad (hash (map file-system-digest
|
|
|
|
|
(operating-system-file-systems os))
|
|
|
|
|
100))))
|
|
|
|
|
'iso9660))
|
|
|
|
|
(bytevector->uuid
|
|
|
|
|
(uint-list->bytevector
|
|
|
|
|
(list (hash (map file-system-digest
|
|
|
|
|
(operating-system-file-systems os))
|
|
|
|
|
(- (expt 2 32) 1))
|
|
|
|
|
(hash (operating-system-host-name os)
|
|
|
|
|
(- (expt 2 32) 1))
|
|
|
|
|
(hash (map service-name (operating-system-services os))
|
|
|
|
|
(- (expt 2 32) 1))
|
|
|
|
|
(hash (map file-system-digest (operating-system-file-systems os))
|
|
|
|
|
(- (expt 2 32) 1)))
|
|
|
|
|
(endianness little)
|
|
|
|
|
4)
|
|
|
|
|
type)))
|
|
|
|
|
|
2016-02-10 05:01:54 -05:00
|
|
|
|
(define (locale-name->definition* name)
|
|
|
|
|
"Variant of 'locale-name->definition' that raises an error upon failure."
|
|
|
|
|
(match (locale-name->definition name)
|
|
|
|
|
(#f
|
|
|
|
|
(raise (condition
|
|
|
|
|
(&message
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(message (format #f (G_ "~a: invalid locale name") name))))))
|
2016-02-10 05:01:54 -05:00
|
|
|
|
(def def)))
|
|
|
|
|
|
2014-11-26 16:49:11 -05:00
|
|
|
|
(define (operating-system-locale-directory os)
|
|
|
|
|
"Return the directory containing the locales compiled for the definitions
|
|
|
|
|
listed in OS. The C library expects to find it under
|
|
|
|
|
/run/current-system/locale."
|
2016-02-10 05:01:54 -05:00
|
|
|
|
(define name
|
|
|
|
|
(operating-system-locale os))
|
|
|
|
|
|
|
|
|
|
(define definitions
|
|
|
|
|
;; While we're at it, check whether NAME is defined and add it if needed.
|
|
|
|
|
(if (member name (map locale-definition-name
|
|
|
|
|
(operating-system-locale-definitions os)))
|
|
|
|
|
(operating-system-locale-definitions os)
|
|
|
|
|
(cons (locale-name->definition* name)
|
|
|
|
|
(operating-system-locale-definitions os))))
|
|
|
|
|
|
|
|
|
|
(locale-directory definitions
|
2015-10-30 18:05:52 -04:00
|
|
|
|
#:libcs (operating-system-locale-libcs os)))
|
2014-11-26 16:49:11 -05:00
|
|
|
|
|
2017-04-02 09:52:34 -04:00
|
|
|
|
(define (kernel->boot-label kernel)
|
|
|
|
|
"Return a label for the bootloader menu entry that boots KERNEL."
|
2018-12-19 15:22:20 -05:00
|
|
|
|
(cond ((package? kernel)
|
|
|
|
|
(string-append "GNU with "
|
|
|
|
|
(string-titlecase (package-name kernel)) " "
|
2019-04-14 17:30:52 -04:00
|
|
|
|
(package-version kernel)))
|
2018-12-19 15:22:20 -05:00
|
|
|
|
((inferior-package? kernel)
|
|
|
|
|
(string-append "GNU with "
|
2018-12-24 14:52:59 -05:00
|
|
|
|
(string-titlecase (inferior-package-name kernel)) " "
|
2019-04-14 17:30:52 -04:00
|
|
|
|
(inferior-package-version kernel)))
|
2018-12-19 15:22:20 -05:00
|
|
|
|
(else "GNU")))
|
2014-06-25 16:46:44 -04:00
|
|
|
|
|
2019-04-15 05:30:50 -04:00
|
|
|
|
(define (operating-system-default-label os)
|
|
|
|
|
"Return the default label for OS, as it will appear in the bootloader menu
|
|
|
|
|
entry."
|
|
|
|
|
(kernel->boot-label (operating-system-kernel os)))
|
|
|
|
|
|
2016-01-21 16:45:54 -05:00
|
|
|
|
(define (store-file-system file-systems)
|
|
|
|
|
"Return the file system object among FILE-SYSTEMS that contains the store."
|
|
|
|
|
(match (filter (lambda (fs)
|
|
|
|
|
(and (file-system-mount? fs)
|
|
|
|
|
(not (memq 'bind-mount (file-system-flags fs)))
|
|
|
|
|
(string-prefix? (file-system-mount-point fs)
|
|
|
|
|
(%store-prefix))))
|
|
|
|
|
file-systems)
|
|
|
|
|
((and candidates (head . tail))
|
|
|
|
|
(reduce (lambda (fs1 fs2)
|
|
|
|
|
(if (> (string-length (file-system-mount-point fs1))
|
|
|
|
|
(string-length (file-system-mount-point fs2)))
|
|
|
|
|
fs1
|
|
|
|
|
fs2))
|
|
|
|
|
head
|
|
|
|
|
candidates))))
|
|
|
|
|
|
|
|
|
|
(define (operating-system-store-file-system os)
|
|
|
|
|
"Return the file system that contains the store of OS."
|
|
|
|
|
(store-file-system (operating-system-file-systems os)))
|
|
|
|
|
|
2017-04-02 09:52:29 -04:00
|
|
|
|
(define* (operating-system-bootcfg os #:optional (old-entries '()))
|
2018-11-16 02:39:07 -05:00
|
|
|
|
"Return the bootloader configuration file for OS. Use OLD-ENTRIES,
|
|
|
|
|
a list of <menu-entry>, to populate the \"old entries\" menu."
|
2019-07-14 07:50:23 -04:00
|
|
|
|
(let* ((file-systems (operating-system-file-systems os))
|
|
|
|
|
(root-fs (operating-system-root-file-system os))
|
2018-11-16 02:50:44 -05:00
|
|
|
|
(root-device (file-system-device root-fs))
|
|
|
|
|
(params (operating-system-boot-parameters
|
|
|
|
|
os root-device
|
|
|
|
|
#:system-kernel-arguments? #t))
|
|
|
|
|
(entry (boot-parameters->menu-entry params))
|
|
|
|
|
(bootloader-conf (operating-system-bootloader os)))
|
2019-07-14 07:50:23 -04:00
|
|
|
|
|
2018-11-15 07:32:07 -05:00
|
|
|
|
(define generate-config-file
|
|
|
|
|
(bootloader-configuration-file-generator
|
|
|
|
|
(bootloader-configuration-bootloader bootloader-conf)))
|
|
|
|
|
|
2018-11-16 02:50:44 -05:00
|
|
|
|
(generate-config-file bootloader-conf (list entry)
|
2019-07-14 07:50:23 -04:00
|
|
|
|
#:old-entries old-entries
|
2020-05-27 22:44:28 -04:00
|
|
|
|
#:store-directory-prefix
|
2019-07-14 07:50:23 -04:00
|
|
|
|
(btrfs-store-subvolume-file-name file-systems))))
|
2014-05-17 11:39:30 -04:00
|
|
|
|
|
2018-11-15 08:36:16 -05:00
|
|
|
|
(define* (operating-system-boot-parameters os root-device
|
|
|
|
|
#:key system-kernel-arguments?)
|
|
|
|
|
"Return a monadic <boot-parameters> record that describes the boot
|
|
|
|
|
parameters of OS. When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments
|
|
|
|
|
such as '--root' and '--load' to <boot-parameters>."
|
2018-11-15 12:52:38 -05:00
|
|
|
|
(let* ((initrd (operating-system-initrd-file os))
|
|
|
|
|
(store (operating-system-store-file-system os))
|
|
|
|
|
(bootloader (bootloader-configuration-bootloader
|
|
|
|
|
(operating-system-bootloader os)))
|
|
|
|
|
(bootloader-name (bootloader-name bootloader))
|
2019-04-15 05:30:50 -04:00
|
|
|
|
(label (operating-system-label os)))
|
2018-11-15 12:52:38 -05:00
|
|
|
|
(boot-parameters
|
|
|
|
|
(label label)
|
|
|
|
|
(root-device root-device)
|
|
|
|
|
(kernel (operating-system-kernel-file os))
|
|
|
|
|
(kernel-arguments
|
|
|
|
|
(if system-kernel-arguments?
|
|
|
|
|
(operating-system-kernel-arguments os root-device)
|
|
|
|
|
(operating-system-user-kernel-arguments os)))
|
|
|
|
|
(initrd initrd)
|
|
|
|
|
(bootloader-name bootloader-name)
|
2019-08-28 17:27:20 -04:00
|
|
|
|
(bootloader-menu-entries
|
|
|
|
|
(bootloader-configuration-menu-entries (operating-system-bootloader os)))
|
2018-11-15 12:52:38 -05:00
|
|
|
|
(store-device (ensure-not-/dev (file-system-device store)))
|
|
|
|
|
(store-mount-point (file-system-mount-point store)))))
|
2017-04-21 08:37:07 -04:00
|
|
|
|
|
2017-09-06 03:28:28 -04:00
|
|
|
|
(define (device->sexp device)
|
|
|
|
|
"Serialize DEVICE as an sexp (really, as an object with a read syntax.)"
|
|
|
|
|
(match device
|
|
|
|
|
((? uuid? uuid)
|
2017-09-06 04:22:58 -04:00
|
|
|
|
`(uuid ,(uuid-type uuid) ,(uuid-bytevector uuid)))
|
2018-05-18 07:43:07 -04:00
|
|
|
|
((? file-system-label? label)
|
|
|
|
|
`(file-system-label ,(file-system-label->string label)))
|
2017-09-06 03:28:28 -04:00
|
|
|
|
(_
|
|
|
|
|
device)))
|
|
|
|
|
|
2018-11-15 08:36:16 -05:00
|
|
|
|
(define* (operating-system-boot-parameters-file os
|
|
|
|
|
#:key system-kernel-arguments?)
|
2017-04-21 08:37:07 -04: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 08:36:16 -05: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 08:37:07 -04:00
|
|
|
|
being stored into the \"parameters\" file)."
|
2018-11-15 12:52:38 -05: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 09:03:51 -04: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))
|
|
|
|
|
(initrd #$(boot-parameters-initrd params))
|
|
|
|
|
(bootloader-name #$(boot-parameters-bootloader-name params))
|
|
|
|
|
(bootloader-menu-entries
|
|
|
|
|
#$(map menu-entry->sexp
|
|
|
|
|
(or (and=> (operating-system-bootloader os)
|
|
|
|
|
bootloader-configuration-menu-entries)
|
|
|
|
|
'())))
|
|
|
|
|
(store
|
|
|
|
|
(device
|
|
|
|
|
#$(device->sexp (boot-parameters-store-device params)))
|
|
|
|
|
(mount-point #$(boot-parameters-store-mount-point
|
|
|
|
|
params))))
|
|
|
|
|
#:set-load-path? #f)))
|
2014-06-25 16:48:25 -04:00
|
|
|
|
|
2017-09-12 16:20:08 -04:00
|
|
|
|
(define-gexp-compiler (operating-system-compiler (os <operating-system>)
|
|
|
|
|
system target)
|
|
|
|
|
((store-lift
|
|
|
|
|
(lambda (store)
|
|
|
|
|
;; XXX: This is not super elegant but we can't pass SYSTEM and TARGET to
|
|
|
|
|
;; 'operating-system-derivation'.
|
|
|
|
|
(run-with-store store (operating-system-derivation os)
|
|
|
|
|
#:system system
|
|
|
|
|
#:target target)))))
|
|
|
|
|
|
2013-12-09 15:32:36 -05:00
|
|
|
|
;;; system.scm ends here
|