index
:
guix
koszko
koszko-scripts
Wojtek's customized Guix
about
summary
refs
log
tree
commit
diff
log msg
author
committer
range
;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013-2022, 2024 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com> ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com> ;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas <rosen644835@gmail.com> ;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org> ;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re> ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de> ;;; Copyright © 2020, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2020, 2023 Janneke Nieuwenhuizen <jannek@gnu.org> ;;; Copyright © 2020, 2022 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> ;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com> ;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu> ;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr> ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (gnu system) #:use-module (guix inferior) #:use-module (guix store) #:use-module (guix memoization) #:use-module (guix monads) #:use-module (guix gexp) #:use-module (guix records) #:use-module (guix packages) #:use-module (guix deprecation) #:use-module (guix derivations) #:use-module (guix profiles) #:use-module ((guix utils) #:select (substitute-keyword-arguments version>?)) #:use-module (guix i18n) #:use-module (guix diagnostics) #:use-module (guix ui) #:use-module (gnu packages admin) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module ((gnu packages certs) #:select (nss-certs)) #:use-module (gnu packages compression) #:use-module (gnu packages cross-base) #:use-module (gnu packages firmware) #:use-module (gnu packages gawk) #:use-module (gnu packages guile) #:use-module (gnu packages guile-xyz) #:use-module (gnu packages hurd) #:use-module (gnu packages less) #:use-module (gnu packages linux) #:use-module (gnu packages man) #:use-module (gnu packages nvi) #:use-module (gnu packages package-management) #:use-module (gnu packages pciutils) #:use-module (gnu packages texinfo) #:use-module (gnu packages text-editors) #:use-module (gnu packages wget) #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module (gnu services base) #:use-module (gnu bootloader) #:use-module (gnu system shadow) #:use-module (gnu system nss) #:use-module (gnu system locale) #:use-module (gnu system pam) #:use-module (gnu system linux-initrd) #:use-module (gnu system privilege) #:use-module (gnu system setuid) #:use-module (gnu system uuid) #:use-module (gnu system file-systems) #:use-module (gnu system mapped-devices) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:use-module (srfi srfi-71) #:use-module (rnrs bytevectors) #:export (operating-system operating-system? this-operating-system operating-system-bootloader operating-system-services operating-system-essential-services operating-system-default-essential-services operating-system-user-services operating-system-packages operating-system-host-name operating-system-hosts-file ;deprecated operating-system-hurd operating-system-kernel operating-system-kernel-file operating-system-kernel-arguments operating-system-label operating-system-default-label operating-system-initrd-modules operating-system-initrd operating-system-users operating-system-groups operating-system-extra-groups operating-system-issue operating-system-timezone operating-system-locale operating-system-locale-definitions operating-system-locale-libcs operating-system-mapped-devices operating-system-file-systems operating-system-store-file-system operating-system-user-mapped-devices operating-system-boot-mapped-devices operating-system-bootloader-crypto-devices operating-system-activation-script operating-system-user-accounts operating-system-shepherd-service-names operating-system-user-kernel-arguments operating-system-firmware operating-system-keyboard-layout operating-system-name-service-switch operating-system-pam-services operating-system-privileged-programs operating-system-setuid-programs operating-system-skeletons operating-system-sudoers-file operating-system-swap-devices operating-system-kernel-loadable-modules operating-system-location operating-system-derivation operating-system-profile operating-system-bootcfg operating-system-etc-directory operating-system-locale-directory operating-system-boot-script operating-system-uuid system-linux-image-file-name operating-system-with-gc-roots operating-system-with-provenance hurd-default-essential-services boot-parameters boot-parameters? boot-parameters-label boot-parameters-root-device boot-parameters-bootloader-name boot-parameters-bootloader-menu-entries boot-parameters-store-crypto-devices boot-parameters-store-device boot-parameters-store-directory-prefix boot-parameters-store-mount-point boot-parameters-locale boot-parameters-kernel boot-parameters-kernel-arguments boot-parameters-initrd boot-parameters-multiboot-modules boot-parameters-version %boot-parameters-version read-boot-parameters read-boot-parameters-file boot-parameters->menu-entry local-host-aliases ;deprecated %root-account %default-privileged-programs %setuid-programs %sudoers-specification %base-packages %base-packages-artwork %base-packages-interactive %base-packages-linux %base-packages-networking %base-packages-disk-utilities %base-packages-utils %base-firmware %default-kernel-arguments)) ;;; Commentary: ;;; ;;; This module supports whole-system configuration. ;;; ;;; Code: (define* (bootable-kernel-arguments system root-device version) "Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE. VERSION is the target version of the boot-parameters record." ;; If the version is newer than 0, we use the new style initrd parameter ;; names, otherwise we use the legacy ones. This is to maintain backward ;; compatibility when producing bootloader configurations for older ;; generations. (define version>0? (> version 0)) (let ((root (file-system-device->string root-device #:uuid-type 'dce))) (append (if (string=? root "none") '() ; Ignore the case where the root is "none" (typically tmpfs). ;; Note: Always use the DCE format because that's what ;; (gnu build linux-boot) expects for the 'root' ;; kernel command-line option. (list (string-append (if version>0? "root=" "--root=") root))) (list #~(string-append (if #$version>0? "gnu.system=" "--system=") #$system) #~(string-append (if #$version>0? "gnu.load=" "--load=") #$system "/boot"))))) ;; System-wide configuration. (define-with-syntax-properties (warn-hosts-file-field-deprecation (value properties)) (when value (warning (source-properties->location properties) (G_ "the 'hosts-file' field is deprecated, please use \ 'hosts-service-type' instead~%"))) value) ;; TODO: Add per-field docstrings/stexi. (define-record-type* <operating-system> operating-system make-operating-system operating-system? this-operating-system (kernel operating-system-kernel ; package (default linux-libre)) (kernel-loadable-modules operating-system-kernel-loadable-modules (default '())) ; list of packages (kernel-arguments operating-system-user-kernel-arguments (default %default-kernel-arguments)) ; list of gexps/strings (hurd operating-system-hurd (default #f)) ; package (bootloader operating-system-bootloader) ; <bootloader-configuration> (label operating-system-label ; string (thunked) (default (operating-system-default-label this-operating-system))) (keyboard-layout operating-system-keyboard-layout ;#f | <keyboard-layout> (default #f)) (initrd operating-system-initrd ; (list fs) -> file-like (default base-initrd)) (initrd-modules operating-system-initrd-modules ; list of strings (thunked) ; it's system-dependent (default %base-initrd-modules)) (firmware operating-system-firmware ; list of packages (default %base-firmware)) (host-name operating-system-host-name) ; string (hosts-file %operating-system-hosts-file ; deprecated (default #f) (sanitize warn-hosts-file-field-deprecation)) (mapped-devices operating-system-mapped-devices ; list of <mapped-device> (default '())) (file-systems operating-system-file-systems) ; list of fs (swap-devices operating-system-swap-devices ; list of string | <swap-space> (default '()) (delayed) (sanitize warn-swap-devices-change)) (users operating-system-users ; list of user accounts (default %base-user-accounts)) (groups operating-system-groups ; list of user groups (default %base-groups)) (extra-groups operating-system-extra-groups ; list of extra membership (default '())) (skeletons operating-system-skeletons ; list of name/file-like value (default (default-skeletons))) (issue operating-system-issue ; string