guixsd-config

GuixSD configs for my systems
Log | Files | Refs

commit 839f05384ab2ec4bddd8a7629a60fa6aedd39d6a
parent f8b5ae24f176d5831ad2c0e61b629a36ff57a12d
Author: Vineet Kumar <git@vineetk.net>
Date:   Sun,  4 Jan 2026 21:11:44 -0500

demiurge: work on audio, not done yet

Diffstat:
Mepistemia/files/alsa/.config/alsa/asoundrc | 54++++--------------------------------------------------
Aepistemia/files/alsa/.config/alsa/asoundrc_old | 95+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mepistemia/home/config.scm | 6++++--
Aepistemia/packages/audio.scm | 37+++++++++++++++++++++++++++++++++++++
Mepistemia/systems/base-system.scm | 6+++++-
Mepistemia/systems/demiurge.scm | 2+-
6 files changed, 146 insertions(+), 54 deletions(-)

diff --git a/epistemia/files/alsa/.config/alsa/asoundrc b/epistemia/files/alsa/.config/alsa/asoundrc @@ -1,5 +1,5 @@ -defaults.pcm.card 4 -defaults.ctl.card 4 +defaults.pcm.card 2 +defaults.ctl.card 2 # 1. HEADPHONES DMIX # Configured for 192kHz, but aligned to 10ms time-slices for Browser compatibility. @@ -41,55 +41,9 @@ pcm.microphone_dsnoop { } } -# 3. DSP PROCESSING CHAIN -# Forces 48kHz logic for the plugins, then upsamples to the 192kHz/1920-frame backend. -pcm.dsp { - type plug - slave { - format FLOAT - #rate 48000 # Force LADSPA to run at 48kHz (CPU efficient) - channels unchanged - pcm { - type ladspa - path "/home/vin/.local/lib/ladspa" - playback_plugins [{ - label "ladspa_dsp:dt700prox" - }] - slave.pcm { - # Inner plug handles 48k -> 192k upsampling - # 480 frames (48k) -> becomes -> 1920 frames (192k) perfectly. - type plug - slave { - pcm headphones_dmix - } - } - } - } -} - -# 4. NOISE SUPPRESSION -pcm.noise_suppressed { - type plug - slave.pcm { - type ladspa - slave.pcm { - type lfloat - slave { - format "S16_LE" - pcm microphone_dsnoop - } - } - path "/usr/lib64/ladspa" - capture_plugins [{ - label noise_suppressor_mono - input { controls [ 50 200 0 ] } - }] - } -} - # 5. DEFAULT DEVICE pcm.!default { type asym - playback.pcm dsp - capture.pcm microphone_dsnoop + playback.pcm "plug:headphones_dmix" + capture.pcm "plug:microphone_dsnoop" } diff --git a/epistemia/files/alsa/.config/alsa/asoundrc_old b/epistemia/files/alsa/.config/alsa/asoundrc_old @@ -0,0 +1,95 @@ +defaults.pcm.card 4 +defaults.ctl.card 4 + +# 1. HEADPHONES DMIX +# Configured for 192kHz, but aligned to 10ms time-slices for Browser compatibility. +pcm.headphones_dmix { + type dmix + ipc_key 77777 # New Key to clear locked state + ipc_perm 0666 + ipc_key_add_uid false + + slave { + pcm "hw:4" + format S32_LE + rate 192000 + channels 2 + + # --- THE MAGIC NUMBERS --- + # Chromium requires 10ms chunks. + # 192000 Hz * 0.010s = 1920 frames. + # We MUST use this exact size so the browser's request matches the hardware buffer. + period_size 1920 + buffer_size 23040 # 12 * 1920 (approx 120ms buffer) + # ------------------------- + } +} + +# 2. MICROPHONE DSNOOP +pcm.microphone_dsnoop { + type dsnoop + ipc_key 88888 + ipc_perm 0666 + ipc_key_add_uid false + + slave { + pcm "hw:3" + rate 48000 + channels 2 + period_size 480 # 10ms at 48kHz (Matches Chromium's clock) + buffer_size 5760 # 12 * 480 + } +} + +# 3. DSP PROCESSING CHAIN +# Forces 48kHz logic for the plugins, then upsamples to the 192kHz/1920-frame backend. +pcm.dsp { + type plug + slave { + format FLOAT + #rate 48000 # Force LADSPA to run at 48kHz (CPU efficient) + channels unchanged + pcm { + type ladspa + path "/home/vin/.local/lib/ladspa" + playback_plugins [{ + label "ladspa_dsp:dt700prox" + }] + slave.pcm { + # Inner plug handles 48k -> 192k upsampling + # 480 frames (48k) -> becomes -> 1920 frames (192k) perfectly. + type plug + slave { + pcm headphones_dmix + } + } + } + } +} + +# 4. NOISE SUPPRESSION +pcm.noise_suppressed { + type plug + slave.pcm { + type ladspa + slave.pcm { + type lfloat + slave { + format "S16_LE" + pcm microphone_dsnoop + } + } + path "/usr/lib64/ladspa" + capture_plugins [{ + label noise_suppressor_mono + input { controls [ 50 200 0 ] } + }] + } +} + +# 5. DEFAULT DEVICE +pcm.!default { + type asym + playback.pcm dsp + capture.pcm microphone_dsnoop +} diff --git a/epistemia/home/config.scm b/epistemia/home/config.scm @@ -2,7 +2,6 @@ #:use-module (gnu home) #:use-module (gnu packages) #:use-module (gnu packages admin) - #:use-module (gnu packages audio) #:use-module (gnu packages authentication) #:use-module (gnu packages curl) #:use-module (gnu packages emacs) @@ -25,6 +24,7 @@ #:use-module (gnu packages web-browsers) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xorg) + #:use-module (epistemia packages audio) #:use-module (epistemia packages minecraft) #:use-module (nongnu packages game-client) #:use-module (gnu home services) @@ -41,7 +41,7 @@ rsync ;; audio - dsp + dsp-ladspa ;; cryptography age @@ -52,6 +52,8 @@ emacs emacs-age emacs-auctex + e/emacs-citar + e/emacs-citeproc e/emacs-clang-format emacs-consult emacs-eat diff --git a/epistemia/packages/audio.scm b/epistemia/packages/audio.scm @@ -0,0 +1,37 @@ +(define-module (epistemia packages audio) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (guix gexp) + #:use-module (gnu packages audio)) + +(define-public dsp-ladspa + (package + (inherit dsp) + (name "dsp-ladspa") + (arguments + (substitute-keyword-arguments (package-arguments dsp) + ((#:phases phases '%standard-phases) + #~(modify-phases #$phases + (add-before 'configure 'provide-ladspa-pc + (lambda* (#:key inputs #:allow-other-keys) + ;; The Guix ladspa package does not provide a .pc file, which + ;; dsp's configure script strictly requires to enable the plugin. + ;; We generate a minimal one here to satisfy the check. + (let* ((ladspa (assoc-ref inputs "ladspa")) + (pkg-dir "fake-pkgconfig") + (pc-file (string-append pkg-dir "/ladspa.pc"))) + (mkdir pkg-dir) + (with-output-to-file pc-file + (lambda _ + (format #t "prefix=~a +includedir=${prefix}/include +Name: ladspa +Description: LADSPA SDK +Version: 1.13 +Cflags: -I${includedir} +Libs: +" ladspa))) + ;; Add our fake pkgconfig dir to the search path + (setenv "PKG_CONFIG_PATH" + (string-append pkg-dir ":" + (or (getenv "PKG_CONFIG_PATH") "")))))))))))) diff --git a/epistemia/systems/base-system.scm b/epistemia/systems/base-system.scm @@ -32,5 +32,9 @@ (packages %base-packages) - (services (append (list (service openssh-service-type)) + (services (append (list (service openssh-service-type) + (service alsa-service-type + (alsa-configuration (pulseaudio? #f))) + (service ladspa-service-type + (ladspa-configuration (plugins (list lsp-plugins))))) %base-services)))) diff --git a/epistemia/systems/demiurge.scm b/epistemia/systems/demiurge.scm @@ -43,7 +43,7 @@ (host-name "demiurge") (kernel linux-6.17) - (kernel-arguments (list "net.ifnames=0")) + (kernel-arguments (list "net.ifnames=0" "modprobe.blacklist=snd_hda_intel")) (kernel-loadable-modules (list (list zfs-linux "module"))) (initrd (lambda (file-systems . args)