help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Examples of local-host-entries or hosts-service-type?


From: Remco van 't Veer
Subject: Re: Examples of local-host-entries or hosts-service-type?
Date: Sat, 11 Feb 2023 12:46:35 +0100
User-agent: mu4e 1.8.13; emacs 28.2

Hi Sergiu,

2023/02/10 23:40, Sergiu Ivanov:

> Hello Guix,
>
> I am reconfiguring my system right now, and guix system reconfigure
> /etc/config.scm tells me this:
>
> /etc/config.scm:126:27: warning: 'local-host-aliases' is deprecated, use 
> 'local-host-entries' instead
> /etc/config.scm:126:27: warning: 'local-host-aliases' is deprecated, use 
> 'local-host-entries' instead
> /etc/config.scm:124:14: warning: the 'hosts-file' field is deprecated, please 
> use 'hosts-service-type' instead
>
> For the record, here are the lines guix system reconfigure is
> complaining about:
>
> (hosts-file (plain-file "hosts"
>                       (string-append
>                        (local-host-aliases host-name)
>                        "some.ip.address.1 machine1\n"
>                        "some.other.ip.address machine2\n")))
>
> I spent quite some time trying to find some examples of using
> local-host-entries or hosts-service-type, but I don't seem to find any
> mention of these.  Quite on the contrary, the Guix manual actually seems
> to advice declarations similar to those which I have in my
> /etc/config.scm.
>
> Could someone point me to an example of how I should update
> my configuration?

In the guix manual I found this:

  
https://guix.gnu.org/en/manual/devel/en/html_node/Service-Reference.html#index-hosts_002dservice_002dtype

So instead of using (hosts-file ..) you'll have to use
(hosts-service-type ..) instead, as you already mentioned.  You'll end
up with something like to following:

  (operating-system
    ;; ...

    (essential-services
     (modify-services
         (operating-system-default-essential-services this-operating-system)
       (hosts-service-type config =>
                           (cons* (host "some.ip.address.1" "machine1")
                                  (host "some.other.ip.address" "machine2")
                                  (local-host-entries host-name)))))

    ;; ...

I tried it and it seems to work for me.  Also, I agree the documentation
needs some love here.

Cheers,
Remco



reply via email to

[Prev in Thread] Current Thread [Next in Thread]