gnu: libksba: Update to 1.3.2 [security fix].
[jackhill/guix/guix.git] / gnu / system / file-systems.scm
CommitLineData
c5df1839
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
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 system file-systems)
722554a3 20 #:use-module (guix gexp)
c5df1839
LC
21 #:use-module (guix records)
22 #:export (<file-system>
23 file-system
24 file-system?
25 file-system-device
d4c87617 26 file-system-title
c5df1839
LC
27 file-system-mount-point
28 file-system-type
29 file-system-needed-for-boot?
30 file-system-flags
31 file-system-options
4e469051
LC
32 file-system-check?
33 file-system-create-mount-point?
c5df1839
LC
34
35 %fuse-control-file-system
a69576ea 36 %binary-format-file-system
705f8b68
MW
37 %shared-memory-file-system
38 %pseudo-terminal-file-system
a69576ea
LC
39 %devtmpfs-file-system
40
5dae0186
LC
41 %base-file-systems
42
43 mapped-device
44 mapped-device?
45 mapped-device-source
46 mapped-device-target
722554a3
LC
47 mapped-device-type
48
49 mapped-device-kind
50 mapped-device-kind?
51 mapped-device-kind-open
52 mapped-device-kind-close))
c5df1839
LC
53
54;;; Commentary:
55;;;
56;;; Declaring file systems to be mounted.
57;;;
58;;; Code:
59
60;; File system declaration.
61(define-record-type* <file-system> file-system
62 make-file-system
63 file-system?
64 (device file-system-device) ; string
d4c87617
LC
65 (title file-system-title ; 'device | 'label | 'uuid
66 (default 'device))
c5df1839
LC
67 (mount-point file-system-mount-point) ; string
68 (type file-system-type) ; string
69 (flags file-system-flags ; list of symbols
70 (default '()))
71 (options file-system-options ; string or #f
72 (default #f))
73 (needed-for-boot? file-system-needed-for-boot? ; Boolean
74 (default #f))
75 (check? file-system-check? ; Boolean
4e469051
LC
76 (default #t))
77 (create-mount-point? file-system-create-mount-point? ; Boolean
78 (default #f)))
c5df1839
LC
79
80(define %fuse-control-file-system
81 ;; Control file system for Linux' file systems in user-space (FUSE).
82 (file-system
83 (device "fusectl")
84 (mount-point "/sys/fs/fuse/connections")
85 (type "fusectl")
86 (check? #f)))
87
88(define %binary-format-file-system
89 ;; Support for arbitrary executable binary format.
90 (file-system
91 (device "binfmt_misc")
92 (mount-point "/proc/sys/fs/binfmt_misc")
93 (type "binfmt_misc")
94 (check? #f)))
95
a69576ea
LC
96(define %devtmpfs-file-system
97 ;; /dev as a 'devtmpfs' file system, needed for udev.
98 (file-system
99 (device "none")
100 (mount-point "/dev")
101 (type "devtmpfs")
7f239fd3
LC
102 (check? #f)
103
104 ;; Mount it from the initrd so /dev/pts & co. can then be mounted over it.
105 (needed-for-boot? #t)))
106
107(define %tty-gid
108 ;; ID of the 'tty' group. Allocate it statically to make it easy to refer
109 ;; to it from here and from the 'tty' group definitions.
c8fa3426 110 996)
7f239fd3
LC
111
112(define %pseudo-terminal-file-system
113 ;; The pseudo-terminal file system. It needs to be mounted so that
114 ;; statfs(2) returns DEVPTS_SUPER_MAGIC like libc's getpt(3) expects (and
115 ;; thus openpty(3) and its users, such as xterm.)
116 (file-system
117 (device "none")
118 (mount-point "/dev/pts")
119 (type "devpts")
120 (check? #f)
121 (needed-for-boot? #f)
122 (create-mount-point? #t)
123 (options (string-append "gid=" (number->string %tty-gid) ",mode=620"))))
a69576ea 124
db17ae5c
LC
125(define %shared-memory-file-system
126 ;; Shared memory.
127 (file-system
128 (device "tmpfs")
129 (mount-point "/dev/shm")
130 (type "tmpfs")
131 (check? #f)
132 (flags '(no-suid no-dev))
133 (options "size=50%") ;TODO: make size configurable
134 (create-mount-point? #t)))
135
a69576ea
LC
136(define %base-file-systems
137 ;; List of basic file systems to be mounted. Note that /proc and /sys are
138 ;; currently mounted by the initrd.
7f239fd3 139 (list %devtmpfs-file-system
db17ae5c
LC
140 %pseudo-terminal-file-system
141 %shared-memory-file-system))
a69576ea 142
5dae0186
LC
143
144\f
145;;;
146;;; Mapped devices, for Linux's device-mapper.
147;;;
148
149(define-record-type* <mapped-device> mapped-device
150 make-mapped-device
151 mapped-device?
152 (source mapped-device-source) ;string
153 (target mapped-device-target) ;string
722554a3
LC
154 (type mapped-device-type)) ;<mapped-device-kind>
155
156(define-record-type* <mapped-device-type> mapped-device-kind
157 make-mapped-device-kind
158 mapped-device-kind?
159 (open mapped-device-kind-open) ;source target -> gexp
160 (close mapped-device-kind-close ;source target -> gexp
161 (default (const #~(const #f)))))
5dae0186 162
c5df1839 163;;; file-systems.scm ends here