summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorEdouard Klein <edk@beaver-labs.com>2025-07-25 11:01:36 +0200
committerMaxim Cournoyer <maxim@guixotic.coop>2025-07-25 23:36:10 +0900
commitf05f8fb6b4e6982cd12db4c943deae95e5692924 (patch)
treeac84ee77530f452cba26defac67a4d03c0ef42a5 /doc
parent8636c0910fa201f5f9f10cd10cfe8e98abf707a5 (diff)
services: Add vfs-mapping-service-type.
* gnu/services/linux.scm (vfs-mapping-service-type, vfs-mapping-configuration, vfs-mapping-binding): New variables. * doc/guix.texi: (Vfs Mapping Service): New subsubsection under "Linux Services". Change-Id: I7ebd48afb809ded9fa6fe9eb80c618accb856716 Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi143
1 files changed, 143 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 500f6e78e91..98b388886b3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -142,6 +142,7 @@ Copyright @copyright{} 2025 Sergio Pastor Pérez@*
142Copyright @copyright{} 2024 Evgeny Pisemsky@* 142Copyright @copyright{} 2024 Evgeny Pisemsky@*
143Copyright @copyright{} 2025 jgart@* 143Copyright @copyright{} 2025 jgart@*
144Copyright @copyright{} 2025 Artur Wroblewski@* 144Copyright @copyright{} 2025 Artur Wroblewski@*
145Copyright @copyright{} 2025 Edouard Klein@*
145 146
146Permission is granted to copy, distribute and/or modify this document 147Permission is granted to copy, distribute and/or modify this document
147under the terms of the GNU Free Documentation License, Version 1.3 or 148under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -43401,6 +43402,148 @@ this value will override the @code{ttl} when used for narinfo requests.
43401@node Linux Services 43402@node Linux Services
43402@subsection Linux Services 43403@subsection Linux Services
43403 43404
43405@subsubheading VFS Mapping Service
43406@cindex VFS mapping
43407@cindex Virtual File System mapping
43408@cindex bind mounts, service
43409@cindex overlay mounts, service
43410
43411The VFS (Virtual File System) Mapping service allows you to bind a file
43412name under a different name in the global namespace. For example, this
43413is used by the Shared Cache Service (@pxref{Guix Services}) to bind the
43414@samp{root} user's cache over another user's cache. Another use case
43415may be to expose game data from the store over your home directory, and
43416apply modifications there.
43417
43418The service has three @emph{policies} to choose from with respect to
43419access rights on the bound over path:
43420
43421@table @code
43422@item 'bind
43423Use a bind mount; the ownership and file
43424permissions of the destination are the same as the source.
43425
43426@item 'translate
43427Use bindfs to make the destination appear as owned by the target user
43428and group. Writes will be propagated back to the source as if made by
43429the original owner.
43430
43431@item 'overlay
43432Use an overlay to make the destination appear as owned by the target
43433user and group. Writes will not appear in the source, but will be stored
43434in a target-user-owned @samp{-overlay} suffixed directory near the
43435destination.
43436@end table
43437
43438Here is an example configuration that exposes the default data directory
43439of @command{tuxpaint} under the home directory of @code{alice}. Any
43440modification made by Alice to the brushes or stamps will not propagate
43441back to the store (which is read-only anyway).
43442
43443@lisp
43444(operating-system
43445 ;; @dots{}
43446 (services
43447 (cons*
43448 (service vfs-mapping-service-type
43449 (vfs-mapping-configuration
43450 (bindings (list (vfs-mapping
43451 (source #~(string-append #$tuxpaint
43452 "/share/tuxpaint"))
43453 (destination "/home/alice/.tuxpaint")
43454 (user "alice")
43455 (policy 'overlay)
43456 (name "alice-tuxpaint-overlay"))))))
43457 %desktop-services)))
43458@end lisp
43459
43460The service can also be extended by providing a list of
43461@code{vfs-mapping}, allowing for easier splitting of configuration.
43462
43463@lisp
43464(operating-system
43465 ;; @dots{}
43466 (services
43467 (cons*
43468 (simple-service 'bob-too-wants-to-hack-on-tuxpaint
43469 vfs-mapping-service-type
43470 (list (vfs-mapping
43471 (source #~(string-append #$tuxpaint "/share/tuxpaint"))
43472 (destination "/home/bob/.tuxpaint")
43473 (user "bob")
43474 (policy 'overlay)
43475 (name "bob-tuxpaint-overlay"))))
43476 %desktop-services)))
43477@end lisp
43478
43479The @code{source} file name must exist for the service to start. The
43480@code{destination} directory will be created if it does not exist.
43481
43482@defvar vfs-mapping-service-type
43483Service type for binding a directory in multiple places on the file
43484system.
43485
43486The access rights are either the same in source and destination
43487(@code{'bind}), or writes are translated back to the sources as if made
43488by the destination's owner (@code{'translate}), or kept in an overlay
43489directory near the destination (@code{'overlay}). The service's value
43490must be a @code{vfs-mapping-configuration} object.
43491@end defvar
43492
43493@deftp {Data Type} vfs-mapping-configuration
43494Data type representing the configuration of the vfs-mapping service.
43495
43496@table @asis
43497@item @code{bindfs} (default: @code{#~(string-append #$bindfs "/bin/bindfs")})
43498The @command{bindfs} command to use for mounting.
43499
43500@item @code{fusermount} (default: @code{#~(string-append #$fuse-2 "/bin/fusermount")})
43501The @command{fusermount} command to use.
43502
43503@item @code{umount} (default: @code{#~(string-append #$util-linux+udev "/bin/umount")})
43504The @command{umount} command to use.
43505
43506@item @code{bindings} (default: @code{'()})
43507A list of @code{vfs-mapping} records.
43508
43509@end table
43510@end deftp
43511
43512@deftp {Data Type} vfs-mapping
43513Data type representing the configuration for a single shared directory.
43514
43515@table @asis
43516@item @code{source}
43517The source file name to be shared.
43518
43519@item @code{destination}
43520The destination at which the contents of @code{source} will be exposed.
43521
43522@item @code{policy} (default: @code{'translate})
43523Either @code{'bind} (same ownership and access rights for @code{source}
43524and @code{destination}), @code{'translate} (read-write, with writes
43525translated as if made by @code{source}'s owner), or @code{'overlay}
43526(read-only with @code{user}-owned writable overlay).
43527
43528@item @code{user} (default: @code{#f})
43529The user that will own the @code{destination} directory, and appear to
43530own its content. It must be kept at its default @code{#f} value when
43531using the @code{'bind} policy.
43532
43533@item @code{group} (default: @code{"users"})
43534The group that will own the @code{destination} directory, and appear to
43535own its content.
43536
43537@item @code{name} (default: @code{"<src>-[<policy>]-><dst>"})
43538The name of the shepherd service to mount and unmount the binding.
43539
43540@item @code{requirement} (default: @code{'(file-systems user-homes)})
43541The list of services that Shepherd ought to provision before trying to
43542mount.
43543
43544@end table
43545@end deftp
43546
43404@cindex oom 43547@cindex oom
43405@cindex out of memory killer 43548@cindex out of memory killer
43406@cindex earlyoom 43549@cindex earlyoom