all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Josselin Poiret via Guix-patches via <guix-patches@gnu.org>
To: 53826@debbugs.gnu.org
Cc: Josselin Poiret <dev@jpoiret.xyz>
Subject: [bug#53826] [PATCH 2/2] doc: Clarify the Swap Space examples, and include an helper example.
Date: Sun,  6 Feb 2022 22:20:45 +0100	[thread overview]
Message-ID: <20220206212045.19257-2-dev@jpoiret.xyz> (raw)
In-Reply-To: <cover.1644181792.git.dev@jpoiret.xyz>

* doc/guix.texi (Swap Space): The examples referred to variables
defined outside of the snippets, and so were not very informative for
people without much Guile knowledge.  Instead, refer to mapped-devices
for the first, and use the new helper
file-systme-mount-point-predicate for the second.
---
 doc/guix.texi | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 0cf865a672..49bc8d55e6 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -15737,22 +15737,39 @@ Linux swap partition by running @command{swaplabel @var{device}}, where
 @lisp
 (swap-space
   (target (file-system-label "swap"))
-  (dependencies (list lvm-device)))
+  (dependencies mapped-devices))
 @end lisp
 
-Use the partition with label @code{swap}, which can be found after the
-@var{lvm-device} mapped device has been opened.  Again, the
+Use the partition with label @code{swap}, which can be found after all
+the @var{mapped-devices} mapped devices have been opened.  Again, the
 @command{swaplabel} command allows you to view and change the label of a
 Linux swap partition.
 
+Here's a more involved example with the corresponding @code{file-systems} part
+of an @code{operating-system} declaration.
+
 @lisp
-(swap-space
-  (target "/btrfs/swapfile")
-  (dependencies (list btrfs-fs)))
+(file-systems
+  (list (file-system
+          (device (file-system-label "root"))
+          (mount-point "/")
+          (type "ext4"))
+        (file-system
+          (device (file-system-label "btrfs"))
+          (mount-point "/btrfs")
+          (type "btrfs"))))
+
+(swap-devices
+  (list
+    (swap-space
+      (target "/btrfs/swapfile")
+      (dependencies (filter (file-system-mount-point-predicate "/btrfs")
+                            file-systems)))))
 @end lisp
 
-Use the file @file{/btrfs/swapfile} as swap space, which is present on the
-@var{btrfs-fs} filesystem.
+Use the file @file{/btrfs/swapfile} as swap space, which depends on the
+file system mounted at @file{/btrfs}.  Note how we use Guile's filter to
+select the file system in an elegant fashion!
 
 @node User Accounts
 @section User Accounts
-- 
2.34.0





  parent reply	other threads:[~2022-02-06 21:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-06 21:18 [bug#53826] [PATCH 0/2] Improve Swap Space examples Josselin Poiret via Guix-patches via
2022-02-06 21:20 ` [bug#53826] [PATCH 1/2] system: Add helper file-system-mount-point-predicate Josselin Poiret via Guix-patches via
2022-02-06 21:20 ` Josselin Poiret via Guix-patches via [this message]
2022-02-15  9:15 ` bug#53826: [PATCH 0/2] Improve Swap Space examples Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220206212045.19257-2-dev@jpoiret.xyz \
    --to=guix-patches@gnu.org \
    --cc=53826@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.