wip
This commit is contained in:
parent
ec462190f9
commit
210d5b135c
|
@ -4,18 +4,19 @@
|
||||||
|
|
||||||
{ config, pkgs, lib, inputs, ... }:
|
{ config, pkgs, lib, inputs, ... }:
|
||||||
|
|
||||||
let iface = import ../iface-templates.nix {inherit lib;};
|
{
|
||||||
in {
|
|
||||||
imports =
|
imports =
|
||||||
[ # Include the results of the hardware scan.
|
[ # Include the results of the hardware scan.
|
||||||
../types/server.nix
|
../types/server.nix
|
||||||
];
|
];
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
(iface.bridge "lan0" "172.16.1.251/12" "172.16.1.1" "phy0" "50:9a:4c:49:cc:1b")
|
{networking.interfaces.enp0s31f6.useDHCP = true;}
|
||||||
(iface.dhcp "phy1" "98:b7:85:01:36:ec")
|
#{networking.interfaces.enp0s31f6.ipv4.addresses = [ address = "172.16.1.251"; prefixLength = 12; }]}
|
||||||
(iface.dhcp "phy2" "98:b7:85:01:36:ed")
|
#(iface.bridge "lan0" "172.16.1.251/12" "172.16.1.1" "phy0" "50:9a:4c:49:cc:1b")
|
||||||
(iface.dhcp "phy3" "98:b7:85:01:36:ee")
|
#(iface.dhcp "phy1" "98:b7:85:01:36:ec")
|
||||||
(iface.dhcp "phy4" "98:b7:85:01:36:ef")
|
#(iface.dhcp "phy2" "98:b7:85:01:36:ed")
|
||||||
|
#(iface.dhcp "phy3" "98:b7:85:01:36:ee")
|
||||||
|
#(iface.dhcp "phy4" "98:b7:85:01:36:ef")
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,57 @@
|
||||||
{lib,...}:
|
{lib,...}:
|
||||||
|
|
||||||
let build = iface: mac: rest: lib.recursiveUpdate rest {
|
let build = iface: mac: rest: lib.recursiveUpdate rest {
|
||||||
systemd.network.enable = true;
|
networking.usePredictableInterfaceNames = false;
|
||||||
systemd.network.links."${iface}" = {
|
boot.initrd.systemd.enable = true;
|
||||||
linkConfig.Name = iface;
|
|
||||||
matchConfig.PermanentMACAddress = mac;
|
boot.initrd.services.udev.rules = ''
|
||||||
|
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \
|
||||||
|
ADDR{address}=="${mac}", KERNEL="eth*", NAME="${iface}"
|
||||||
|
'';
|
||||||
|
boot.initrd.systemd.network = {
|
||||||
|
enable = true;
|
||||||
|
links."${iface}" = {
|
||||||
|
linkConfig.Name = iface;
|
||||||
|
matchConfig.PermanentMACAddress = mac;
|
||||||
|
};
|
||||||
|
wait-online.enable = false;
|
||||||
|
};
|
||||||
|
systemd.network = {
|
||||||
|
enable = true;
|
||||||
|
links."${iface}" = {
|
||||||
|
linkConfig.Name = iface;
|
||||||
|
matchConfig.PermanentMACAddress = mac;
|
||||||
|
};
|
||||||
|
networks."${iface}".enable = true;
|
||||||
|
wait-online.anyInterface = true;
|
||||||
};
|
};
|
||||||
systemd.network.networks."${iface}".enable = true;
|
|
||||||
}; in
|
}; in
|
||||||
{
|
{
|
||||||
bridge = br: ip: gateway: iface: mac: build iface mac {
|
bridge = br: ip: gateway: iface: mac: build iface mac {
|
||||||
systemd.network.networks."${iface}".bridge = [ br ];
|
systemd.network = {
|
||||||
systemd.network.networks."${br}" = {
|
networks = {
|
||||||
address = [ ip ];
|
"${iface}".bridge = [ br ];
|
||||||
gateway = [ gateway ];
|
|
||||||
};
|
"${br}" = {
|
||||||
systemd.network.netdevs."${br}" = {
|
address = [ ip ];
|
||||||
netdevConfig = {
|
gateway = [ gateway ];
|
||||||
Name = br;
|
};
|
||||||
Kind = "bridge";
|
};
|
||||||
|
netdevs = {
|
||||||
|
"${br}" = {
|
||||||
|
netdevConfig = {
|
||||||
|
Name = br;
|
||||||
|
Kind = "bridge";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
dhcp = iface: mac: build iface mac {
|
dhcp = iface: mac: build iface mac {
|
||||||
systemd.network.networks."${iface}" = {
|
systemd.network.networks."${iface}" = {
|
||||||
|
matchConfig.Name = iface;
|
||||||
DHCP = "yes";
|
DHCP = "yes";
|
||||||
};
|
};
|
||||||
|
networking.interfaces."${iface}".useDHCP = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
BIN
modules/luks-zero.key
Normal file
BIN
modules/luks-zero.key
Normal file
Binary file not shown.
|
@ -7,9 +7,13 @@
|
||||||
device = "/dev/disk/by-partlabel/${config.networking.hostName}-luks0";
|
device = "/dev/disk/by-partlabel/${config.networking.hostName}-luks0";
|
||||||
allowDiscards = true;
|
allowDiscards = true;
|
||||||
keyFileSize = 32;
|
keyFileSize = 32;
|
||||||
keyFile = "/dev/zero";
|
keyFile = "/dev/zero";
|
||||||
|
#keyFile = "/etc/luks-zero.key";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
#boot.initrd.systemd.contents = {
|
||||||
|
# "/etc/luks-zero.key".source = ./luks-zero.key;
|
||||||
|
#};
|
||||||
fileSystems."/" = {
|
fileSystems."/" = {
|
||||||
device = "/dev/disk/by-label/${config.networking.hostName}-root";
|
device = "/dev/disk/by-label/${config.networking.hostName}-root";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user