anchor.diff:            (let mask =
                   if i.prefixLength != null then toString i.prefixLength else
                   if i.subnetMask != "" then i.subnetMask else "32";
  +               staticIPv6 = cfg.enableIPv6 && i.ipv6Address != null;
             in
             { description = "Configuration of ${i.name}";
               wantedBy = [ "network-interfaces.target" ];
  
positive.code:           Subnet mask of the interface, specified as a bitmask.
            This is deprecated; use <option>prefixLength</option>
            instead.
          '';
        };
  
  
negative.code:                     echo "configuring interface..."
                      ip -4 addr flush dev "${i.name}"
                      ip -4 addr add "${i.ipAddress}/${mask}" dev "${i.name}"
                      restart_network_setup=true
                    else
                      echo "skipping configuring interface"
                    fi
                  ''
                + optionalString (staticIPv6)
                  ''
                    # Only do a flush/add if it's necessary.  This is
                    # useful when the Nix store is accessed via this
                    # interface (e.g. in a QEMU VM test).
                    if ! ip -6 -o a show dev "${i.name}" | grep "${i.ipv6Address}/${toString i.ipv6prefixLength}"; then
                      echo "configuring interface..."
                      ip -6 addr flush dev "${i.name}"
                      ip -6 addr add "${i.ipv6Address}/${toString i.ipv6prefixLength}" dev "${i.name}"
                      restart_network_setup=true
                    else
                      echo "skipping configuring interface"
                    fi
                  ''
                + optionalString (i.ipAddress != null || staticIPv6)
                  ''
                    if [ restart_network_setup = true ]; then
                      # Ensure that the default gateway remains set.
                      # (Flushing this interface may have removed it.)
                      ${config.systemd.package}/bin/systemctl try-restart --no-block network-setup.service
                    fi
                    ${config.systemd.package}/bin/systemctl start ip-up.target
                  ''
  