45 lines
1.1 KiB
Nix
45 lines
1.1 KiB
Nix
# Edit this configuration file to define what should be installed on
|
||
# your system. Help is available in the configuration.nix(5) man page
|
||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||
|
||
{ config, pkgs, lib, inputs, ... }:
|
||
|
||
let bridge = bridge: {mac, iface, ip, gateway}@_in: {
|
||
systemd.network.enable = true;
|
||
|
||
systemd.network.links."${iface}" = {
|
||
linkConfig.Name = iface;
|
||
matchConfig.PermanentMACAddress = mac;
|
||
};
|
||
systemd.network.networks."${iface}" = {
|
||
enable = true;
|
||
bridge = [ bridge ];
|
||
};
|
||
systemd.network.networks."${bridge}" = {
|
||
address = [ ip ];
|
||
gateway = [ gateway ];
|
||
};
|
||
systemd.network.netdevs."${bridge}" = {
|
||
enable = true;
|
||
netdevConfig = {
|
||
Name = bridge;
|
||
Kind = "bridge";
|
||
};
|
||
};
|
||
}; in
|
||
{
|
||
imports =
|
||
[ # Include the results of the hardware scan.
|
||
../types/server.nix
|
||
];
|
||
config = lib.mkMerge [
|
||
(bridge "lan0" {
|
||
mac = "d8:9e:f3:1b:7f:8a";
|
||
iface = "phy0";
|
||
ip = "172.16.1.251/12";
|
||
gateway = "172.16.1.1";
|
||
})
|
||
];
|
||
|
||
}
|