many changes

This commit is contained in:
2024-06-03 13:49:35 +02:00
parent c9e4ab6af0
commit 5d0827848e
24 changed files with 844 additions and 163 deletions

View File

@@ -2,3 +2,8 @@
- change hostname in sd-card.nix
- add wifi psk
- nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage -I nixos-config=./sd-card.nix --argstr system aarch64-linux
# raspberry Pi Zero Mutliroom audio client
- change hostname in sd-card-zero.nix
- add wifi psk
- nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage -I nixos-config=./sd-card-zero.nix --argstr system aarch64-linux

View File

@@ -5,14 +5,14 @@
...
}:
let
hostName = "music-";
outputDevice = "Headphones";
hostName = "music-bedroom";
snapserverHost = "snapcast.cloonar.com";
in
{
nixpkgs.crossSystem.system = "aarch64-linux";
imports = [
<nixpkgs/nixos/modules/installer/sd-card/sd-image-aarch64.nix>
<nixos-hardware/raspberry-pi/4>
];
networking.hostName = hostName;
@@ -21,25 +21,95 @@ in
networks = {
"Cloonar-Multimedia" = {
hidden = true;
psk = "K2MC28Zhk$4zsx6Y";
psk = "";
};
};
};
boot = {
# loader.grub.enable = false;
# loader.raspberryPi.enable = true;
# loader.raspberryPi.version = 3;
loader.raspberryPi.firmwareConfig = ''
dtparam=audio=on
'';
extraModprobeConfig = ''
options snd_bcm2835 enable_headphones=1
'';
};
# hardware.raspberry-pi."4" = {
# fkms-3d.enable = true;
# audio.enable = true;
# dwc2.enable = true;
# };
hardware.deviceTree.filter = "bcm2710-rpi-zero-2-w.dtb";
hardware.deviceTree = {
enable = true;
overlays = [
{
name = "hifiberry-dacplus";
dtsText = ''
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2710,bcm2837";
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?";
};
};
'';
}
];
};
sound.enable = true;
@@ -51,7 +121,7 @@ in
serviceConfig = {
Type = "forking";
ExecStart = "${pkgs.snapcast}/bin/snapclient --daemon --hostID ${config.networking.hostName} -h ${snapserverHost} --player alsa -s ${outputDevice}";
ExecStart = "${pkgs.snapcast}/bin/snapclient --daemon --hostID ${config.networking.hostName} -h ${snapserverHost} --player alsa";
PIDFile = "/run/snapclient/pid";
Restart = "on-failure";
RestartSec = "5s";