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: Bruno Victal
Subject: Re: Examples of local-host-entries or hosts-service-type?
Date: Thu, 2 Mar 2023 02:41:22 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

Hi Remco,

On 2023-02-27 06:23, Remco van 't Veer wrote:
> 
> Or when you want to provide extra aliases for localhost?
> 
> Like this?
> 
>   (essential-services
>    (modify-services
>        (operating-system-default-essential-services this-operating-system)
>      (hosts-service-type config =>
>                          (list (host "127.0.0.1" "localhost" (list host-name 
> "foo" "bar"))
>                                (host "::1"       "localhost" (list host-name 
> "foo" "bar"))))))

Semantically you're right though I wouldn't outright do this unless it results 
in clearer code or if its really needed.

Reason for this is that the format of /etc/hosts isn't consistently defined.
For instance, there is a limit on the maximum number of aliases. (depending on 
the implementation)

If I wanted to add extra aliases, I'd extend the service with new "standalone" 
host records instead though your snippet
is just as valid, as long you don't go overboard with the number of aliases.


Cheers,
Bruno



reply via email to

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