From 4dcd919ba8c7adf8b35b873048fd3e9d9c4644de Mon Sep 17 00:00:00 2001
From: Myned <dev@bjork.tech>
Date: Sat, 29 Mar 2025 18:10:47 -0500
Subject: [PATCH] sbc: refactor config

---
 machines/mypi3/default.nix | 41 ++++++++++++++++++++++++++++++++++++--
 profiles/sbc/default.nix   | 21 +++++++++----------
 2 files changed, 50 insertions(+), 12 deletions(-)

diff --git a/machines/mypi3/default.nix b/machines/mypi3/default.nix
index 0c9f85a..0e03f52 100644
--- a/machines/mypi3/default.nix
+++ b/machines/mypi3/default.nix
@@ -1,7 +1,44 @@
 {
-  imports = [./hardware-configuration.nix];
+  inputs,
+  pkgs,
+  ...
+}: {
+  imports = [
+    inputs.nixos-hardware.nixosModules.raspberry-pi-3
 
-  custom.hostname = "mypi3";
+    ./hardware-configuration.nix
+  ];
+
+  # https://wiki.nixos.org/wiki/NixOS_on_ARM/Raspberry_Pi_3
+  custom = {
+    hostname = "mypi3";
+
+    services = {
+      borgmatic.repositories = [
+        {
+          path = "ssh://h1m9k594@h1m9k594.repo.borgbase.com/./repo";
+          label = "mypi3";
+        }
+      ];
+    };
+
+    settings = {
+      boot = {
+        #// kernel = pkgs.linuxPackages_rpi3;
+        u-boot = true;
+      };
+    };
+  };
+
+  boot = {
+    # https://wiki.nixos.org/wiki/NixOS_on_ARM/Raspberry_Pi_3#HDMI_output_issue_with_kernel_~6.1_(NixOS_23.05_or_NixOS_unstable)
+    kernelParams = ["cma=320M"];
+
+    # https://github.com/raspberrypi/linux/issues/6049
+    extraModprobeConfig = ''
+      options brcmfmac feature_disable=0x282000 roamoff=1
+    '';
+  };
 
   swapDevices = [
     {
diff --git a/profiles/sbc/default.nix b/profiles/sbc/default.nix
index cfcdc39..5d150f2 100644
--- a/profiles/sbc/default.nix
+++ b/profiles/sbc/default.nix
@@ -1,10 +1,10 @@
 {config, ...}: {
   custom = {
     profile = "sbc";
+    desktop = "kodi";
 
     programs = {
       fastfetch.greet = true;
-      ghostty.minimal = true;
     };
 
     containers = {
@@ -14,18 +14,17 @@
     };
 
     services = {
+      pipewire = {
+        enable = true;
+        pulseaudio = false;
+        system = true;
+      };
+
       #// tailscale.cert = true;
 
       borgmatic = {
         enable = true;
         sources = [config.custom.containers.directory];
-
-        repositories = [
-          {
-            path = "ssh://h1m9k594@h1m9k594.repo.borgbase.com/./repo";
-            label = "mypi3";
-          }
-        ];
       };
 
       # netdata = {
@@ -35,8 +34,10 @@
     };
 
     settings = {
-      boot.u-boot = true;
-      networking.wifi = true;
+      networking = {
+        networkmanager = true;
+        wifi = true;
+      };
     };
   };
 }