nixos-infra/services/networking/service.nix
Rustam Efimov 30ce0dafc2
Some checks failed
Nix CI / build (push) Failing after 31s
initial commit
2026-04-01 08:50:01 +03:00

32 lines
609 B
Nix

{ config, lib, hostname, ... }:
let
inherit (config.machine) ipv4 gateway;
in
with lib; {
networking = {
hostName = hostname;
networkmanager.enable = mkDefault true;
firewall = {
enable = true;
allowPing = true;
};
nameservers = [
"1.1.1.1"
"1.0.0.1"
"9.9.9.9"
"8.8.8.8"
];
interfaces.ens3 = mkIf (ipv4 != null) {
ipv4.addresses = [
{
address = ipv4;
prefixLength = 32;
}
];
};
defaultGateway = mkIf (gateway != null) {
address = gateway;
interface = "ens3";
};
};
}