From: Ian Eure <ian@retrospec.tv>
To: help-guix@gnu.org
Subject: Modular home configuration
Date: Sat, 09 Nov 2024 09:35:10 -0800 [thread overview]
Message-ID: <87y11s1ekj.fsf@meson> (raw)
Hi folks,
I’m trying to make my home configuration more modular, so I can
better support system variances. For example, I have a laptop I
use interactively, and a headless machine that runs Cuirass. It’s
advantageous to share certain aspects of the home configuration
between the two machines (shell prompt/environment, GPG agent,
etc), but not others (anything X11/graphical stuff shouldn’t be on
the build machine). One approach to this is to define packages
and services and reference them in the home configuration. What I
dislike about this is that many things require both packages and
services, and I’d prefer to have a way to completely encapsulate
that -- for example, the mpd-mpc package to control my music
server, plus a home-environment-variables-service-type to set
MPD_HOST.
I attempted to solve this by writing a procedure:
(define (+mpd-client home-config)
(home-environment
(inherit home-config)
(packages (cons mpd-mpc (home-environment-packages
home-config)))
(services
(cons
(simple-service
'mpd-environment-service
home-environment-variables-service-type
'(("MPD_HOST" . "audio.box")))
(home-environment-services home-config)))))
Which I can then wrap around a home-environment to add the mpd-mpc
package and environment variable it needs to work:
(+mpc-client (home-environment ...))
Surprisingly, this doesn’t work -- it complains that there’s more
than one "home" service type. I’m not sure why that is, and I
haven’t been able to see anything obviously wrong in the REPL --
though I haven’t been able to get my actual home configuration up
in the Emacs-Guix REPL, due to #67290.
Does anyone have a suggestion for a workaround for this issue,
explanation of how two home services are ending up in the config,
or a better approach for building modular home configs?
Thanks,
— Ian
next reply other threads:[~2024-11-09 17:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-09 17:35 Ian Eure [this message]
2024-11-09 19:09 ` Modular home configuration Tomas Volf
2024-11-09 19:30 ` Edouard Klein
2024-11-09 19:30 ` Edouard Klein
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=87y11s1ekj.fsf@meson \
--to=ian@retrospec.tv \
--cc=help-guix@gnu.org \
/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).