add fw-new

This commit is contained in:
2024-09-27 23:10:58 +02:00
parent 92099bd1e9
commit b7bfb0f62a
99 changed files with 14973 additions and 319 deletions

View File

@@ -9,109 +9,53 @@ let
snapserverHost = "snapcast.cloonar.com";
in
{
nixpkgs.crossSystem.system = "aarch64-linux";
nixpkgs.hostPlatform.system = "aarch64-linux";
nixpkgs.buildPlatform.system = "x86_64-linux"; # Change if building on a different architecture
imports = [
<nixpkgs/nixos/modules/installer/sd-card/sd-image-aarch64.nix>
<nixos-hardware/raspberry-pi/4>
# "${builtins.fetchTarball "https://github.com/NixOS/nixos-hardware/archive/master.tar.gz"}/raspberry-pi/4"
];
# nixpkgs.overlays = [
# (final: super: {
# makeModulesClosure = x:
# super.makeModulesClosure (x // { allowMissing = true; });
# })
# ];
nix.settings.trusted-users = [ "root" "dominik" ];
swapDevices = [ { device = "/swapfile"; size = 2048; } ]; # 2GB swap
networking.hostName = hostName;
networking.wireless = {
enable = true;
networks = {
"Cloonar-Multimedia" = {
hidden = true;
psk = "";
psk = "K2MC28Zhk$4zsx6Y";
};
};
};
networking.firewall.logRefusedConnections = false;
boot = {
# loader.grub.enable = false;
# loader.raspberryPi.enable = true;
# loader.raspberryPi.version = 3;
loader.raspberryPi.firmwareConfig = ''
dtparam=audio=on
'';
};
boot.kernelPackages = pkgs.linuxPackages_rpi3;
# hardware.deviceTree.enable = true;
# hardware.deviceTree.overlays = [ {
# name = "hifiberry-dacplus";
# dtboFile = "${pkgs.linuxKernel.kernels.linux_rpi3}/dtbs/overlays/hifiberry-dacplus.dtbo";
# } ];
hardware.deviceTree.filter = "bcm2835-rpi-zero-2-w.dtb";
hardware.deviceTree = {
enable = true;
overlays = [
{
name = "hifiberry-dacplus";
dtsText = ''
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835";
fragment@0 {
target-path = "/";
__overlay__ {
dacpro_osc: dacpro_osc {
compatible = "hifiberry,dacpro-clk";
#clock-cells = <0>;
};
};
};
fragment@1 {
target = <&i2s>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pcm5122@4d {
#sound-dai-cells = <0>;
compatible = "ti,pcm5122";
reg = <0x4d>;
clocks = <&dacpro_osc>;
AVDD-supply = <&vdd_3v3_reg>;
DVDD-supply = <&vdd_3v3_reg>;
CPVDD-supply = <&vdd_3v3_reg>;
status = "okay";
};
hpamp: hpamp@60 {
compatible = "ti,tpa6130a2";
reg = <0x60>;
status = "disabled";
};
};
};
fragment@3 {
target = <&sound>;
hifiberry_dacplus: __overlay__ {
compatible = "hifiberry,hifiberry-dacplus";
i2s-controller = <&i2s>;
status = "okay";
};
};
__overrides__ {
24db_digital_gain =
<&hifiberry_dacplus>,"hifiberry,24db_digital_gain?";
slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?";
leds_off = <&hifiberry_dacplus>,"hifiberry-dacplus,leds_off?";
};
};
'';
}
];
};
hardware.deviceTree.filter = "bcm2708-rpi-zero*.dtb"; # This line does not change anything in this case
hardware.deviceTree.overlays = [
{
name = "hifiberry-dacplusadc";
dtboFile = "${pkgs.device-tree_rpi.overlays}/hifiberry-dacplus.dtbo";
}
];
sound.enable = true;
# hardware.pulseaudio.enable = true;
systemd.services.snapclient = {
description = "Snapcast client";
@@ -143,9 +87,25 @@ in
};
};
system.stateVersion = "22.05";
# NTP time sync
services.timesyncd.enable = true;
# Reduce GPU memory
# Disable onboard audio
boot.kernelParams = [
"console=ttyAMA0,115200"
"console=tty1"
"cma=64M"
"snd_bcm2835.enable=0"
];
# Enable firmware for Raspberry Pi
hardware.enableRedistributableFirmware = true;
system.stateVersion = "23.11";
sdImage = {
compressImage = false;
imageBaseName = "nixos-rpi-zero-2w";
};
}