···1+diff --git a/tools/yabridgectl/src/config.rs b/tools/yabridgectl/src/config.rs
2+index c1c89cf..d7bd822 100644
3+--- a/tools/yabridgectl/src/config.rs
4++++ b/tools/yabridgectl/src/config.rs
5+@@ -23,6 +23,7 @@ use std::collections::{BTreeMap, BTreeSet};
6+ use std::env;
7+ use std::fmt::Display;
8+ use std::fs;
9++use std::iter;
10+ use std::path::{Path, PathBuf};
11+ use which::which;
12+ use xdg::BaseDirectories;
13+@@ -216,34 +217,24 @@ impl Config {
14+ }
15+ }
16+ None => {
17+- // Search in the system library locations and in `~/.local/share/yabridge` if no
18+- // path was set explicitely. We'll also search through `/usr/local/lib` just in case
19+- // but since we advocate against installing yabridge there we won't list this path
20+- // in the error message when `libyabridge-vst2.so` can't be found.
21+- let system_path = Path::new("/usr/lib");
22++ // Search through NIX_PROFILES & data home directory if no path was set explicitly.
23++ let nix_profiles = env::var("NIX_PROFILES");
24+ let user_path = xdg_dirs.get_data_home();
25+- let lib_directories = [
26+- system_path,
27+- // Used on Debian based distros
28+- Path::new("/usr/lib/x86_64-linux-gnu"),
29+- // Used on Fedora
30+- Path::new("/usr/lib64"),
31+- Path::new("/usr/local/lib"),
32+- Path::new("/usr/local/lib/x86_64-linux-gnu"),
33+- Path::new("/usr/local/lib64"),
34+- &user_path,
35+- ];
36++ let lib_directories = nix_profiles.iter()
37++ .flat_map(|profiles| profiles.split(' ')
38++ .map(|profile| Path::new(profile).join("lib")))
39++ .chain(iter::once(user_path.clone()));
40++
41+ let mut candidates = lib_directories
42+- .iter()
43+ .map(|directory| directory.join(LIBYABRIDGE_VST2_NAME));
44++
45+ match candidates.find(|directory| directory.exists()) {
46+ Some(candidate) => candidate,
47+ _ => {
48+ return Err(anyhow!(
49+- "Could not find '{}' in either '{}' or '{}'. You can override the \
50+- default search path using 'yabridgectl set --path=<path>'.",
51++ "Could not find '{}' through 'NIX_PROFILES' or '{}'. You can override the \
52++ default search path using 'yabridgectl set --path=<path>'.",
53+ LIBYABRIDGE_VST2_NAME,
54+- system_path.display(),
55+ user_path.display()
56+ ));
57+ }
58+diff --git a/tools/yabridgectl/src/main.rs b/tools/yabridgectl/src/main.rs
59+index 0db1bd4..221cdd0 100644
60+--- a/tools/yabridgectl/src/main.rs
61++++ b/tools/yabridgectl/src/main.rs
62+@@ -102,7 +102,7 @@ fn main() -> Result<()> {
63+ .about("Path to the directory containing 'libyabridge-{vst2,vst3}.so'")
64+ .long_about(
65+ "Path to the directory containing 'libyabridge-{vst2,vst3}.so'. If this \
66+- is not set, then yabridgectl will look in both '/usr/lib' and \
67++ is not set, then yabridgectl will look through 'NIX_PROFILES' and \
68+ '~/.local/share/yabridge' by default.",
69+ )
70+ .validator(validate_path)