hydrophonitor/targets/raspberry-pi-4/default.nix
Satu Koskinen b5e34360a7
Rewrite hydrophonitor as a NixOS RPi SD image (#19)
- Initially tested on Raspberry Pi 4B & Raspberry Pi 3B
- Create user + password, enable SSH, connect to local network
- Implemented modules: audio-recorder, gps-recorder, real-time-clock,
shutdown-button
- Deployment option with deploy-rs

Signed-off-by: Satu Koskinen <satu.a.koskinen@gmail.com>
2023-09-12 13:40:22 +03:00

64 lines
1.5 KiB
Nix

{
config,
pkgs,
...
}: let
system = "aarch64-linux";
in {
system.stateVersion = "23.05";
sdImage.compressImage = false;
# disable internal sound card and vc4 gpu
boot.blacklistedKernelModules = ["snd_bcm2835" "vc4"];
# enable i2c and rtc modules
boot.kernelModules = ["i2c-dev" "i2c_bcm2708" "rtc_ds1307"];
hardware = {
raspberry-pi."4".i2c1.enable = true;
raspberry-pi."4".apply-overlays-dtmerge.enable = true;
deviceTree.filter = "bcm2711-rpi-4*.dtb";
};
environment.systemPackages = with pkgs; [i2c-tools];
users.users.kaskelotti = {
isNormalUser = true;
initialHashedPassword = "$6$ySDQdXbGH/qDvjpe$Jp5icbEFRSBLsxB2XGxFz.dACxOS/.KYHENxVSUzFED0UYi9R64858JevedVB06sTsFvlKOPSlzBvbACbxNZr1";
extraGroups = ["wheel" "networkmanager"];
};
nix.settings.trusted-users = ["kaskelotti"];
sound.enable = true;
services.openssh = {
enable = true;
settings.PasswordAuthentication = true;
};
services.audio-recorder = {
enable = true;
output-folder = "/output/audio";
sample-rate = 192000;
sample-format = "S32_LE";
channels = 4;
max-file-time-secs = 300;
};
services.gps-recorder = {
enable = true;
output-folder = "/output/gps";
interval-secs = 10;
};
services.i2c-rtc-start = {
enable = true;
i2c-bus = 1;
};
services.shutdown-button = {
enable = true;
gpio-pin = 21; # option not implemented yet
shutdown-press-secs = 1; # option not implemented yet
};
}