diff --git a/nixos/ryu/apps/audio.nix b/nixos/ryu/apps/audio.nix new file mode 100644 index 0000000..b5a1b31 --- /dev/null +++ b/nixos/ryu/apps/audio.nix @@ -0,0 +1,75 @@ +{ + pkgs, + lib, + ... +}: let + # Carla links against jack2's libjack; on PipeWire it must load pipewire-jack's + # drop-in instead (what `pw-jack` does via LD_LIBRARY_PATH). Wrap so it just works. + # JACK clients (Carla, Guitarix) are linked against jack2; on PipeWire they + # must load pipewire-jack's drop-in libjack (what `pw-jack` does). Without it + # they report "jack server not running". Wrap every bin to inject the lib. + withPwJack = pkg: + pkgs.symlinkJoin { + name = "${pkg.pname or pkg.name}-pw"; + paths = [pkg]; + nativeBuildInputs = [pkgs.makeWrapper]; + postBuild = '' + for b in $out/bin/*; do + wrapProgram "$b" \ + --prefix LD_LIBRARY_PATH : ${pkgs.pipewire.jack}/lib \ + --set-default PIPEWIRE_LATENCY "256/48000" + done + ''; + }; + + carla-pw = withPwJack pkgs.carla; + guitarix-pw = withPwJack pkgs.guitarix; + + # mikeoliphant's NAM-LV2 is headless by design. Ratatouille is brummer10's + # GUI neural loader: loads .nam (and RTNeural) models plus a built-in dual IR + # cab loader, with an X11/cairo UI. Not yet in nixpkgs. + ratatouille = pkgs.stdenv.mkDerivation (finalAttrs: { + pname = "ratatouille-lv2"; + version = "0.9.11"; + + src = pkgs.fetchFromGitHub { + owner = "brummer10"; + repo = "Ratatouille.lv2"; + tag = "v${finalAttrs.version}"; + fetchSubmodules = true; + hash = "sha256-mig3yUGSNz1xuyz6ljKqJUjNqmEcsbXSH1vTxTGdOFk="; + }; + + nativeBuildInputs = [pkgs.pkg-config]; + buildInputs = [pkgs.libsndfile pkgs.cairo pkgs.xorg.libX11 pkgs.lv2]; + + # Build uses -flto -fno-fat-lto-objects, so archives hold LTO bytecode; + # plain `ar` can't index them. gcc-ar loads the LTO plugin. + buildPhase = '' + runHook preBuild + make lv2 AR=gcc-ar + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + make install INSTALL_DIR="$out/lib/lv2" + runHook postInstall + ''; + + meta = { + description = "Neural amp modeler + IR loader LV2 with GUI (NAM/RTNeural)"; + homepage = "https://github.com/brummer10/Ratatouille.lv2"; + license = lib.licenses.bsd0; + platforms = lib.platforms.linux; + }; + }); +in { + environment.systemPackages = [ + pkgs.neural-amp-modeler-lv2 + pkgs.ir.lv2 + guitarix-pw + ratatouille + carla-pw + ]; +} diff --git a/nixos/ryu/apps/default.nix b/nixos/ryu/apps/default.nix index 7ded199..6981c6b 100644 --- a/nixos/ryu/apps/default.nix +++ b/nixos/ryu/apps/default.nix @@ -17,5 +17,6 @@ ./sgdboop.nix ./slo.nix ./umu.nix + ./audio.nix ]; } diff --git a/nixos/ryu/services/pipewire.nix b/nixos/ryu/services/pipewire.nix index 74e7bd0..f6a98cb 100644 --- a/nixos/ryu/services/pipewire.nix +++ b/nixos/ryu/services/pipewire.nix @@ -5,6 +5,7 @@ alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; + jack.enable = true; extraConfig = { pipewire = { "10-clock-rate" = {