gnu: Add mergerfs.
[jackhill/guix/guix.git] / gnu / packages / file-systems.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
3 ;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com>
4 ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2018 Leo Famulari <leo@famulari.name>
6 ;;; Copyright © 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages file-systems)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix git-download)
29 #:use-module (guix build-system cmake)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system linux-module)
32 #:use-module (guix build-system trivial)
33 #:use-module (guix utils)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages acl)
36 #:use-module (gnu packages attr)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages bison)
39 #:use-module (gnu packages check)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages crypto)
42 #:use-module (gnu packages curl)
43 #:use-module (gnu packages datastructures)
44 #:use-module (gnu packages documentation)
45 #:use-module (gnu packages docbook)
46 #:use-module (gnu packages flex)
47 #:use-module (gnu packages glib)
48 #:use-module (gnu packages gnupg)
49 #:use-module (gnu packages libffi)
50 #:use-module (gnu packages linux)
51 #:use-module (gnu packages nfs)
52 #:use-module (gnu packages onc-rpc)
53 #:use-module (gnu packages photo)
54 #:use-module (gnu packages pkg-config)
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages readline)
57 #:use-module (gnu packages sqlite)
58 #:use-module (gnu packages tls)
59 #:use-module (gnu packages valgrind)
60 #:use-module (gnu packages xml))
61
62 (define-public fsarchiver
63 (package
64 (name "fsarchiver")
65 (version "0.8.5")
66 (source
67 (origin
68 (method git-fetch)
69 (uri
70 (git-reference
71 (url "https://github.com/fdupoux/fsarchiver.git")
72 (commit version)))
73 (file-name (git-file-name name version))
74 (sha256
75 (base32 "1rvwq5v3rl14bqxjm1ibfapyicf0sa44nw7451v10kx39lp56ylp"))))
76 (build-system gnu-build-system)
77 (native-inputs
78 `(("autoconf" ,autoconf)
79 ("automake" ,automake)
80 ("pkg-config" ,pkg-config)))
81 (inputs
82 `(("bzip2" ,bzip2)
83 ("e2fsprogs" ,e2fsprogs)
84 ("libgcrypt" ,libgcrypt)
85 ("lz4" ,lz4)
86 ("lzo" ,lzo)
87 ("util-linux" ,util-linux "lib")
88 ("xz" ,xz)
89 ("zlib" ,zlib)
90 ("zstd:lib" ,zstd "lib")))
91 (synopsis "File system back-up, deployment, and migration tool")
92 (description
93 "FSArchiver saves the contents of a file system to a compressed archive
94 file, and restores it to a different file system and/or partition. This
95 partition can be of a different size than the original and FSArchiver will
96 create a new file system if none exists.
97
98 All standard file attributes supported by the kernel are preserved, including
99 file permissions, timestamps, symbolic and hard links, and extended attributes.
100
101 Each file in the archive is protected by a checksum. If part of the archive
102 is corrupted you'll lose the affected file(s) but not the whole back-up.")
103 (home-page "http://www.fsarchiver.org/")
104 (license license:gpl2)))
105
106 (define-public gphotofs
107 (package
108 (name "gphotofs")
109 (version "0.5.0")
110 (source
111 (origin
112 (method url-fetch)
113 (uri
114 (string-append "mirror://sourceforge/gphoto/gphotofs/" version
115 "/gphotofs-0.5.tar.gz"))
116 (sha256
117 (base32
118 "04slwhr6ap9xcc27wphk22ad8yn79ngyy5z10lxams3k5liahvc2"))))
119 (build-system gnu-build-system)
120 (native-inputs
121 `(("pkg-config" ,pkg-config)))
122 (inputs
123 `(("fuse" ,fuse)
124 ("glib" ,glib)
125 ("libgphoto2" ,libgphoto2)))
126 (synopsis "Virtual filesystem for libgphoto2 using FUSE")
127 (description "GPhotoFS is a FUSE filesystem module to mount your camera as
128 a filesystem on Linux. This allow using your camera with any tool able to read
129 from a mounted filesystem.")
130 (home-page "http://www.gphoto.org/proj/gphotofs/")
131 (license license:gpl2+)))
132
133 (define-public bcachefs-tools
134 (let ((commit "ab2f1ec24f5307b0cf1e3c4ad19bf350d9f54d9f")
135 (revision "0"))
136 (package
137 (name "bcachefs-tools")
138 (version (git-version "0.1" revision commit))
139 (source
140 (origin
141 (method git-fetch)
142 (uri (git-reference
143 (url "https://evilpiepirate.org/git/bcachefs-tools.git")
144 (commit commit)))
145 (file-name (git-file-name name version))
146 (sha256
147 (base32 "10pafvaxg1lvwnqjv3a4rsi96bghbpcsgh3vhqilndi334k3b0hd"))))
148 (build-system gnu-build-system)
149 (arguments
150 `(#:make-flags
151 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
152 "INITRAMFS_DIR=$(PREFIX)/share/initramfs-tools"
153 "CC=gcc"
154 "PYTEST=pytest")
155 #:phases
156 (modify-phases %standard-phases
157 (delete 'configure)) ; no configure script
158 #:tests? #f)) ; XXX 6 valgrind tests fail
159 (native-inputs
160 `(("pkg-config" ,pkg-config)
161
162 ;; For tests.
163 ("python-pytest" ,python-pytest)
164 ("valgrind" ,valgrind)))
165 (inputs
166 `(("keyutils" ,keyutils)
167 ("libaio" ,libaio)
168 ("libscrypt" ,libscrypt)
169 ("libsodium" ,libsodium)
170 ("liburcu" ,liburcu)
171 ("util-linux" ,util-linux "lib") ; lib{blkid,uuid}
172 ("lz4" ,lz4)
173 ("zlib" ,zlib)
174 ("zstd:lib" ,zstd "lib")))
175 (home-page "https://bcachefs.org/")
176 (synopsis "Tools to create and manage bcachefs file systems")
177 (description
178 "The bcachefs-tools are command-line utilities for creating, checking,
179 and otherwise managing bcachefs file systems.
180
181 Bcachefs is a @acronym{CoW, copy-on-write} file system supporting native
182 encryption, compression, snapshots, and (meta)data checksums. It can use
183 multiple block devices for replication and/or performance, similar to RAID.
184
185 In addition, bcachefs provides all the functionality of bcache, a block-layer
186 caching system, and lets you assign different roles to each device based on its
187 performance and other characteristics.")
188 (license license:gpl2+))))
189
190 (define-public exfatprogs
191 (package
192 (name "exfatprogs")
193 (version "1.0.3")
194 (source
195 (origin
196 (method git-fetch)
197 (uri (git-reference
198 (url "https://github.com/exfatprogs/exfatprogs")
199 (commit version)))
200 (file-name (git-file-name name version))
201 (sha256
202 (base32
203 "1s47qvhr702z5c19wfqz8cwl9ammmincs7a8vjc6p974wnnjg77y"))))
204 (build-system gnu-build-system)
205 (arguments
206 `(#:configure-flags
207 (list "--disable-static")))
208 (native-inputs
209 `(("autoconf" ,autoconf)
210 ("automake" ,automake)
211 ("libtool" ,libtool)
212 ("pkg-config" ,pkg-config)))
213 (home-page "https://github.com/exfatprogs/exfatprogs")
214 (synopsis "Tools to create, check, and repair exFAT file systems")
215 (description
216 "These are command-line user space tools for the @acronym{exFAT,
217 Extensible File Allocation Table} file systems. Included are
218 @command{mkfs.exfat} to create (format) new exFAT file systems, and
219 @command{fsck.exfat} to check their consistency and repair them.")
220 (license license:gpl2+)))
221
222 (define-public httpfs2
223 (package
224 (name "httpfs2")
225 (version "0.1.5")
226 (source
227 (origin
228 (method url-fetch)
229 (uri (string-append "mirror://sourceforge/httpfs/httpfs2/"
230 "httpfs2-" version ".tar.gz"))
231 (sha256
232 (base32
233 "1h8ggvhw30n2r6w11n1s458ypggdqx6ldwd61ma4yd7binrlpjq1"))))
234 (build-system gnu-build-system)
235 (native-inputs
236 `(("asciidoc" ,asciidoc)
237 ("docbook-xml" ,docbook-xml)
238 ("libxml2" ,libxml2)
239 ("libxslt" ,libxslt)
240 ("pkg-config" ,pkg-config)))
241 (inputs
242 `(("fuse" ,fuse)
243 ("gnutls" ,gnutls)))
244 (arguments
245 `(#:phases
246 (modify-phases %standard-phases
247 (delete 'configure) ; no configure script
248 (replace 'install
249 ;; There's no ‘install’ target. Install all variants manually.
250 (lambda* (#:key outputs #:allow-other-keys)
251 (let* ((out (assoc-ref outputs "out"))
252 (bin (string-append out "/bin"))
253 (man1 (string-append out "/share/man/man1")))
254 (mkdir-p bin)
255 (mkdir-p man1)
256 (for-each
257 (lambda (variant)
258 (let ((man1-page (string-append variant ".1")))
259 (install-file variant bin)
260 (install-file man1-page man1)))
261 (list "httpfs2"
262 "httpfs2-mt"
263 "httpfs2-ssl"
264 "httpfs2-ssl-mt")))
265 #t)))
266 #:make-flags (list "CC=gcc")
267 #:parallel-build? #f ; can result in missing man pages
268 #:tests? #f)) ; no tests
269 (home-page "https://sourceforge.net/projects/httpfs/")
270 (synopsis "Mount remote files over HTTP")
271 (description "httpfs2 is a @code{fuse} file system for mounting any
272 @dfn{HyperText} (HTTP or HTTPS) URL. It uses HTTP/1.1 byte ranges to request
273 arbitrary bytes from the web server, without needing to download the entire
274 file. This is particularly useful with large archives such as ZIP files and
275 ISO images when you only need to inspect their contents or extract specific
276 files. Since the HTTP protocol itself has no notion of directories, only a
277 single file can be mounted.")
278 (license license:gpl2+)))
279
280 (define-public jfsutils
281 (package
282 (name "jfsutils")
283 (version "1.1.15")
284 (source
285 (origin
286 (method url-fetch)
287 (uri (string-append "http://jfs.sourceforge.net/project/pub/jfsutils-"
288 version ".tar.gz"))
289 (sha256
290 (base32 "0kbsy2sk1jv4m82rxyl25gwrlkzvl3hzdga9gshkxkhm83v1aji4"))
291 (patches (search-patches "jfsutils-add-sysmacros.patch"
292 "jfsutils-include-systypes.patch"))))
293 (build-system gnu-build-system)
294 (inputs
295 `(("util-linux" ,util-linux "lib")))
296 (home-page "http://jfs.sourceforge.net/home.html")
297 (synopsis "Utilities for managing JFS file systems")
298 (description
299 "The JFSutils are a collection of utilities for managing the @acronym{JFS,
300 Journaled File System}, a 64-bit journaling file system created by IBM and later
301 ported to the kernel Linux. The following commands are available:
302 @enumerate
303 @item @command{fsck.jfs}: check and repair a JFS file system or replay its
304 transaction log.
305 @item @command{logdump}: dump the JFS journal log.
306 @item @command{logredo}: replay the JFS journal log.
307 @item @command{mkfs.jfs}: create a new JFS file system.
308 @item @command{xchklog}: save a JFS fsck log to a file.
309 @item @command{xchkdmp}: dump the contents of such a log file.
310 @item @command{xpeek}: a JFS file system editor with a shell-like interface.
311 @end enumerate\n")
312 (license license:gpl3+))) ; no explicit version given
313
314 (define-public jfsutils/static
315 (static-package
316 (package
317 (inherit jfsutils)
318 (name "jfsutils-static")
319 (inputs
320 `(("util-linux:static" ,util-linux "static")
321 ,@(package-inputs jfsutils))))))
322
323 (define-public jfs_fsck/static
324 (package
325 (name "jfs_fsck-static")
326 (version (package-version jfsutils))
327 (source #f)
328 (build-system trivial-build-system)
329 (arguments
330 `(#:modules ((guix build utils))
331 #:builder
332 (begin
333 (use-modules (guix build utils)
334 (ice-9 ftw)
335 (srfi srfi-26))
336 (let* ((jfsutils (assoc-ref %build-inputs "jfsutils"))
337 (fsck "jfs_fsck")
338 (out (assoc-ref %outputs "out"))
339 (sbin (string-append out "/sbin")))
340 (mkdir-p sbin)
341 (with-directory-excursion sbin
342 (install-file (string-append jfsutils "/sbin/" fsck)
343 ".")
344 (remove-store-references fsck)
345 (chmod fsck #o555))
346 #t))))
347 (inputs
348 `(("jfsutils" ,jfsutils/static)))
349 (home-page (package-home-page jfsutils))
350 (synopsis "Statically-linked jfs_fsck command from jfsutils")
351 (description "This package provides statically-linked jfs_fsck command taken
352 from the jfsutils package. It is meant to be used in initrds.")
353 (license (package-license jfsutils))))
354
355 (define-public disorderfs
356 (package
357 (name "disorderfs")
358 (version "0.5.10")
359 (source
360 (origin
361 (method git-fetch)
362 (uri (git-reference
363 (url "https://salsa.debian.org/reproducible-builds/disorderfs.git")
364 (commit version)))
365 (file-name (git-file-name name version))
366 (sha256
367 (base32
368 "0lsisx5118k0qk0b5klbxl03rvhycnznyfx05yxmjawh85bfhmlh"))))
369 (build-system gnu-build-system)
370 (native-inputs
371 `(("pkg-config" ,pkg-config)))
372 (inputs
373 `(("fuse" ,fuse)
374 ("attr" ,attr)))
375 (arguments
376 `(#:phases (modify-phases %standard-phases
377 (delete 'configure)) ; no configure script
378 #:make-flags (let ((out (assoc-ref %outputs "out")))
379 (list (string-append "PREFIX=" out)))
380 #:test-target "test"
381 ;; FIXME: Tests require 'run-parts' which is not in Guix yet.
382 #:tests? #f))
383 (home-page "https://salsa.debian.org/reproducible-builds/disorderfs")
384 (synopsis "FUSE file system that introduces non-determinism")
385 (description
386 "An overlay FUSE file system that introduces non-determinism
387 into file system metadata. For example, it can randomize the order
388 in which directory entries are read. This is useful for detecting
389 non-determinism in the build process.")
390 (license license:gpl3+)))
391
392 (define-public glusterfs
393 (package
394 (name "glusterfs")
395 (version "7.0")
396 (source
397 (origin
398 (method url-fetch)
399 (uri (string-append "https://download.gluster.org/pub/gluster/glusterfs/"
400 (version-major version) "/"
401 (version-major+minor version) "/"
402 "glusterfs-" version ".tar.gz"))
403 (sha256
404 (base32
405 "0yzhx710ypj0j3m5dcgmmgvkp7p0rmmp2p7ld0axrm4vpwc2b1wa"))))
406 (build-system gnu-build-system)
407 (arguments
408 `(#:configure-flags
409 (let ((out (assoc-ref %outputs "out"))
410 (p2 (assoc-ref %build-inputs "python-2")))
411 (list (string-append "PYTHON=" p2 "/bin/python")
412 (string-append "--with-initdir=" out "/etc/init.d")
413 (string-append "--with-mountutildir=" out "/sbin")
414 "--enable-cmocka" ; unit tests
415 ;; "--enable-debug" ; debug build options
416 ;; "--enable-asan" ; Address Sanitizer
417 ;; "--enable-tsan" ; ThreadSanitizer
418 ))
419 #:phases
420 (modify-phases %standard-phases
421 (add-before 'configure 'autogen
422 (lambda _ (invoke "./autogen.sh"))))))
423 (native-inputs
424 `(("pkg-config" ,pkg-config)
425 ("libtirpc", libtirpc)
426 ("rpcsvc-proto", rpcsvc-proto)
427 ("python-2" ,python-2) ; must be version 2
428 ("flex" ,flex)
429 ("bison" ,bison)
430 ("libtool" ,libtool)
431 ("autoconf" ,autoconf)
432 ("automake" ,automake)
433 ("cmocka" ,cmocka)))
434 (inputs
435 `(("acl" ,acl)
436 ("fuse", fuse)
437 ("openssl" ,openssl)
438 ("liburcu" ,liburcu)
439 ("libuuid" ,util-linux "lib")
440 ("libxml2" ,libxml2)
441 ("readline" ,readline)
442 ("zlib" ,zlib)
443 ("libaio", libaio)
444 ("rdma-core", rdma-core)))
445 (home-page "https://www.gluster.org")
446 (synopsis "Distributed file system")
447 (description "GlusterFS is a distributed scalable network file system
448 suitable for data-intensive tasks such as cloud storage and media streaming.
449 It allows rapid provisioning of additional storage based on your storage
450 consumption needs. It incorporates automatic failover as a primary feature.
451 All of this is accomplished without a centralized metadata server.")
452 ;; The user may choose either LGPLv3+ or GPLv2 only.
453 (license (list license:lgpl3+ license:gpl2+))))
454
455 (define-public curlftpfs
456 (package
457 (name "curlftpfs")
458 (version "0.9.2")
459 (source
460 (origin
461 (method url-fetch)
462 (uri (string-append "mirror://sourceforge/curlftpfs/curlftpfs/" version
463 "/curlftpfs-" version ".tar.gz"))
464 (sha256
465 (base32
466 "0n397hmv21jsr1j7zx3m21i7ryscdhkdsyqpvvns12q7qwwlgd2f"))))
467 (build-system gnu-build-system)
468 (arguments
469 `(#:phases
470 (modify-phases %standard-phases
471 (add-after 'unpack 'fix-test
472 (lambda _
473 ;; One of the 512-Byte block counts is definitely wrong.
474 ;; See <https://sourceforge.net/p/curlftpfs/bugs/73/>.
475 (substitute* "tests/ftpfs-ls_unittest.c"
476 (("4426192") "12814800"))
477 #t)))))
478 (inputs
479 `(("curl" ,curl)
480 ("glib" ,glib)
481 ("fuse" ,fuse)))
482 (native-inputs
483 `(("pkg-config" ,pkg-config)))
484 (home-page "http://curlftpfs.sourceforge.net/")
485 (synopsis "Mount remote file systems over FTP")
486 (description
487 "This is a file system client based on the FTP File Transfer Protocol.")
488 (license license:gpl2+)))
489
490 (define-public libnfs
491 (package
492 (name "libnfs")
493 (version "3.0.0")
494 (source (origin
495 (method git-fetch)
496 (uri (git-reference
497 (url "https://github.com/sahlberg/libnfs.git")
498 (commit (string-append "libnfs-" version))))
499 (file-name (git-file-name name version))
500 (sha256
501 (base32
502 "115p55y2cbs92z5lmcnjx1v29lwinpgq4sha9v1kq1vd8674h404"))))
503 (build-system gnu-build-system)
504 (home-page "https://github.com/sahlberg/libnfs")
505 (native-inputs
506 `(("autoconf" ,autoconf)
507 ("automake" ,automake)
508 ("libtool" ,libtool)
509 ("pkg-config" ,pkg-config)))
510 (synopsis "Client library for accessing NFS shares")
511 (description "LIBNFS is a client library for accessing NFS shares over a
512 network. LIBNFS offers three different APIs, for different use :
513
514 @enumerate
515 @item RAW, a fully asynchronous low level RPC library for NFS protocols. This
516 API provides very flexible and precise control of the RPC issued.
517 @item NFS ASYNC, a fully asynchronous library for high level vfs functions
518 @item NFS SYNC, a synchronous library for high level vfs functions.
519 @end enumerate\n")
520 (license (list license:lgpl2.1+ ; library
521 license:gpl3+ ; tests
522 license:bsd-3 ; copied nsf4 files
523 ))))
524
525 (define-public apfs-fuse
526 ;; Later versions require FUSE 3.
527 (let ((commit "7b89418e8dc27103d3c4f8fa348086ffcd634c17")
528 (revision "1"))
529 (package
530 (name "apfs-fuse")
531 (version (git-version "0.0.0" revision commit))
532 (source (origin
533 (method git-fetch)
534 (uri (git-reference
535 (url "https://github.com/sgan81/apfs-fuse")
536 (recursive? #t) ; for lzfse
537 (commit commit)))
538 (sha256
539 (base32
540 "0x2siy3cmnm9wsdfazg3xc8r3kbg73gijmnn1vjw33pp71ckylxr"))
541 (file-name (git-file-name name version))))
542 (build-system cmake-build-system)
543 (arguments
544 `(#:tests? #f ; No test suite
545 #:configure-flags
546 '("-DUSE_FUSE3=OFF") ; FUSE 3 is not packaged yet.
547 #:phases
548 (modify-phases %standard-phases
549 ;; No 'install' target in CMakeLists.txt
550 (replace 'install
551 (lambda* (#:key outputs #:allow-other-keys)
552 (let* ((out (assoc-ref outputs "out"))
553 (bin (string-append out "/bin"))
554 (lib (string-append out "/lib"))
555 (doc (string-append out "/share/doc/"
556 (string-append ,name "-" ,version))))
557 (install-file "apfs-dump" bin)
558 (install-file "apfs-dump-quick" bin)
559 (install-file "apfs-fuse" bin)
560 (install-file "libapfs.a" lib)
561 (install-file "../source/README.md" doc)
562 #t))))))
563 (inputs
564 `(("bzip2" ,bzip2)
565 ("fuse" ,fuse)
566 ("zlib" ,zlib)))
567 (synopsis "Read-only FUSE driver for the APFS file system")
568 (description "APFS-FUSE is a read-only FUSE driver for the @dfn{Apple File
569 System} (APFS). It is currently in an experimental state — it may not be able
570 to read all files, and it does not support all the compression methods in
571 APFS.")
572 (home-page "https://github.com/sgan81/apfs-fuse")
573 (license license:gpl2+))))
574
575 (define-public zfs
576 (package
577 (name "zfs")
578 (version "0.8.2")
579 (outputs '("out" "module" "src"))
580 (source
581 (origin
582 (method url-fetch)
583 (uri (string-append "https://github.com/zfsonlinux/zfs/releases"
584 "/download/zfs-" version
585 "/zfs-" version ".tar.gz"))
586 (sha256
587 (base32
588 "1f7aig15q3z832pr2n48j3clafic2yk1vvqlh28vpklfghjqwq27"))))
589 (build-system linux-module-build-system)
590 (arguments
591 `(;; The ZFS kernel module should not be downloaded since the license
592 ;; terms don't allow for distributing it, only building it locally.
593 #:substitutable? #f
594 ;; Tests cannot run in an unprivileged build environment.
595 #:tests? #f
596 #:phases
597 (modify-phases %standard-phases
598 (add-after 'configure 'really-configure
599 (lambda* (#:key outputs inputs #:allow-other-keys)
600 (let ((out (assoc-ref outputs "out")))
601 (substitute* "configure"
602 (("-/bin/sh") (string-append "-" (which "sh")))
603 ((" /bin/sh") (string-append " " (which "sh"))))
604 (invoke "./configure"
605 "--with-config=all"
606 (string-append "--prefix=" out)
607 (string-append "--with-dracutdir=" out "/lib/dracut")
608 (string-append "--with-udevdir=" out "/lib/udev")
609 (string-append "--with-mounthelperdir=" out "/sbin")
610 (string-append "--with-linux="
611 (assoc-ref inputs "linux-module-builder")
612 "/lib/modules/build")))))
613 (add-after 'unpack 'patch-source
614 (lambda* (#:key inputs outputs #:allow-other-keys)
615 (let ((out (assoc-ref outputs "out"))
616 (src (assoc-ref outputs "src"))
617 (util-linux (assoc-ref inputs "util-linux"))
618 (nfs-utils (assoc-ref inputs "nfs-utils")))
619 (substitute* "module/zfs/zfs_ctldir.c"
620 (("/usr/bin/env\", \"umount")
621 (string-append util-linux "/bin/umount\", \"-n"))
622 (("/usr/bin/env\", \"mount")
623 (string-append util-linux "/bin/mount\", \"-n")))
624 (substitute* "lib/libzfs/libzfs_mount.c"
625 (("/bin/mount") (string-append util-linux "/bin/mount"))
626 (("/bin/umount") (string-append util-linux "/bin/umount")))
627 (substitute* "lib/libshare/nfs.c"
628 (("/usr/sbin/exportfs")
629 (string-append nfs-utils "/sbin/exportfs")))
630 (substitute* "config/zfs-build.m4"
631 (("\\$sysconfdir/init.d") (string-append out "/etc/init.d")))
632 (substitute* '("etc/zfs/Makefile.am"
633 "cmd/zed/Makefile.am")
634 (("\\$\\(sysconfdir)") (string-append out "/etc")))
635 (substitute* "cmd/vdev_id/vdev_id"
636 (("PATH=/bin:/sbin:/usr/bin:/usr/sbin")
637 (string-append "PATH="
638 (dirname (which "chmod")) ":"
639 (dirname (which "grep")) ":"
640 (dirname (which "sed")) ":"
641 (dirname (which "gawk")))))
642 (substitute* "contrib/pyzfs/Makefile.in"
643 ((".*install-lib.*") ""))
644 (substitute* '("Makefile.am" "Makefile.in")
645 (("\\$\\(prefix)/src") (string-append src "/src"))))
646 #t))
647 (replace 'build
648 (lambda _ (invoke "make")))
649 (replace 'install
650 (lambda* (#:key outputs inputs native-inputs #:allow-other-keys)
651 (let* ((out (assoc-ref outputs "out"))
652 (moddir (assoc-ref outputs "module"))
653 (kmod (assoc-ref (or native-inputs inputs) "kmod")))
654 (invoke "make" "install"
655 (string-append "DEFAULT_INITCONF_DIR=" out "/etc/default")
656 (string-append "DEPMOD=" kmod "/bin/depmod")
657 (string-append "INSTALL_PATH=" out)
658 (string-append "INSTALL_MOD_PATH=" moddir)
659 "INSTALL_MOD_STRIP=1")
660 (install-file "contrib/bash_completion.d/zfs"
661 (string-append out "/share/bash-completion/completions"))
662 (symlink "../share/pkgconfig/" (string-append out "/lib/pkgconfig"))
663 #t))))))
664 (native-inputs
665 `(("attr" ,attr)
666 ("kmod" ,kmod)
667 ("pkg-config" ,pkg-config)))
668 (inputs
669 `(("eudev" ,eudev)
670 ("libaio" ,libaio)
671 ("libtirpc" ,libtirpc)
672 ("nfs-utils" ,nfs-utils)
673 ("openssl" ,openssl)
674 ("python" ,python)
675 ("python-cffi" ,python-cffi)
676 ("util-linux" ,util-linux "lib")
677 ("zlib" ,zlib)))
678 (home-page "https://zfsonlinux.org/")
679 (synopsis "Native ZFS on Linux")
680 (description
681 "ZFS on Linux is an advanced file system and volume manager which was
682 originally developed for Solaris and is now maintained by the OpenZFS
683 community.")
684 (license license:cddl1.0)))
685
686 (define-public mergerfs
687 (package
688 (name "mergerfs")
689 (version "2.29.0")
690 (source
691 (origin
692 (method url-fetch)
693 (uri (string-append "https://github.com/trapexit/mergerfs/releases/download/"
694 version "/mergerfs-" version ".tar.gz"))
695 (sha256
696 (base32
697 "17gizw4vgbqqjd2ykkfpp276942jb5qclp0lkiwkmq1yjgyjqfmk"))))
698 (build-system gnu-build-system)
699 (arguments
700 `(#:tests? #f ; No tests exist.
701 #:phases
702 (modify-phases %standard-phases
703 (delete 'configure)
704 (add-after 'unpack 'fix-paths
705 (lambda* (#:key inputs outputs #:allow-other-keys)
706 (setenv "CC" "gcc")
707 ;; These were copied from the package libfuse.
708 (substitute* '("libfuse/lib/mount_util.c" "libfuse/util/mount_util.c")
709 (("/bin/(u?)mount" _ maybe-u)
710 (string-append (assoc-ref inputs "util-linux")
711 "/bin/" maybe-u "mount")))
712 (substitute* '("libfuse/util/mount.mergerfs.c")
713 (("/bin/sh")
714 (which "sh")))
715 ;; The Makefile does not allow overriding PREFIX via make variables.
716 (substitute* '("Makefile" "libfuse/Makefile")
717 (("= /usr/local") (string-append "= " (assoc-ref outputs "out")))
718 ;; cannot chown as build user
719 (("chown root:root") "true"))
720 #t)))))
721 ;; mergerfs bundles a heavily modified copy of libfuse.
722 (inputs `(("util-linux" ,util-linux)))
723 (home-page "https://github.com/trapexit/mergerfs")
724 (synopsis "Featureful union filesystem")
725 (description "mergerfs is a union filesystem geared towards simplifying
726 storage and management of files across numerous commodity storage devices. It
727 is similar to mhddfs, unionfs, and aufs.")
728 (license (list
729 license:isc ; mergerfs
730 license:gpl2 license:lgpl2.0 ; Imported libfuse code.
731 ))))