From: Carlo Zancanaro <carlo@zancanaro.id.au>
To: raid5atemyhomework <raid5atemyhomework@protonmail.com>
Cc: guix-devel@gnu.org
Subject: Re: A new paradigm for modifying operating system declarations
Date: Tue, 05 Jan 2021 17:12:31 +1100 [thread overview]
Message-ID: <87o8i39ak0.fsf@zancanaro.id.au> (raw)
In-Reply-To: <wEn0P9ApnHneT6FM9S5lzaf_-Xsdf_x1CCVJJTSW5g4nqI9sflDyZuRJOWdCNYFq6DL26lDSTlQy5cwulmkfDQF1i_b4jM6gqhVzTMKQzKs=@protonmail.com>
Hi raid5atemyhomework,
On Tue, Jan 05 2021, raid5atemyhomework wrote:
> What `install-zfs` does is that it installs the same
> kernel-specific package in three different points:
>
> * `kernel-loadable-modules`, because ZFS needs to get into the
> kernel somehow.
> * `packages`, because the kernel module is useless if you don't
> have the userland tools to interact with the kernel module.
> * `services`, because ZFS is well-documented outside of Guix as
> automatically mounting its filesystems at bootup, but that
> actually requires a bit of magic in the `init` system,
> specifically you need to actually **load** the module, then
> execute `zpool import -a -l` to have it scan for all filesystems
> and mount those that need automounting.
>
> Thus, an `install-zfs`, that is a *single* form that inserts the
> correct bits in the correct ***three*** places, makes the
> experience of adding ZFS to your `operating-system` easier
> because there's less scope for error in actually adding the
> package. You just add a single `install-zfs`, not add three
> things (plus an extra `(define my-zfs (make-zfs-package
> linux-libre-5.4))` before your form).
In principle, I think this should all be handled by a service.
Services have a number of extension points where they can impact
the operating system being declared, by extending other services.
For example, adding a package into the global profile is done by
extending profile-service-type (which you can find in
gnu/services.scm). Adding a shepherd service to manage a process
is done by extending shepherd-root-service-type (in
gnu/services/shepherd.scm).
This is how many services work. As an example, sddm-service-type
extends services to: (a) start a process on the running system,
(b) put files in /etc, (c) install some pam services, (d) add an
account on the system, and (e) install packages in the global
profile.
As far as I can tell, the only thing missing for a
zfs-service-type to do what you want is that services can't
currently add new kernel modules (although they can load them via
kernel-module-loader-service-type). I may have missed a mechanism
for this, though. If we added the ability to do this, then it
should be possible to add zfs support by adding a single (service
zfs-service-type) to your services list.
The approach of using services in this way has some advantages
which are outlined in a blog post from 2015[1]. For me the most
compelling advantage is that an zfs-service-type is more
restricted in what it can do, and must be more explicit. An
install-zfs procedure has free-reign over the entire
operating-system definition that it gets passed, which makes it
harder to reason about the composition of such procedures.
Carlo
[1]: https://guix.gnu.org/blog/2015/service-composition-in-guixsd/
next prev parent reply other threads:[~2021-01-05 6:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-04 15:38 A new paradigm for modifying operating system declarations raid5atemyhomework
2021-01-04 20:21 ` Taylan Kammer
2021-01-05 0:32 ` raid5atemyhomework
2021-01-05 6:12 ` Carlo Zancanaro [this message]
2021-01-05 10:01 ` raid5atemyhomework
2021-01-04 23:26 ` Jan Wielkiewicz
2021-01-05 0:46 ` raid5atemyhomework
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=87o8i39ak0.fsf@zancanaro.id.au \
--to=carlo@zancanaro.id.au \
--cc=guix-devel@gnu.org \
--cc=raid5atemyhomework@protonmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
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).