feat: musicpi

This commit is contained in:
Philipp Hochkamp 2022-03-25 13:52:42 +01:00
parent 7a85f7cec6
commit 6477dee99b
4 changed files with 110 additions and 36 deletions

View file

@ -131,6 +131,8 @@
nixosConfigurations = processConfigurations {
picard = nixosSystem "x86_64-linux" [ ./hosts/picard/default.nix ]; # TODO
ds9 = nixosSystem "x86_64-linux" [ ./hosts/ds9/default.nix ]; # TODO
wohnzimmerpi = nixosSystem "aarch64-linux" [ ./hosts/musicpi/default.nix ]; # Livingroom pi
kuechenpi = nixosSystem "aarch64-linux" [ ./hosts/musicpi/default.nix ]; # Kitchen pi
};
darwinConfigurations = processConfigurations {
daedalus = darwinSystem "aarch64-darwin" [ ./hosts/daedalus/default.nix ]; # TODO

55
hosts/musicpi/default.nix Normal file
View file

@ -0,0 +1,55 @@
{ config, inputs, pkgs, lib, ... }:
{
imports = [
"${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
# "${inputs.nixos-hardware}/raspberry-pi/4/default.nix"
];
boot.supportedFilesystems = lib.mkForce [ "reiserfs" "vfat" "ext4" ]; # we dont need zfs here
documentation.enable = false;
documentation.nixos.enable = false;
boot = {
kernelPackages = lib.mkDefault pkgs.linuxPackages_rpi4;
initrd.availableKernelModules = [ "usbhid" "usb_storage" "vc4" ];
loader = {
grub.enable = lib.mkDefault false;
generic-extlinux-compatible.enable = lib.mkDefault true;
};
};
hardware.deviceTree.filter = "bcm2711-rpi-*.dtb";
# Required for the Wireless firmware
hardware.enableRedistributableFirmware = true;
nix = {
autoOptimiseStore = true;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
# Free up to 1GiB whenever there is less than 100MiB left.
extraOptions = ''
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
};
# Assuming this is installed on top of the disk image.
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
};
ragon.services.ssh.enable = true;
ragon.services.agenix.enable = true;
ragon.hardware.hifiberry-dac.enable = true;
services.shairport-sync = {
enable = true;
arguments = "-o alsa";
};
}

View file

@ -0,0 +1,53 @@
{ config, lib, pkgs, ... }:
let
cfg = config.ragon.hardware.hifiberry-dac;
in
{
options.ragon.hardware.hifiberry-dac.enable = lib.mkEnableOption "Enables hifiberry dac";
config = lib.mkIf cfg.enable {
hardware.deviceTree = {
overlays = [
# Equivalent to: https://github.com/raspberrypi/linux/blob/rpi-5.10.y/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts
{
name = "hifiberry-dac-overlay";
dtsText = ''
// Definitions for HiFiBerry DAC
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835";
fragment@0 {
target = <&i2s>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target-path = "/";
__overlay__ {
pcm5102a-codec {
#sound-dai-cells = <0>;
compatible = "ti,pcm5102a";
status = "okay";
};
};
};
fragment@2 {
target = <&sound>;
__overlay__ {
compatible = "hifiberry,hifiberry-dac";
i2s-controller = <&i2s>;
status = "okay";
};
};
};
'';
}
];
};
};
}

View file

@ -1,36 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.ragon.hardware.rpi3;
in
{
options.ragon.hardware.rpi3.enable = lib.mkEnableOption "Enables rpi3 quirks";
config = lib.mkIf cfg.enable {
boot.loader.raspberryPi = {
enable = true;
version = 3;
};
boot.extraModprobeConfig = ''
options cfg80211 ieee80211_regdom="DE"
'';
hardware.firmware = [ pkgs.wireless-regdb ];
#boot.kernelPackages = pkgs.linux_rpi3;
nixpkgs.overlays = [
(self: super: {
firmwareLinuxNonfree = super.firmwareLinuxNonfree.overrideAttrs (old: {
version = "2020-12-18";
src = pkgs.fetchgit {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
rev = "b79d2396bc630bfd9b4058459d3e82d7c3428599";
sha256 = "1rb5b3fzxk5bi6kfqp76q1qszivi0v1kdz1cwj2llp5sd9ns03b5";
};
outputHash = "1p7vn2hfwca6w69jhw5zq70w44ji8mdnibm1z959aalax6ndy146";
});
})
];
networking.wireless.enable = true;
hardware.enableRedistributableFirmware = true;
networking.wireless.interfaces = [ "wlan0" ];
};
}