gnu: gnumeric: Update to 1.12.48.
[jackhill/guix/guix.git] / gnu / image.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu image)
20 #:use-module (guix records)
21 #:export (partition
22 partition?
23 partition-device
24 partition-size
25 partition-offset
26 partition-file-system
27 partition-file-system-options
28 partition-label
29 partition-uuid
30 partition-flags
31 partition-initializer
32
33 image
34 image-name
35 image-format
36 image-target
37 image-size
38 image-operating-system
39 image-partitions
40 image-compression?
41 image-volatile-root?
42 image-substitutable?
43
44 image-type
45 image-type?
46 image-type-name
47 image-type-constructor
48
49 os->image))
50
51 \f
52 ;;;
53 ;;; Partition record.
54 ;;;
55
56 (define-record-type* <partition> partition make-partition
57 partition?
58 (device partition-device (default #f))
59 (size partition-size)
60 (offset partition-offset (default 0))
61 (file-system partition-file-system (default "ext4"))
62 (file-system-options partition-file-system-options
63 (default '()))
64 (label partition-label (default #f))
65 (uuid partition-uuid (default #f))
66 (flags partition-flags (default '()))
67 (initializer partition-initializer (default #f)))
68
69 \f
70 ;;;
71 ;;; Image record.
72 ;;;
73
74 (define-record-type* <image>
75 image make-image
76 image?
77 (name image-name ;symbol
78 (default #f))
79 (format image-format) ;symbol
80 (target image-target
81 (default #f))
82 (size image-size ;size in bytes as integer
83 (default 'guess))
84 (operating-system image-operating-system ;<operating-system>
85 (default #f))
86 (partitions image-partitions ;list of <partition>
87 (default '()))
88 (compression? image-compression? ;boolean
89 (default #t))
90 (volatile-root? image-volatile-root? ;boolean
91 (default #t))
92 (substitutable? image-substitutable? ;boolean
93 (default #t)))
94
95 \f
96 ;;;
97 ;;; Image type.
98 ;;;
99
100 (define-record-type* <image-type>
101 image-type make-image-type
102 image-type?
103 (name image-type-name) ;symbol
104 (constructor image-type-constructor)) ;<operating-system> -> <image>
105
106 \f
107 ;;;
108 ;;; Image creation.
109 ;;;
110
111 (define* (os->image os #:key type)
112 (let ((constructor (image-type-constructor type)))
113 (constructor os)))