diff options
| author | Edouard Klein <edk@beaver-labs.com> | 2025-07-25 11:01:36 +0200 |
|---|---|---|
| committer | Maxim Cournoyer <maxim@guixotic.coop> | 2025-07-25 23:36:10 +0900 |
| commit | f05f8fb6b4e6982cd12db4c943deae95e5692924 (patch) | |
| tree | ac84ee77530f452cba26defac67a4d03c0ef42a5 /doc | |
| parent | 8636c0910fa201f5f9f10cd10cfe8e98abf707a5 (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.texi | 143 |
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@* | |||
| 142 | Copyright @copyright{} 2024 Evgeny Pisemsky@* | 142 | Copyright @copyright{} 2024 Evgeny Pisemsky@* |
| 143 | Copyright @copyright{} 2025 jgart@* | 143 | Copyright @copyright{} 2025 jgart@* |
| 144 | Copyright @copyright{} 2025 Artur Wroblewski@* | 144 | Copyright @copyright{} 2025 Artur Wroblewski@* |
| 145 | Copyright @copyright{} 2025 Edouard Klein@* | ||
| 145 | 146 | ||
| 146 | Permission is granted to copy, distribute and/or modify this document | 147 | Permission is granted to copy, distribute and/or modify this document |
| 147 | under the terms of the GNU Free Documentation License, Version 1.3 or | 148 | under 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 | |||
| 43411 | The VFS (Virtual File System) Mapping service allows you to bind a file | ||
| 43412 | name under a different name in the global namespace. For example, this | ||
| 43413 | is 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 | ||
| 43415 | may be to expose game data from the store over your home directory, and | ||
| 43416 | apply modifications there. | ||
| 43417 | |||
| 43418 | The service has three @emph{policies} to choose from with respect to | ||
| 43419 | access rights on the bound over path: | ||
| 43420 | |||
| 43421 | @table @code | ||
| 43422 | @item 'bind | ||
| 43423 | Use a bind mount; the ownership and file | ||
| 43424 | permissions of the destination are the same as the source. | ||
| 43425 | |||
| 43426 | @item 'translate | ||
| 43427 | Use bindfs to make the destination appear as owned by the target user | ||
| 43428 | and group. Writes will be propagated back to the source as if made by | ||
| 43429 | the original owner. | ||
| 43430 | |||
| 43431 | @item 'overlay | ||
| 43432 | Use an overlay to make the destination appear as owned by the target | ||
| 43433 | user and group. Writes will not appear in the source, but will be stored | ||
| 43434 | in a target-user-owned @samp{-overlay} suffixed directory near the | ||
| 43435 | destination. | ||
| 43436 | @end table | ||
| 43437 | |||
| 43438 | Here is an example configuration that exposes the default data directory | ||
| 43439 | of @command{tuxpaint} under the home directory of @code{alice}. Any | ||
| 43440 | modification made by Alice to the brushes or stamps will not propagate | ||
| 43441 | back 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 | |||
| 43460 | The 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 | |||
| 43479 | The @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 | ||
| 43483 | Service type for binding a directory in multiple places on the file | ||
| 43484 | system. | ||
| 43485 | |||
| 43486 | The access rights are either the same in source and destination | ||
| 43487 | (@code{'bind}), or writes are translated back to the sources as if made | ||
| 43488 | by the destination's owner (@code{'translate}), or kept in an overlay | ||
| 43489 | directory near the destination (@code{'overlay}). The service's value | ||
| 43490 | must be a @code{vfs-mapping-configuration} object. | ||
| 43491 | @end defvar | ||
| 43492 | |||
| 43493 | @deftp {Data Type} vfs-mapping-configuration | ||
| 43494 | Data type representing the configuration of the vfs-mapping service. | ||
| 43495 | |||
| 43496 | @table @asis | ||
| 43497 | @item @code{bindfs} (default: @code{#~(string-append #$bindfs "/bin/bindfs")}) | ||
| 43498 | The @command{bindfs} command to use for mounting. | ||
| 43499 | |||
| 43500 | @item @code{fusermount} (default: @code{#~(string-append #$fuse-2 "/bin/fusermount")}) | ||
| 43501 | The @command{fusermount} command to use. | ||
| 43502 | |||
| 43503 | @item @code{umount} (default: @code{#~(string-append #$util-linux+udev "/bin/umount")}) | ||
| 43504 | The @command{umount} command to use. | ||
| 43505 | |||
| 43506 | @item @code{bindings} (default: @code{'()}) | ||
| 43507 | A list of @code{vfs-mapping} records. | ||
| 43508 | |||
| 43509 | @end table | ||
| 43510 | @end deftp | ||
| 43511 | |||
| 43512 | @deftp {Data Type} vfs-mapping | ||
| 43513 | Data type representing the configuration for a single shared directory. | ||
| 43514 | |||
| 43515 | @table @asis | ||
| 43516 | @item @code{source} | ||
| 43517 | The source file name to be shared. | ||
| 43518 | |||
| 43519 | @item @code{destination} | ||
| 43520 | The destination at which the contents of @code{source} will be exposed. | ||
| 43521 | |||
| 43522 | @item @code{policy} (default: @code{'translate}) | ||
| 43523 | Either @code{'bind} (same ownership and access rights for @code{source} | ||
| 43524 | and @code{destination}), @code{'translate} (read-write, with writes | ||
| 43525 | translated 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}) | ||
| 43529 | The user that will own the @code{destination} directory, and appear to | ||
| 43530 | own its content. It must be kept at its default @code{#f} value when | ||
| 43531 | using the @code{'bind} policy. | ||
| 43532 | |||
| 43533 | @item @code{group} (default: @code{"users"}) | ||
| 43534 | The group that will own the @code{destination} directory, and appear to | ||
| 43535 | own its content. | ||
| 43536 | |||
| 43537 | @item @code{name} (default: @code{"<src>-[<policy>]-><dst>"}) | ||
| 43538 | The name of the shepherd service to mount and unmount the binding. | ||
| 43539 | |||
| 43540 | @item @code{requirement} (default: @code{'(file-systems user-homes)}) | ||
| 43541 | The list of services that Shepherd ought to provision before trying to | ||
| 43542 | mount. | ||
| 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 |
