GNU Guix System Installation with Static Networking

linux   guix   index

Guix logo

During Guix system installation, the manual option, I had to connect to my home network, where I use static IP addresses. I stumbled a bit to get it working, but in the end it was simple enough.

Here are some notes on the process. Assuming the interface name is eth0 and the static IP address is

First, we need to stop the networking service, as it is interfering by assigning addresses and routes.

herd stop networking

Then, we can assign an IP address on our device, bring it up, and add a route for our default gateway.

ip addr add dev eth0
ip link set dev eth0 up
ip route add default via

That’s it. One last thing would be to add the appropriate name servers in the installer’s /etc/resolv.conf.


Static address for the installed system

The above was during installation, but how do we set up networking with a persistent static address in our config?

The “GNU Guix Reference Manual” defines this, and can be done as follows.

          "eth0" ""
          #:netmask ""
          #:gateway ""
          #:name-servers '(""))

Removing default services

In the manual they are adding the static networking service on %base-services which does not itself include networking.

On the other hand, if our services are based on %desktop-services, then it includes NetworkManager, so we need to remove that, otherwise guix system will complain about the existence of two networking tools.

(remove (lambda (service)
          (eq? (service-kind service) network-manager-service-type)

The above removes only one service, NetworkManager. But, I had to remove multiple ones, and that can be achieved with the or procedure.

Static networking can most likely be setup in the config with NetworkManager as well, but I found this simpler for my first install.

Putting everything together, a services section, that includes just networking, looks something like this.

  (static-networking-service "eth0" ""
                             #:netmask ""
                             #:gateway ""
                             #:name-servers '(""))
  (remove (lambda (service)
             (eq? (service-kind service) network-manager-service-type)
             (eq? (service-kind service) avahi-service-type)))