aboutsummaryrefslogtreecommitdiff
path: root/gnu/services/dict.scm
blob: a97ad8f60814b085020282ba8ea6501975a9f807 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
;;; Copyright © 2016, 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
;;;
;;; 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 services dict)
  #:use-module (guix gexp)
  #:use-module (guix records)
  #:use-module (guix modules)
  #:use-module (gnu services)
  #:use-module (gnu services shepherd)
  #:use-module (gnu system shadow)
  #:use-module ((gnu packages admin) #:select (shadow))
  #:use-module (gnu packages dico)
  #:use-module (gnu packages dictionaries)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-26)
  #:use-module (ice-9 match)
  #:export (dicod-service
            dicod-service-type
            dicod-configuration
            dicod-handler
            dicod-database
            %dicod-database:gcide))


;;;
;;; GNU Dico.
;;;

(define-record-type* <dicod-configuration>
  dicod-configuration make-dicod-configuration
  dicod-configuration?
  (dico        dicod-configuration-dico       (default dico))
  (interfaces  dicod-configuration-interfaces     ;list of strings
               (default '("localhost")))
  (handlers    dicod-configuration-handlers       ;list of <dicod-handler>
               (default '()))
  (databases   dicod-configuration-databases      ;list of <dicod-database>
               (default (list %dicod-database:gcide))))

(define-record-type* <dicod-handler>
  dicod-handler make-dicod-handler
  dicod-handler?
  (name        dicod-handler-name)
  (module      dicod-handler-module          (default #f))
  (options     dicod-handler-options         (default '())))

(define-record-type* <dicod-database>
  dicod-database make-dicod-database
  dicod-database?
  (name        dicod-database-name)
  (handler     dicod-database-handler)
  (complex?    dicod-database-complex?       (default #f))
  (options     dicod-database-options        (default '())))

(define %dicod-database:gcide
  (dicod-database
   (name "gcide")
   (handler "gcide")
   (options (list #~(string-append "dbdir=" #$gcide "/share/gcide")
                  "idxdir=/var/run/dicod"))))

(define %dicod-accounts
  (list (user-group
         (name "dicod")
         (system? #t))
        (user-account
         (name "dicod")
         (group "dicod")
         (system? #t)
         (home-directory "/var/empty")
         (shell (file-append shadow "/sbin/nologin")))))

(define (dicod-configuration-file config)
  (define handler->text
    (match-lambda
      (($ <dicod-handler> name #f '())
       `("
load-module " ,name ";"))
      (($ <dicod-handler> name #f options)
       (handler->text (dicod-handler
                       (name name)
                       (module name)
                       (options options))))
      (($ <dicod-handler> name module options)
       `("
load-module " ,name " {
   command \"" ,module (string-join (list ,@options) " " 'prefix) "\";
}\n"))))

  (define database->text
    (match-lambda
      (($ <dicod-database> name handler #f options)
       (append
        (handler->text (dicod-handler
                        (name handler)))
        (database->text (dicod-database
                         (name name)
                         (handler handler)
                         (complex? #t)
                         (options options)))))
      (($ <dicod-database> name handler complex? options)
       `("
database {
   name \"" ,name "\";
   handler \"" ,handler
   (string-join (list ,@options) " " 'prefix) "\";
}\n"))))

  (define configuration->text
    (match-lambda
      (($ <dicod-configuration> dico (interfaces ...) handlers databases)
       (append `("listen ("
                 ,(string-join interfaces ", ") ");\n")
               (append-map handler->text handlers)
               (append-map database->text databases)))))

  (apply mixed-text-file "dicod.conf" (configuration->text config)))

(define %dicod-activation
  #~(begin
      (use-modules (guix build utils))
      (let ((user   (getpwnam "dicod"))
            (rundir "/var/run/dicod"))
        (mkdir-p rundir)
        (chown rundir (passwd:uid user) (passwd:gid user)))))

(define (dicod-shepherd-service config)
  (let ((dicod      (file-append (dicod-configuration-dico config)
                                 "/bin/dicod"))
        (dicod.conf (dicod-configuration-file config)))
    (with-imported-modules (source-module-closure
                            '((gnu build shepherd)
                              (gnu system file-systems)))
      (list (shepherd-service
             (provision '(dicod))
             (requirement '(user-processes))
             (documentation "Run the dicod daemon.")
             (modules '((gnu build shepherd)
                        (gnu system file-systems)))
             (start #~(make-forkexec-constructor/container
                       (list #$dicod "--foreground"
                             (string-append "--config=" #$dicod.conf))
                       #:user "dicod" #:group "dicod"
                       #:mappings (list (file-system-mapping
                                         (source "/var/run/dicod")
                                         (target source)
                                         (writable? #t)))))
             (stop #~(make-kill-destructor)))))))

(define dicod-service-type
  (service-type
   (name 'dict)
   (extensions
    (list (service-extension account-service-type
                             (const %dicod-accounts))
          (service-extension activation-service-type
                             (const %dicod-activation))
          (service-extension shepherd-root-service-type
                             dicod-shepherd-service)))
   (default-value (dicod-configuration))
   (description
    "Run @command{dicod}, the dictionary server of
@uref{https://www.gnu.org/software/dico, GNU Dico}.  @command{dicod}
implements the standard DICT protocol supported by clients such as
@command{dico} and GNOME Dictionary.")))

(define* (dicod-service #:key (config (dicod-configuration)))
  "Return a service that runs the @command{dicod} daemon, an implementation
of DICT server (@pxref{Dicod,,, dico, GNU Dico Manual}).

The optional @var{config} argument specifies the configuration for
@command{dicod}, which should be a @code{<dicod-configuration>} object, by
default it serves the GNU Collaborative International Dictionary of English.

You can add @command{open localhost} to your @file{~/.dico} file to make
@code{localhost} the default server for @command{dico}
client (@pxref{Initialization File,,, dico, GNU Dico Manual})."
  (service dicod-service-type config))
t not HTTP. ;; ;; Note: DHCPv6 specifies option 59 to contain a boot-file-url, ;; which can contain a HTTP or TFTP URL. ;; ;; Note: It is assumed that the file paths are of a similar ;; setup on both the TFTP server and the NFS server (it is ;; not possible to search for files on TFTP). ;; ;; TODO: Allow HTTP. "set root=(tftp)") ((or #f (? string?)) #~(format #f "search --file --set ~a" #$file))))) (define* (device->hurd-device-name device-spec #:key (disk "w")) "Return DEVICE as a Hurd name spec: part:PART-NUMBER:device:DISKdDISK-INDEX." (let ((device-name (canonicalize-device-spec device-spec))) (device-name->hurd-device-name device-name #:disk disk))) (define* (make-grub-configuration grub config entries #:key (locale #f) (system (%current-system)) (old-entries '()) (store-crypto-devices '()) store-directory-prefix) "Return the GRUB configuration file corresponding to CONFIG, a <bootloader-configuration> object, and where the store is available at STORE-FS, a <file-system> object. OLD-ENTRIES is taken to be a list of menu entries corresponding to old generations of the system. STORE-CRYPTO-DEVICES contain the UUIDs of the encrypted units that must be unlocked to access the store contents. STORE-DIRECTORY-PREFIX may be used to specify a store prefix, as is required when booting a root file system on a Btrfs subvolume." (define all-entries (append entries (bootloader-configuration-menu-entries config))) (define (menu-entry->gexp entry) (let ((label (menu-entry-label entry)) (linux (menu-entry-linux entry)) (device (menu-entry-device entry)) (device-mount-point (menu-entry-device-mount-point entry)) (multiboot-kernel (menu-entry-multiboot-kernel entry)) (chain-loader (menu-entry-chain-loader entry))) (cond (linux (let ((arguments (menu-entry-linux-arguments entry)) (linux (normalize-file linux device-mount-point store-directory-prefix)) (initrd (normalize-file (menu-entry-initrd entry) device-mount-point store-directory-prefix)) (extra-initrd (bootloader-configuration-extra-initrd config))) ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. ;; Use the right file names for LINUX and INITRD in case ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a ;; separate partition. ;; When STORE-DIRECTORY-PREFIX is defined, prepend it the linux and ;; initrd paths, to allow booting from a Btrfs subvolume. #~(format port "menuentry ~s { ~a linux ~a ~a initrd ~a ~a }~%" #$label #$(grub-root-search device linux) #$linux (string-join (list #$@arguments)) (or #$extra-initrd "") #$initrd))) (multiboot-kernel (let* ((kernel (menu-entry-multiboot-kernel entry)) (arguments (menu-entry-multiboot-arguments entry)) ;; Choose between device names as understood by Mach's built-in ;; IDE driver ("hdX") and those understood by rumpdisk ("wdX" ;; in the "noide" case). (disk (if (member "noide" arguments) "w" "h")) (device-spec (and=> device file-system-device->string)) (device-name (and=> device-spec device-spec->device-name)) (modules (menu-entry-multiboot-modules entry))) #~(format port " menuentry ~s { multiboot ~a root=~a~a~a }~%" #$label #$kernel #$(device-name->hurd-device-name device-name #:disk disk) (string-join (list #$@arguments) " " 'prefix) (string-join (map string-join '#$modules) "\n module " 'prefix)))) (chain-loader #~(format port " menuentry ~s { ~a chainloader ~a }~%" #$label #$(grub-root-search device chain-loader) #$chain-loader))))) (define (crypto-devices) (define (crypto-device->cryptomount dev) (if (uuid? dev) #~(format port "cryptomount -u ~a~%" ;; cryptomount only accepts UUID without the hypen. #$(string-delete #\- (uuid->string dev))) ;; Other type of devices aren't implemented. #~())) (let ((devices (map crypto-device->cryptomount store-crypto-devices)) (modules #~(format port "insmod luks~%insmod luks2~%"))) (if (null? devices) devices (cons modules devices)))) (define (sugar) (let* ((entry (first all-entries)) (device (menu-entry-device entry)) (mount-point (menu-entry-device-mount-point entry))) (eye-candy config device mount-point #:store-directory-prefix store-directory-prefix #:port #~port))) (define locale-config (let* ((entry (first all-entries)) (device (menu-entry-device entry)) (mount-point (menu-entry-device-mount-point entry))) #~(let ((locale #$(and locale (locale-definition-source (locale-name->definition locale)))) (locales #$(and locale (normalize-file (grub-locale-directory grub) mount-point store-directory-prefix)))) (when locale (format port "\ # Localization configuration. ~asearch --file --set ~a/en@quot.mo set locale_dir=~a set lang=~a~%" ;; Skip the search if there is an image, as it has already ;; been performed by eye-candy and traversing the store is ;; an expensive operation. #$(if (grub-theme-image (bootloader-theme config)) "# " "") locales locales locale))))) (define keyboard-layout-config (let* ((layout (bootloader-configuration-keyboard-layout config)) (keymap* (and layout (keyboard-layout-file layout #:grub grub))) (entry (first all-entries)) (device (menu-entry-device entry)) (mount-point (menu-entry-device-mount-point entry)) (keymap (and keymap* (normalize-file keymap* mount-point store-directory-prefix)))) #~(when #$keymap (format port "\ insmod keylayouts keymap ~a~%" #$keymap)))) (define builder #~(call-with-output-file #$output (lambda (port) (format port "# This file was generated from your Guix configuration. Any changes # will be lost upon reconfiguration. ") #$@(crypto-devices) #$(sugar) #$locale-config #$keyboard-layout-config (format port " set default=~a set timeout=~a~%" #$(bootloader-configuration-default-entry config) #$(bootloader-configuration-timeout config)) #$@(map menu-entry->gexp all-entries) #$@(if (pair? old-entries) #~((format port " submenu \"GNU system, old configurations...\" {~%") #$@(map menu-entry->gexp old-entries) (format port "}~%")) #~()) (format port " if [ \"${grub_platform}\" == efi ]; then menuentry \"Firmware setup\" { fwsetup } fi~%")))) ;; Since this file is rather unique, there's no point in trying to ;; substitute it. (computed-file "grub.cfg" builder #:options '(#:local-build? #t #:substitutable? #f))) (define (grub-configuration-file config . args) (let* ((bootloader (bootloader-configuration-bootloader config)) (grub (bootloader-package bootloader))) (apply make-grub-configuration grub config args))) (define (grub-efi-configuration-file . args) (apply make-grub-configuration grub-efi args)) (define grub-cfg "/boot/grub/grub.cfg") ;;; ;;; Install procedures. ;;; (define install-grub #~(lambda (bootloader device mount-point) (let ((grub (string-append bootloader "/sbin/grub-install")) (install-dir (string-append mount-point "/boot"))) ;; Install GRUB on DEVICE which is mounted at MOUNT-POINT. If DEVICE ;; is #f, then we populate the disk-image rooted at MOUNT-POINT. (if device (begin ;; Tell 'grub-install' that there might be a LUKS-encrypted ;; /boot or root partition. (setenv "GRUB_ENABLE_CRYPTODISK" "y") ;; Hide potentially confusing messages from the user, such as ;; "Installing for i386-pc platform." (invoke/quiet grub "--no-floppy" "--target=i386-pc" "--boot-directory" install-dir device)) ;; When creating a disk-image, only install a font and GRUB modules. (let* ((fonts (string-append install-dir "/grub/fonts"))) (mkdir-p fonts) (copy-file (string-append bootloader "/share/grub/unicode.pf2") (string-append fonts "/unicode.pf2")) (copy-recursively (string-append bootloader "/lib/") install-dir)))))) (define install-grub-disk-image #~(lambda (bootloader root-index image) ;; Install GRUB on the given IMAGE. The root partition index is ;; ROOT-INDEX. (let ((grub-mkimage (string-append bootloader "/bin/grub-mkimage")) (modules '("biosdisk" "part_msdos" "fat" "ext2")) (grub-bios-setup (string-append bootloader "/sbin/grub-bios-setup")) (root-device (format #f "hd0,msdos~a" root-index)) (boot-img (string-append bootloader "/lib/grub/i386-pc/boot.img")) (device-map "device.map")) ;; Create a minimal, standalone GRUB image that will be written ;; directly in the MBR-GAP (space between the end of the MBR and the ;; first partition). (apply invoke grub-mkimage "-O" "i386-pc" "-o" "core.img" "-p" (format #f "(~a)/boot/grub" root-device) modules) ;; Create a device mapping file. (call-with-output-file device-map (lambda (port) (format port "(hd0) ~a~%" image))) ;; Copy the default boot.img, that will be written on the MBR sector ;; by GRUB-BIOS-SETUP. (copy-file boot-img "boot.img") ;; Install both the "boot.img" and the "core.img" files on the given ;; IMAGE. On boot, the MBR sector will execute the minimal GRUB ;; written in the MBR-GAP. GRUB configuration and missing modules will ;; be read from ROOT-DEVICE. (invoke grub-bios-setup "-m" device-map "-r" root-device "-d" "." image)))) (define* (make-grub-efi-installer #:key efi32? removable?) "Return a G-expression of a procedure for installing GRUB on a UEFI system. If EFI32? is #t, then a 32-bit target will be used. If REMOVABLE? is #t, GRUB will be installed for Removable Media Boot." (define extra-args (list (and efi32? #~(cond ((target-x86?) "--target=i386-efi") ((target-arm?) "--target=arm-efi"))) ;; This does not update UEFI boot entries, like --no-nvram. (and removable? "--removable"))) #~(lambda (bootloader efi-dir mount-point) ;; There is nothing useful to do when called in the context of a disk ;; image generation. (when efi-dir ;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the ;; system whose root is mounted at MOUNT-POINT. (let ((grub-install (string-append bootloader "/sbin/grub-install")) (install-dir (string-append mount-point "/boot")) ;; When installing Guix, it's common to mount EFI-DIR below ;; MOUNT-POINT rather than /boot/efi on the live image. (target-esp (if (file-exists? (string-append mount-point efi-dir)) (string-append mount-point efi-dir) efi-dir))) ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or ;; root partition. (setenv "GRUB_ENABLE_CRYPTODISK" "y") (invoke/quiet grub-install "--bootloader-id=Guix" "--boot-directory" install-dir "--efi-directory" target-esp #$@(filter identity extra-args)))))) (define* (make-grub-efi-netboot-installer grub-efi grub-cfg subdir) "Make a bootloader-installer for a grub-efi-netboot bootloader, which expects its files in SUBDIR and its configuration file in GRUB-CFG. As a grub-efi-netboot package is already pre-installed by 'grub-mknetdir', the installer basically copies all files from the bootloader-package (or profile) into the bootloader-target directory. Additionally for network booting over TFTP, two relative symlinks to the store and to the GRUB-CFG file are necessary. Due to this a TFTP root directory must not be located on a FAT file-system. If the bootloader-target does not support symlinks, then it is assumed to be a kind of EFI System Partition (ESP). In this case an intermediate configuration file is created with the help of GRUB-EFI to load the GRUB-CFG. The installer is usable for any efi-bootloader-chain, which prepares the bootloader-profile in a way ready for copying. The installer does not manipulate the system's 'UEFI Boot Manager'. The returned installer accepts the BOOTLOADER, TARGET and MOUNT-POINT arguments. Its job is to copy the BOOTLOADER, which must be a pre-installed grub-efi-netboot package with a SUBDIR like efi/boot or efi/Guix, below the directory TARGET for the system whose root is mounted at MOUNT-POINT. MOUNT-POINT is the last argument in 'guix system init /etc/config.scm mnt/point' or '/' for other 'guix system' commands. Where TARGET comes from the targets argument given to the bootloader-configuration in: (operating-system (bootloader (bootloader-configuration (targets '(\"/boot/efi\")) …)) …) TARGET is required to be an absolute directory name, usually mounted via NFS, and finally needs to be provided by a TFTP server as the TFTP root directory. Usually the installer will be used to prepare network booting over TFTP. Then GRUB will load tftp://server/SUBDIR/grub.cfg and this file will instruct it to load more files from the store like tftp://server/gnu/store/…-linux…/Image. To make this possible two symlinks are created. The first symlink points relatively form MOUNT-POINT/TARGET/SUBDIR/grub.cfg to MOUNT-POINT/boot/grub/grub.cfg, and the second symlink points relatively from MOUNT-POINT/TARGET/%store-prefix to MOUNT-POINT/%store-prefix. It is important to note that these symlinks need to be relative, as the absolute paths on the TFTP server side are unknown. It is also important to note that both symlinks will point outside the TFTP root directory and that the TARGET/%store-prefix symlink makes the whole store accessible via TFTP. Possibly the TFTP server must be configured to allow accesses outside its TFTP root directory. This all may need to be considered for security aspects. It is advised to disable any TFTP write access! The installer can also be used to prepare booting from local storage, if the underlying file-system, like FAT on an EFI System Partition (ESP), does not support symlinks. In this case the MOUNT-POINT/TARGET/SUBDIR/grub.cfg will be created with the help of GRUB-EFI to load the /boot/grub/grub.cfg file. A symlink to the store is not needed in this case." (with-imported-modules '((guix build union)) #~(lambda (bootloader target mount-point) ;; In context of a disk image creation TARGET will be #f and an ;; installer is expected to do necessary installations on MOUNT-POINT, ;; which will become the root file system. If TARGET is #f, this ;; installer has nothing to do, as it only cares about the EFI System ;; Partition (ESP). (when target (use-modules ((guix build union) #:select (symlink-relative)) (ice-9 popen) (ice-9 rdelim)) (let* ((mount-point/target (string-append mount-point target "/")) ;; When installing Guix, it is common to mount TARGET below ;; MOUNT-POINT rather than the root directory. (bootloader-target (if (file-exists? mount-point/target) mount-point/target target)) (store (string-append mount-point (%store-prefix))) (store-link (string-append bootloader-target (%store-prefix))) (grub-cfg (string-append mount-point #$grub-cfg)) (grub-cfg-link (string-append bootloader-target #$subdir "/" (basename grub-cfg)))) ;; Copy the bootloader into the bootloader-target directory. ;; Should we beforehand recursively delete any existing file? (copy-recursively bootloader bootloader-target #:follow-symlinks? #t #:log (%make-void-port "w")) ;; For TFTP we need to install additional relative symlinks. ;; If we install on an EFI System Partition (ESP) or some other FAT ;; file-system, then symlinks cannot be created and are not needed. ;; Therefore we ignore exceptions when trying. ;; Prepare the symlink to the grub.cfg. (mkdir-p (dirname grub-cfg-link)) (false-if-exception (delete-file grub-cfg-link)) (if (unspecified? (false-if-exception (symlink-relative grub-cfg grub-cfg-link))) ;; Symlinks are supported. (begin ;; Prepare the symlink to the store. (mkdir-p (dirname store-link)) (false-if-exception (delete-file store-link)) (symlink-relative store store-link)) ;; Creating symlinks does not seem to be supported. Probably ;; an ESP is used. Add a script to search and load the actual ;; grub.cfg. (let* ((probe #$(file-append grub-efi "/sbin/grub-probe")) (port (open-pipe* OPEN_READ probe "--target=fs_uuid" grub-cfg)) (search-root (match (read-line port) ((? eof-object?) ;; There is no UUID available. As a fallback search ;; everywhere for the grub.cfg. (string-append "search --file --set " #$grub-cfg)) (fs-uuid ;; The UUID to load the grub.cfg from is known. (string-append "search --fs-uuid --set " fs-uuid)))) (load-grub-cfg (string-append "configfile " #$grub-cfg))) (close-pipe port) (with-output-to-file grub-cfg-link (lambda () (display (string-join (list search-root load-grub-cfg) "\n"))))))))))) ;;; ;;; Bootloader definitions. ;;; ;;; For all these grub-bootloader variables the path to /boot/grub/grub.cfg ;;; is fixed. Inheriting and overwriting the field 'configuration-file' will ;;; break 'guix system delete-generations', 'guix system switch-generation', ;;; and 'guix system roll-back'. (define grub-bootloader (bootloader (name 'grub) (package grub) (installer install-grub) (disk-image-installer install-grub-disk-image) (configuration-file grub-cfg) (configuration-file-generator grub-configuration-file))) (define grub-minimal-bootloader (bootloader (inherit grub-bootloader) (package grub-minimal))) (define grub-efi-bootloader (bootloader (name 'grub-efi) (package grub-efi) (installer (make-grub-efi-installer)) (disk-image-installer #f) (configuration-file grub-cfg) (configuration-file-generator grub-configuration-file))) (define grub-efi-removable-bootloader (bootloader (inherit grub-efi-bootloader) (name 'grub-efi-removable-bootloader) (installer (make-grub-efi-installer #:removable? #t)))) (define grub-efi32-bootloader (bootloader (inherit grub-efi-bootloader) (installer (make-grub-efi-installer #:efi32? #t)) (name 'grub-efi32) (package grub-efi32))) (define (make-grub-efi-netboot-bootloader name subdir) (bootloader (name name) (package (make-grub-efi-netboot (symbol->string name) subdir)) (installer (make-grub-efi-netboot-installer grub-efi grub-cfg subdir)) (disk-image-installer #f) (configuration-file grub-cfg) (configuration-file-generator grub-efi-configuration-file))) (define grub-efi-netboot-bootloader (make-grub-efi-netboot-bootloader 'grub-efi-netboot-bootloader "efi/Guix")) (define grub-efi-netboot-removable-bootloader (make-grub-efi-netboot-bootloader 'grub-efi-netboot-removable-bootloader "efi/boot")) (define grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) (package grub-hybrid))) ;;; ;;; Compatibility macros. ;;; (define-syntax grub-configuration (syntax-rules (grub) ((_ (grub package) fields ...) (if (eq? package grub) (bootloader-configuration (bootloader grub-bootloader) fields ...) (bootloader-configuration (bootloader grub-efi-bootloader) fields ...))) ((_ fields ...) (bootloader-configuration (bootloader grub-bootloader) fields ...)))) ;;; ;;; Deprecated bootloader and installer variables. ;;; (define-deprecated/alias install-grub-efi-removable (make-grub-efi-installer #:removable? #t)) ;;; grub.scm ends here