nixos/systems/raspi4/default.nix

54 lines
1.2 KiB
Nix

{ inputs, hostname, ip, pkgs, ... }:
{
imports = [
inputs.nixos-hardware.nixosModules.raspberry-pi-4
"${inputs.self}/modules/ntp"
"${inputs.self}/modules/syslog"
];
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
};
hardware.raspberry-pi."4".fkms-3d.enable = true;
hardware.raspberry-pi."4".audio.enable = true;
hardware.pulseaudio.enable = true;
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
networking = {
useDHCP = false;
hostName = hostname;
hosts = {
"127.0.0.1" = [ "${hostname}.2li.local" ];
ip = [ "${hostname}.2li.local" ];
};
defaultGateway = "10.7.89.1";
nameservers = [ "10.7.89.2" ];
interfaces.eth0.ipv4.addresses = [
{
address = ip;
prefixLength = 24;
}
];
};
environment.shellAliases = {
raspi-cpu = ''
sudo vcgencmd get_throttled && sudo vcgencmd measure_temp
'';
raspi-firmware-update = ''
sudo mount /dev/disk/by-label/FIRMWARE /mnt && \
BOOTFS=/mnt FIRMWARE_RELEASE_STATUS=stable sudo -E rpi-eeprom-update -d -a && \
sudo umount /mnt
'';
};
}