NixOS and music: Experiences?

What other apps and distros do you use to round out your studio?

Moderators: MattKingUSA, khz

Jamesf
Established Member
Posts: 70
Joined: Tue May 28, 2019 12:23 pm
Location: Madrid
Has thanked: 51 times
Been thanked: 13 times

Re: NixOS and music: Experiences?

Post by Jamesf »

s3ej3s wrote:Bumping this...

I've had great success on Debian for over 20 years, but I too have made the jump to NixOS and I'm having a very tough time.

Jamesf, could we compare notes?
Absolutely! It's a steep learning curve, so it's no surprise you're finding it rough.
I can't post my current configs because I'm at the office right now, but what issues are you having?

I'd say to PM me, but it's probably better that we leave a public record for others to find if they run into the same problems.
I'm slow, but I get there eventually.
User avatar
raboof
Established Member
Posts: 1855
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Has thanked: 50 times
Been thanked: 74 times
Contact:

Re: NixOS and music: Experiences?

Post by raboof »

Interesting! I've also been switching to NixOS lately and am pretty happy with their approach, though I haven't done any music stuff on this machine yet.
s3ej3s
Established Member
Posts: 15
Joined: Thu Jan 19, 2017 11:00 am
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: NixOS and music: Experiences?

Post by s3ej3s »

Jamesf wrote:
s3ej3s wrote:Bumping this...

I've had great success on Debian for over 20 years, but I too have made the jump to NixOS and I'm having a very tough time.

Jamesf, could we compare notes?
Absolutely! It's a steep learning curve, so it's no surprise you're finding it rough.
I can't post my current configs because I'm at the office right now, but what issues are you having?

I'd say to PM me, but it's probably better that we leave a public record for others to find if they run into the same problems.
Thanks. Yeah, public would be better for the next searcher.

So, I'm not having a lot of trouble with NixOS per se. But NixOS kind of prescribes jackdbus w/pulseaudio, which I've never done; I've always just used jack1 and killed pulseaudio. I roughly followed this (roughly, because, among other problems, the qjackctl version is quite different): https://nixos.wiki/wiki/JACK. I managed to get ardour5 working, but *most* jack clients fail to connect. Ardour is *extremely* unstable too, but I defer that question to avoid muddying already murky waters.

Maybe you could start by describing, at a high level, how you're running things.
Jamesf
Established Member
Posts: 70
Joined: Tue May 28, 2019 12:23 pm
Location: Madrid
Has thanked: 51 times
Been thanked: 13 times

Re: NixOS and music: Experiences?

Post by Jamesf »

s3ej3s wrote:So, I'm not having a lot of trouble with NixOS per se. But NixOS kind of prescribes jackdbus w/pulseaudio, which I've never done; I've always just used jack1 and killed pulseaudio. I roughly followed this (roughly, because, among other problems, the qjackctl version is quite different): https://nixos.wiki/wiki/JACK. I managed to get ardour5 working, but *most* jack clients fail to connect. Ardour is *extremely* unstable too, but I defer that question to avoid muddying already murky waters.

Maybe you could start by describing, at a high level, how you're running things.
Pulseaudio has always been a thorn in my side, too, honestly. I work around it by letting it have the onboard audio by default, and mostly use Jack in combination with the outboard interface. I'm on a laptop at the moment, though, so YMMV.
Physical setup: Dell XPS13 with Mackie Producer 2.2 interface via USB, plus the usual rat's nest of audio and MIDI cables - I'm actually round-tripping the MIDI through a BeatBuddy, then through an Amplifire, and back to the interface. Oh, and the Mackie comes in via a USB bus, because I ran out of sockets on the XPS (also because I'm lazy, and I'd rather plug/unplug 1 cable than 3).

Jack's been pretty solid for me; the biggest problem I've had lately has been that it typically doesn't exit with qjackctl, causing a few WTFs until I spotted the pattern. Ardour's been good as well, so our experiences are very different at the moment.
I'll post my Nixos configs tonight, when I'm at my personal machine and have ready access to them. One of the nice things about that OS is that it's about as deterministic as it gets, so comparing configs can get you a pretty long way.

