summaryrefslogtreecommitdiff
path: root/Omni
diff options
context:
space:
mode:
Diffstat (limited to 'Omni')
-rwxr-xr-xOmni/Dev/Beryllium.nix2
-rw-r--r--Omni/Dev/Beryllium/Configuration.nix16
-rw-r--r--Omni/Dev/Beryllium/Live.nix136
-rw-r--r--Omni/Dev/Beryllium/ObsStudio.nix7
4 files changed, 137 insertions, 24 deletions
diff --git a/Omni/Dev/Beryllium.nix b/Omni/Dev/Beryllium.nix
index 5270a12..023523e 100755
--- a/Omni/Dev/Beryllium.nix
+++ b/Omni/Dev/Beryllium.nix
@@ -11,7 +11,7 @@ bild.os {
./Docker.nix
./Vpn.nix
./Beryllium/OpenWebui.nix
- ./Beryllium/ObsStudio.nix
+ ./Beryllium/Live.nix
../Syncthing.nix
];
networking.hostName = "beryllium";
diff --git a/Omni/Dev/Beryllium/Configuration.nix b/Omni/Dev/Beryllium/Configuration.nix
index 63da821..5c10b8c 100644
--- a/Omni/Dev/Beryllium/Configuration.nix
+++ b/Omni/Dev/Beryllium/Configuration.nix
@@ -14,9 +14,6 @@ in {
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
- boot.kernelModules = ["v4l2loopback"];
- boot.extraModulePackages = [pkgs.linuxPackages.v4l2loopback];
-
# Enable networking
networking.networkmanager.enable = true;
@@ -57,19 +54,6 @@ in {
# Enable CUPS to print documents.
services.printing.enable = true;
- # Enable sound with pipewire.
- hardware.pulseaudio.enable = false;
- security.rtkit.enable = true;
- services.pipewire = {
- enable = true;
- alsa.enable = true;
- alsa.support32Bit = true;
- pulse.enable = true;
- # If you want to use JACK applications, uncomment this
- jack.enable = true;
- wireplumber.enable = true;
- };
-
hardware.opengl.enable = true;
hardware.opengl.driSupport32Bit = true;
services.xserver.videoDrivers = ["nvidia"];
diff --git a/Omni/Dev/Beryllium/Live.nix b/Omni/Dev/Beryllium/Live.nix
new file mode 100644
index 0000000..9578cf0
--- /dev/null
+++ b/Omni/Dev/Beryllium/Live.nix
@@ -0,0 +1,136 @@
+{pkgs, ...}: {
+ programs.obs-studio = {
+ enable = true;
+ enableVirtualCamera = true;
+ plugins = with pkgs.obs-studio-plugins; [
+ obs-pipewire-audio-capture
+ ];
+ };
+
+ # Enable sound with pipewire.
+ hardware.pulseaudio.enable = false;
+ security.rtkit.enable = true;
+
+ # Latency optimization
+ boot.kernelParams = ["threadirqs"];
+ boot.kernel.sysctl."vm.swappiness" = 10;
+
+ environment.systemPackages = with pkgs; [
+ helvum
+ qpwgraph # better than helvum?
+ supercollider-with-plugins
+ #supercollider-with-sc3-plugins
+ pamixer # cli volume control
+ patchage # another connection manager
+ pwvucontrol # gui for quick adjustments
+ ];
+
+ # Virtual sinks for routing audio
+ services.pipewire = {
+ enable = true;
+ alsa.enable = true;
+ alsa.support32Bit = true;
+ pulse.enable = true;
+ jack.enable = true;
+ wireplumber.enable = true;
+
+ extraConfig.pipewire = {
+ "10-loopback" = {
+ # loopback my mic into my headphones so i can hear myself, this creates
+ # an auditory space that encourages focus and thinking
+
+ "context.properties" = {
+ "default.clock.rate" = 48000;
+ "default.clock.quantum" = 128; # lower for less latency
+ "default.clock.min-quantum" = 32;
+ "default.clock.max-quantum" = 8192;
+ };
+
+ "context.exec" = [
+ {
+ "path" = "${pkgs.writeShellScript "setup-mic-monitor" ''
+ sleep 1
+ ${pkgs.pipewire}/bin/pw-link \
+ "alsa_input.usb-Antlion_Audio_Antlion_USB_Microphone-00.pro-input-0:capture_AUX0" \
+ "input.mic-monitor:input_FL"
+
+ ${pkgs.pipewire}/bin/pw-link \
+ "alsa_input.usb-Antlion_Audio_Antlion_USB_Microphone-00.pro-input-0:capture_AUX0" \
+ "input.mic-monitor:input_FR"
+ ''}";
+ }
+ ];
+
+ "context.modules" = [
+ {
+ name = "libpipewire-module-loopback";
+ args = {
+ "node.name" = "mic-monitor";
+ "node.description" = "Microphone Monitor";
+ "capture.props" = {
+ "target.object" = "alsa_input.usb-Antlion_Audio_Antlion_USB_Microphone-00.pro-input-0";
+ "channelmix.normalize" = true;
+ "audio.channels" = 2;
+ "audio.position" = ["FR" "FL"];
+ };
+ "playback.props" = {
+ "target.object" = "alsa_output.usb-Focusrite_Scarlett_Solo_USB-00.HiFi__Line1__sink";
+ "node.passive" = true;
+ "channelmix.normalize" = true;
+ "audio.channels" = 2;
+ "audio.position" = ["FR" "FL"];
+ };
+ };
+ }
+ ];
+ };
+
+ "10-combined" = {
+ "context.modules" = [
+ {
+ name = "libpipewire-module-loopback";
+ args = {
+ "node.name" = "combined-audio";
+ "node.description" = "Combined Mic+Desktop Audio";
+ "capture.props" = {
+ "media.class" = "Audio/Sink";
+ "audio.class" = 2;
+ "audio.position" = ["FL" "FR"];
+ "channelmix.normalize" = true;
+ };
+ "playback.props" = {
+ "media.class" = "Audio/Source";
+ "audio.channels" = 2;
+ "audio.position" = ["FL" "FR"];
+ "channelmix.normalize" = true;
+ };
+ };
+ }
+ ];
+
+ "context.exec" = [
+ {
+ "path" = "${pkgs.writeShellScript "setup-audio-routing" ''
+ sleep 1
+ ${pkgs.pipewire}/bin/pw-link \
+ "alsa_input.usb-Antlion_Audio_Antlion_USB_Microphone-00.pro-input-0:capture_AUX0" \
+ "input.combined-audio:playback_FL"
+
+ ${pkgs.pipewire}/bin/pw-link \
+ "alsa_input.usb-Antlion_Audio_Antlion_USB_Microphone-00.pro-input-0:capture_AUX0" \
+ "input.combined-audio:playback_FR"
+
+ ${pkgs.pipewire}/bin/pw-link \
+ "input.combined-audio:monitor_FL" \
+ "alsa_output.usb-Focusrite_Scarlett_Solo_USB-00.HiFi__Line1__sink:playback_FL"
+
+ ${pkgs.pipewire}/bin/pw-link \
+ "input.combined-audio:monitor_FR" \
+ "alsa_output.usb-Focusrite_Scarlett_Solo_USB-00.HiFi__Line1__sink:playback_FR"
+ ''}";
+ }
+ ];
+ };
+ };
+ };
+}
diff --git a/Omni/Dev/Beryllium/ObsStudio.nix b/Omni/Dev/Beryllium/ObsStudio.nix
deleted file mode 100644
index 151cf03..0000000
--- a/Omni/Dev/Beryllium/ObsStudio.nix
+++ /dev/null
@@ -1,7 +0,0 @@
-{...}: {
- programs.obs-studio = {
- enable = true;
- enableVirtualCamera = true;
- plugins = [];
- };
-}