nixos/modules/hardware/raspi4/raspi-ethernet.nix

49 lines
1.0 KiB
Nix

{ config, lib, ... }:
let
cfg = config.hardware.az-raspi4-ethernet;
in
{
imports = [
./base.nix
];
options = {
hardware.az-raspi4-ethernet = {
enable = lib.mkEnableOption "Enable options required for Raspberry Pi 4.";
hostname = lib.mkOption {
type = lib.types.str;
description = "The hostname of the system.";
};
ip = lib.mkOption {
type = lib.types.str;
description = "The IP of the system.";
};
};
};
config = lib.mkIf cfg.enable {
networking = {
useDHCP = false;
hostName = cfg.hostname;
hosts = {
"127.0.0.1" = [ "${cfg.hostname}.2li.local" ];
ip = [ "${cfg.hostname}.2li.local" ];
};
defaultGateway = "10.7.89.1";
nameservers = [ "10.7.89.1" ];
interfaces.eth0.ipv4.addresses = [
{
address = cfg.ip;
prefixLength = 24;
}
];
};
services = {
az-log2ram.enable = true;
az-syslog.enable = true;
};
};
}