Is there a pattern to the kind of thing that causes Ardour to crash for you? Maybe a pattern in the logs/messages it leaves behind? Similarly, is there a common message in the qjackctl messages panel when things fail to connect, assuming you're using that to manage it?
I'm slow, but I get there eventually.
s3ej3s
Established Member
Posts: 15
Joined: Thu Jan 19, 2017 11:00 am
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: NixOS and music: Experiences?

Post by s3ej3s »

Jamesf wrote: Pulseaudio has always been a thorn in my side, too, honestly. I work around it by letting it have the onboard audio by default, and mostly use Jack in combination with the outboard interface. I'm on a laptop at the moment, though, so YMMV.
That would be just fine. I'm using an Lexicon Lambda or sometimes an Omega with Jack. But I also have an Alpha that I could dedicate to pulseaudio (or just use the onboard card). I'm using a old desktop, but I plan on doing something similar with a laptop, for mobility.
Jamesf wrote: Jack's been pretty solid for me; the biggest problem I've had lately has been that it typically doesn't exit with qjackctl, causing a few WTFs until I spotted the pattern. Ardour's been good as well, so our experiences are very different at the moment.
I'll post my Nixos configs tonight, when I'm at my personal machine and have ready access to them. One of the nice things about that OS is that it's about as deterministic as it gets, so comparing configs can get you a pretty long way.
I look forward to seeing your config. The derivation for qjackctl depends on libjack2, so unless you've done something exceptional, I expect you're also on jack2. I agree about the determinism and easy comparison, but I'm currently doing a lot of things with nix-env which of course is more imperative and also external to configuration.tmux. I'm eyeing home-manager to see if I can bring some of that to my user-specific config.
Jamesf wrote: Is there a pattern to the kind of thing that causes Ardour to crash for you? Maybe a pattern in the logs/messages it leaves behind? Similarly, is there a common message in the qjackctl messages panel when things fail to connect, assuming you're using that to manage it?
Yes there is. Ardour isn't crashing, but it freezes up a lot. This is usually - though not always - accompanied by:

Code: Select all

xhci_hcd 0000:00:14.0: WARN Event TRB for slot 1 ep 1 with no TDs queued?
from my kernel.
Jamesf
Established Member
Posts: 70
Joined: Tue May 28, 2019 12:23 pm
Location: Madrid
Has thanked: 51 times
Been thanked: 13 times

Re: NixOS and music: Experiences?

Post by Jamesf »

I distribute my config across a few files and then import them. I've attached the main one,

Code: Select all

workstation_av.nix
, though I had to append a .txt extension because this forum asserted that .nix isn't a valid extension.

Other than that file, I do import

Code: Select all

pkgs.pulseaudioFull
and set

Code: Select all

hardware.pulseaudio.enable = true;
but that's about it. I do run Unstable, but that's for reasons unrelated to audio, and now I'm keeping an eye out for the right time to transition back to a stable channel.

That xhci_hcd error looks like a kernel bug; https://bbs.archlinux.org/viewtopic.php ... 8#p1748368 may or may not help.

home-manager looks like the right way to do some things, but in practice there's only one user of my machines, so I either apply it globally or confine it to a purpose-specific

Code: Select all

shell.nix
file.

Hopefully there's some value for you in here.
Attachments
workstation_av.nix.txt
(2.01 KiB) Downloaded 130 times
I'm slow, but I get there eventually.
s3ej3s
Established Member
Posts: 15
Joined: Thu Jan 19, 2017 11:00 am
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: NixOS and music: Experiences?

Post by s3ej3s »

Jamesf wrote:I distribute my config across a few files and then import them. I've attached the main one,

Code: Select all

workstation_av.nix
, though I had to append a .txt extension because this forum asserted that .nix isn't a valid extension.
Awesome. I really appreciate it.
Jamesf wrote: Other than that file, I do import

Code: Select all

pkgs.pulseaudioFull
and set

Code: Select all

hardware.pulseaudio.enable = true;
but that's about it. I do run Unstable, but that's for reasons unrelated to audio, and now I'm keeping an eye out for the right time to transition back to a stable channel.
Interesting. You just let pulseaudio go on about it's business. No interop with Jack. That sounds ideal. I'll dive into your config before I ask any more questions. But I hope that taking PA out of the equation will at least simplify my problem space.

