NixOS: does not create .network files

Hi there,

I’m trying to setup a router using nixos.
I want to use systemd-networkd to configure the network interfaces.

As I move from an arch linux I’m familiar with the networkd config but how is the ‘nixos way’ to create the config files for systemd?

These are used to configure the interface on a working setup (not nixos).

First, set a name for the interface

cat /etc/systemd/network/

Second, config the interface

cat /etc/systemd/network/

Address=<ip of this interface>

Gateway=<ip of gateway>

This is the part to configure my device in configuration.nix.
It only generates the .link file. The .network file for systemd-networkd is missing. = {
    "10-wan0" = {
  }; = {
    networks.wan0 = {
       enable = true;
       name = "wan0";
       networkConfig = {
       address = [ "<ip of this interface>/<netmask>" ];
       gateway = [ "<IP of gateway" ];

What am I missing here to configure the network device properly using systemd-networkd?

I believe you need to prefix the wan0 in with 10- like you did with"10-wan".

i.e. = {
    networks."10-wan0" = {
       enable = true;

Thanks for reaching out @kraftnix

I have tried that without success. As far as I understand it, the number prefix is required to order the files for systemd and make sure that the link is setup before the network.

Solved: Found the missing parameter… = true;

nixos options documentation

The default is false. So are ignored.

I don’t quite understand why the links can be configured but this parameter resolved my problem.