Compare commits

...

6 Commits

6 changed files with 25 additions and 21 deletions

View File

@ -44,7 +44,7 @@ inputs:
nixpkgs.march = "silvermont";
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
kernel.patches = [ "cjktty" "lantian" ];
networking.hostname = "nas";
networking = { hostname = "nas"; networkd.dhcp = [ "enp3s0" ]; };
gui.preferred = false;
};
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };

View File

@ -96,7 +96,7 @@ inputs:
sshd.enable = true;
xray.client.dnsmasq.hosts = builtins.listToAttrs (builtins.map
(name: { inherit name; value = "74.211.99.69"; })
[ "mirism.one" "beta.mirism.one" "ng01.mirism.one" ]);
[ "mirism.one" "beta.mirism.one" "ng01.mirism.one" "initrd.vps6.chn.moe" ]);
firewall.trustedInterfaces = [ "virbr0" "waydroid0" ];
acme = { enable = true; cert."debug.mirism.one" = {}; };
frpClient =

View File

@ -29,7 +29,7 @@ inputs:
nixpkgs.march = "sandybridge";
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
initrd.sshd.enable = true;
networking.hostname = "vps6";
networking = { hostname = "vps6"; networkd.dhcp = [ "ens18" ]; };
};
packages.packageSet = "server";
services =

View File

@ -29,7 +29,7 @@ inputs:
nixpkgs.march = "broadwell";
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
initrd.sshd.enable = true;
networking.hostname = "vps7";
networking = { hostname = "vps7"; networkd.dhcp = [ "ens18" ]; };
gui.preferred = false;
};
packages.packageSet = "desktop";

View File

@ -20,7 +20,6 @@ inputs:
hideMounts = true;
directories =
[
{ directory = "/etc/NetworkManager/system-connections"; mode = "0700"; }
"/home"
"/root"
"/var/db"
@ -30,7 +29,9 @@ inputs:
"/var/backup"
{ directory = "/var/lib/docker/volumes"; mode = "0710"; }
"/srv"
];
]
++ (inputs.lib.optional inputs.config.nixos.system.networking.networkManager.enable
{ directory = "/etc/NetworkManager/system-connections"; mode = "0700"; });
files =
[
"/etc/machine-id"

View File

@ -3,6 +3,8 @@ inputs:
options.nixos.system.networking = let inherit (inputs.lib) mkOption types; in
{
hostname = mkOption { type = types.nonEmptyStr; };
networkManager.enable = mkOption
{ type = types.bool; default = inputs.config.nixos.system.networking.networkd.dhcp == []; };
networkd =
{
dhcp = mkOption { type = types.listOf types.nonEmptyStr; default = []; };
@ -12,20 +14,7 @@ inputs:
[
# general config
{
networking =
{
networkmanager =
{
enable = true;
# let networkmanager ignore the kernel command line `ip=xxx`
extraConfig =
''
[device]
keep-configuration=no
'';
};
hostName = networking.hostname;
};
networking.hostName = networking.hostname;
boot.kernel.sysctl =
{
"net.core.rmem_max" = 67108864;
@ -48,6 +37,20 @@ inputs:
"net.bridge.bridge-nf-call-arptables" = false;
};
}
# networkManager
(inputs.lib.mkIf networking.networkManager.enable
{
networking.networkmanager =
{
enable = true;
# let networkmanager ignore the kernel command line `ip=xxx`
extraConfig =
''
[device]
keep-configuration=no
'';
};
})
# networkd
(inputs.lib.mkIf (networking.networkd.dhcp != [])
{
@ -60,7 +63,7 @@ inputs:
name = "10-${network}";
value =
{
matchConfig.name = network;
matchConfig.Name = network;
networkConfig =
{
DHCP = "yes";