I *do* know that there are a class of problems that have to do with the fact that NixOS is in some ways a very atypical distro. Sometimes things are looking for resources in places they are not to be found. For example, I had to set LADSPA_PATH and LV2_PATH in my env so that Ardour could find my plugins. That manifests in different ways sometimes.
Jamesf wrote: That xhci_hcd error looks like a kernel bug; https://bbs.archlinux.org/viewtopic.php ... 8#p1748368 may or may not help.
Haha. I'm here because I think I *just* resolved this one. I moved my Lambda from a USB 3.0 port to a USB 2.0 port :/ One, I figured it had to do with some flakiness in the xhci code. Two, it occurred to me that the device was 2.0 based anyway. Bonus is that it freed up those ports for things that can actually benefit from 3.0. At the risk of jinxing myself, I'm calling that one done. :)
Jamesf wrote: home-manager looks like the right way to do some things, but in practice there's only one user of my machines, so I either apply it globally or confine it to a purpose-specific

Code: Select all

shell.nix
file.

Hopefully there's some value for you in here.
That is an excellent point; I'm inclined to agree. However, there's still too much config and state floating around in various dot files and so on. So I think I'll still be having a closer look at home manager.

Anyway, I'll have a look at your config. Thanks again very much!
Jamesf
Established Member
Posts: 70
Joined: Tue May 28, 2019 12:23 pm
Location: Madrid
Has thanked: 51 times
Been thanked: 13 times

Re: NixOS and music: Experiences?

Post by Jamesf »

s3ej3s wrote:nteresting. You just let pulseaudio go on about it's business. No interop with Jack. That sounds ideal.
It works pretty well in practice. Jack just kicks PA off the requested device as long as it's idle, so whatever they changed there, worked.
s3ej3s wrote:I *do* know that there are a class of problems that have to do with the fact that NixOS is in some ways a very atypical distro. Sometimes things are looking for resources in places they are not to be found. For example, I had to set LADSPA_PATH and LV2_PATH in my env so that Ardour could find my plugins. That manifests in different ways sometimes.
This is an odd one. I used to need a shell.nix to set those, but that problem went away. It's possible that I updated .bashrc or the Ardour global configs in the right way, and then clean forgot, so I'll check.
s3ej3s wrote:That is an excellent point; I'm inclined to agree. However, there's still too much config and state floating around in various dot files and so on. So I think I'll still be having a closer look at home manager.
That was purely "this is what I do and why" - please don't take that as discouragement, or "here's why not to." If you do get it to work for you and you're willing to share, I'd be interested in taking a fresh look at whether to adopt it.
I'm slow, but I get there eventually.
s3ej3s
Established Member
Posts: 15
Joined: Thu Jan 19, 2017 11:00 am
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: NixOS and music: Experiences?

Post by s3ej3s »

Well, decoupling jack from pulseaudio lost me RT and did nothing to help with clients that could not connect; no benefit that I can discern.

I think I need to compile a matrix of jack clients and determine which ones are problematic and which ones are not. Off-hand, I know:
  • I can use ardour, hydrogen, bristol, zynaddsubfx, patchage.
  • Ingen, guitarix, catia, and ecasound are examples of apps that can't connect. They tell me there *is* no jack running when it clearly is.
Re: pkgs in configuration.nix, the main reason I'm not doing that atm is that I run stable there, but unstable in my user's config. I'm looking into pinning options.
s3ej3s
Established Member
Posts: 15
Joined: Thu Jan 19, 2017 11:00 am
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: NixOS and music: Experiences?

Post by s3ej3s »

Well, catia, at least, is an open issue: https://github.com/NixOS/nixpkgs/issues/55574
s3ej3s
Established Member
Posts: 15
Joined: Thu Jan 19, 2017 11:00 am
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: NixOS and music: Experiences?

Post by s3ej3s »

Has anyone made any progress with this? I'm dedicating a separate box and diving in again.
Jamesf
Established Member
Posts: 70
Joined: Tue May 28, 2019 12:23 pm
Location: Madrid
Has thanked: 51 times
Been thanked: 13 times

Re: NixOS and music: Experiences?

Post by Jamesf »

s3ej3s wrote: Sun Oct 10, 2021 5:35 pm Has anyone made any progress with this? I'm dedicating a separate box and diving in again.
I'm using Pipewire now, and it's working pretty well. The one fly in my ointment is that Ardour isn't connecting to the JACK dummy server, so I can't run Renoise or LMMS directly into it. I can work around it by exporting drum tracks to file and importing them, but I'm looking forward to it maturing past this point. Either that or it's a config issue I haven't tracked down yet.

