[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Modular home configuration
From: |
Edouard Klein |
Subject: |
Re: Modular home configuration |
Date: |
Sat, 09 Nov 2024 20:30:59 +0100 |
User-agent: |
K-9 Mail for Android |
The magic is here
<https://gitlab.com/edouardklein/guix/-/blob/beaverlabs/beaver/functional-home-services.scm?ref_type=heads>
Le 9 novembre 2024 18:35:10 GMT+01:00, Ian Eure <ian@retrospec.tv> a écrit :
>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
>