From: Matthew Brooks <matthewfbrooks@mailbox.org>
To: Leo Famulari <leo@famulari.name>
Cc: "help-guix@gnu.org" <help-guix@gnu.org>
Subject: Re: How to declare a bind mount in the "file-systems" definition?
Date: Wed, 22 Apr 2020 12:03:25 -0500 [thread overview]
Message-ID: <20200422120325.7bb8f386@mailbox.org> (raw)
In-Reply-To: <20200408165247.GA27150@jasmine.lan>
[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]
Thanks for the help! I've renamed the section and hard wrapped the lines, and updated it to a more recent commit.
Let me know if there's anything else I should do.
On Wed, 8 Apr 2020 12:52:47 -0400
Leo Famulari <leo@famulari.name> wrote:
> On Sun, Mar 29, 2020 at 03:01:09PM -0500, Matthew Brooks wrote:
> > I can give it a shot. I've whipped up and attached a quick patch that adds a section about bind-mounting.
> > I wasn't able to find any info on how to preview the resulting html file though, or on what the preferred writing style is for the cookbook.
>
> Thanks!
>
> You can build the cookbook as HTML like this:
>
> `guix environment --pure guix -- make doc/guix-cookbook.html`
>
> When building you will see some errors and warnings that need to be
> fixed, related to setting up the menu and navigating between sections.
>
> Lines should be wrapped at 72 characters, except in examples.
>
> > * Customizing the Kernel:: Creating and using a custom Linux kernel on Guix System.
> > +* Bind-mounting file systems:: Setting up a bind-mount in the file-systems definition.
>
> "Setting up a bind-mount on Guix System" is more general, and thus I
> think more appropriate for the table of contents.
>
> Otherwise LGTM! Can you send a revised patch?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cookbook_example_of_bind-mounting.patch --]
[-- Type: text/x-patch, Size: 2918 bytes --]
diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi
index 58a5ba1c80..b4522c0637 100644
--- a/doc/guix-cookbook.texi
+++ b/doc/guix-cookbook.texi
@@ -1322,6 +1322,7 @@ reference.
@menu
* Customizing the Kernel:: Creating and using a custom Linux kernel on Guix System.
* Customizing a Window Manager:: Handle customization of a Window manager on Guix System.
+* Setting up a bind-mount on Guix System:: Setting up a bind-mount in the file-systems definition.
@end menu
@node Customizing the Kernel
@@ -1614,6 +1615,55 @@ Then you need to add the following code to a StumpWM configuration file
(set-font (make-instance 'xft:font :family "DejaVu Sans Mono" :subfamily "Book" :size 11))
@end lisp
+@node Setting up a bind-mount on Guix System
+@section Setting up a bind-mount on Guix System
+
+To bind-mount a file-system, one must first set up some definitions
+before the @code{operating-system} section of the system definition. In
+this example we will bind-mount a folder from a spinning disk drive to
+@code{/tmp}, to save wear and tear on the primary SSD, without
+dedicating an entire partition to be mounted as @code{/tmp}.
+
+First, the source drive that hosts the folder we wish to bind mount
+should be defined, so that the bind-mount can depend on it.
+
+@lisp
+(define source-drive ;; "source-drive" can be named anything you want.
+ (file-system
+ (device (uuid "UUID goes here"))
+ (mount-point "/path-to-spinning-disk-goes-here")
+ (type "ext4"))) ;; Make sure to set this to the appropriate type for your drive.
+@end lisp
+
+The source folder must also be defined, so that guix will know it's not
+a regular block device, but a folder.
+@lisp
+(define (%source-directory) "/path-to-spinning-disk-goes-here/tmp") ;; "source-directory" can be named any valid variable name.
+@end lisp
+
+Finally, inside the @code{file-systems} definition, we must add the
+mount itself.
+
+@lisp
+(file-systems (cons*
+
+ ...<other drives omitted for clarity>...
+
+ source-drive ;; Must match the name you gave the source drive in the earlier definition.
+
+ (file-system
+ (device (%source-directory)) ;; Make sure "source-directory" matches your earlier definition.
+ (mount-point "/tmp")
+ (type "none") ;; We are mounting a folder, not a partition, so this type needs to be "none"
+ (flags '(bind-mount))
+ (dependencies (list source-drive)) ;; Ensure "source-drive" matches what you've named the variable for the drive.
+ )
+
+ ...<other drives omitted for clarity>...
+
+ ))
+@end lisp
+
@c *********************************************************************
@node Advanced package management
@chapter Advanced package management
next prev parent reply other threads:[~2020-04-22 17:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 0:31 How to declare a bind mount in the "file-systems" definition? Matthew Brooks
2020-03-20 1:41 ` Leo Famulari
2020-03-21 4:14 ` Matthew Brooks
2020-03-22 22:12 ` Leo Famulari
2020-03-26 15:10 ` Matthew Brooks
2020-03-29 9:36 ` Gábor Boskovits
2020-03-29 20:01 ` Matthew Brooks
2020-04-08 16:52 ` Leo Famulari
2020-04-22 17:03 ` Matthew Brooks [this message]
2020-04-22 19:52 ` Leo Famulari
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200422120325.7bb8f386@mailbox.org \
--to=matthewfbrooks@mailbox.org \
--cc=help-guix@gnu.org \
--cc=leo@famulari.name \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).