Ardour does work fine with the ALSA driver through Pipewire, though.

That Catia issue got resolved, but I've no idea about the specific issues you had. It'd be worth trying it again.
I'm slow, but I get there eventually.
s3ej3s
Established Member
Posts: 15
Joined: Thu Jan 19, 2017 11:00 am
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: NixOS and music: Experiences?

Post by s3ej3s »

Bump

Has there been anymore progress made on any of this? How are we doing?
Jamesf
Established Member
Posts: 70
Joined: Tue May 28, 2019 12:23 pm
Location: Madrid
Has thanked: 51 times
Been thanked: 13 times

Re: NixOS and music: Experiences?

Post by Jamesf »

s3ej3s wrote: Sun Dec 05, 2021 4:18 pm Bump

Has there been anymore progress made on any of this? How are we doing?
Progress on what, in particular? Do you have some expectation that somebody's working on a specific task for you?

Personally, I've backed away from Pipewire for the moment, because it's not quite there yet for my purposes, due to the JACK issue I mentioned earlier. Other than that, it's still working for me; JACK and PA are still doing what they do.

Looking back in the thread, I mentioned having previously set LADSPA_PATH and LV2_PATH. Nixos/Musnix has done a better job of setting those, but I've come back around to explicitly setting them to be sure it's only looking in `/run/current-system/sw/lib/{lv2,vst3,ladspa}` and those subdirectories in my home dir.
I'm slow, but I get there eventually.
s3ej3s
Established Member
Posts: 15
Joined: Thu Jan 19, 2017 11:00 am
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: NixOS and music: Experiences?

Post by s3ej3s »

Jamesf wrote: Sun Dec 05, 2021 5:31 pm
s3ej3s wrote: Sun Dec 05, 2021 4:18 pm Bump

Has there been anymore progress made on any of this? How are we doing?
Progress on what, in particular? Do you have some expectation that somebody's working on a specific task for you?
Oh, no. Certainly not. I didn't mean to give that impression. I just wondered if anyone, anywhere was currently successful doing pro-audio under NixOS.

Before switching to NixOS, I had many years of success and relatively smooth sailing on Debian. When I moved to NixOS, things got hard. I was able to make pretty good progress until about February of 2020, at which point everything stopped working for me altogether. I'm still running at a pinned version of nix as a result. As it is, I'm unable to get anything working at all on an up-to-date version of nixos and it seems like a moving target. The particular problems I have depend on how new the nix version I'm working with is.

One problem I'm having is that I can't even determine how it's *expected* to work under NixOS. Normally, I've run jackd as a user, starting and stopping it either with a script or qjackctl. The NixOS way is that it's part of the system config. I'm guessing that the service is continually running and meant to be controlled by user tools. I can't tell which though -- I seem to have a combination of Jack1 and Jack2 utilities, although I've only install jack2Full. At the old pinned version, qjackctl had a lot of controls greyed out. The newer version doesn't but they clearly have no effect on the running jackd (which is really jackdmp, apparently aliased to jackd). I've tried killing the jackd service and running it as a normal user. But I'm not privileged to do so, despite having added myself to the jackuser group. The way jackd is installed, that group itself is not privileged to execute it -- it's strictly root.

I could go on. I've tried so many things, so many different ways, that I'm sure I'd just muddy the waters further.
Personally, I've backed away from Pipewire for the moment, because it's not quite there yet for my purposes, due to the JACK issue I mentioned earlier. Other than that, it's still working for me; JACK and PA are still doing what they do.
I'm also a bit wary of Pipewire right now. They're not presenting themselves as really being ready yet and, to be honest, I'm trying to avoid introducing any more variables and complexity. For now, I'd be happy if I could just use jack tools and that jack could access my external gear. I'm fine with using pasuspend, etc. I just want to get something simple to work again.

I should say that I'm on unstable and I suspect that the story is very different depending on what nix version you're using. How do you have things configured yourself?
Looking back in the thread, I mentioned having previously set LADSPA_PATH and LV2_PATH. Nixos/Musnix has done a better job of setting those, but I've come back around to explicitly setting them to be sure it's only looking in `/run/current-system/sw/lib/{lv2,vst3,ladspa}` and those subdirectories in my home dir.
Post Reply