all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bone Baboon <bone.baboon@disroot.org>
To: Gary Johnson <lambdatronic@disroot.org>
Cc: help-guix@gnu.org
Subject: Re: Edits to `etc/resolv.conf` being overwritten
Date: Tue, 06 Apr 2021 17:41:33 -0400	[thread overview]
Message-ID: <87czv7f5v6.fsf@disroot.org> (raw)
In-Reply-To: <87blaw1xhf.fsf@disroot.org>

Thank you for the explanation and detailed examples.

I now have my system configuration providing the contents of
`/etc/resolv.conf` with a service.

However the contents of `/etc/resolv.conf` is still being overwritten
with entries for my internet service provider's DNS.  After some testing
it appears to be happening when I run this command `sudo dhclient
<wireless-interface>`.

I also appreciate the `hosts-file` example you shared as I am thinking
about using `https://github.com/StevenBlack/hosts` as a block list.  In
this case the contents of `my-host-aliases` would be very large.  With
Guile how would I have the definition of `my-host-aliases` in it's own
file and import and use it in my system configuration?

Gary Johnson writes:

> When running Guix System, your OS configuration is meant to be fully
> derived from evaluating your `operating-system` definition. This
> means, in particular, that you should not manually edit any files
> outside of your home directories (i.e., /root and /home/*). This
> includes, of course, any files under /etc.
>
> Instead, any custom changes that you want to see under /etc need to be
> included in your `operating-system` definition. The way to do this
> depends on the change you want to make.
>
> For example, if you want to edit /etc/sudoers, you should include this
> field in your `operating-system` definition (on the same level as
> `packages`, `services`, and so on):
>
> (sudoers-file (plain-file "sudoers" my-sudoers))
>
> Then remember to define `my-sudoers` somewhere above the
> `operating-system` form. Here's an example:
>
> (define my-sudoers
>   "root ALL=(ALL) ALL
> %wheel ALL=(ALL) ALL
> ")
>
> Similarly, if you want to modify /etc/hosts, you add this to `operating-system`:
>
> (hosts-file (plain-file "hosts"
>                          (string-append (local-host-aliases host-name)
>                                         my-host-aliases)))
>
> And again define my-host-aliases somewhere above `operating-system`:
>
> (define my-host-aliases
>   "
> # Some Servers
> 123.123.123.100 foo
> 123.123.123.101 bar
> 123.123.123.102 baz
> ")
>
> Most other files under /etc are managed by different services. You
> should review the "Guix Services" section of the info pages to find
> the appropriate service for whatever files you want to modify.
>
> As of today, I'm not aware of a Guix service that modifies
> /etc/resolv.conf other than the network-manager-service-type (which is
> what I use on my system).
>
> However, if you are not using NetworkManager and want to manually set
> the values in /etc/resolv.conf such that they persist across calls to
> `guix system reconfigure`, you should add this form to the `services`
> list in your `operating-system` definition:
>
> (simple-service 'resolv-service
>                 etc-service-type
>                 `(("resolv.conf" ,(plain-file "resolv.conf" my-resolv.conf))))
>
> And finally remember to define `my-resolv.conf` above `operating-system`:
>
> (define my-resolv.conf
>   "# Generated by Guix!
> nameserver 255.255.255.1
> nameserver ffff:ffff:ffff::1
> ")


  reply	other threads:[~2021-04-06 21:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02  1:36 Edits to `etc/resolv.conf` being overwritten Bone Baboon
2021-04-02  4:57 ` Jérémy Korwin-Zmijowski
2021-04-02  7:43 ` phil
2021-04-02 13:08   ` Bone Baboon
2021-04-02 16:07     ` Gary Johnson
2021-04-06 21:41       ` Bone Baboon [this message]
2021-04-07 14:34         ` Gary Johnson
2021-04-08 19:07           ` Bone Baboon
2021-04-08 19:17             ` Vincent Legoll
2021-04-10  3:40               ` Bone Baboon
2021-04-10  9:23                 ` Vincent Legoll
2021-04-10 19:50                   ` Bone Baboon
2021-04-09  3:22             ` Vladimir Sedach
2021-04-10  3:28               ` Bone Baboon

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87czv7f5v6.fsf@disroot.org \
    --to=bone.baboon@disroot.org \
    --cc=help-guix@gnu.org \
    --cc=lambdatronic@disroot.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.