yabridgectl: 2.2.1 -> 3.0.0
This commit is contained in:
parent
26a970df50
commit
ebbb927bee
|
@ -6,7 +6,7 @@ rustPlatform.buildRustPackage rec {
|
||||||
|
|
||||||
src = yabridge.src;
|
src = yabridge.src;
|
||||||
sourceRoot = "source/tools/yabridgectl";
|
sourceRoot = "source/tools/yabridgectl";
|
||||||
cargoSha256 = "08j865n9vjnkc1g33lnzlj2nr3raj3av9cnvdqbkh65kr4zs4r9h";
|
cargoSha256 = "1sjhani8h7ap42yqlnj05sx59jyz2h12qlm1ibv8ldxcpwps0bwy";
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
./libyabridge-from-nix-profiles.patch
|
./libyabridge-from-nix-profiles.patch
|
||||||
|
|
|
@ -1,64 +1,70 @@
|
||||||
diff --git a/tools/yabridgectl/src/config.rs b/tools/yabridgectl/src/config.rs
|
diff --git a/tools/yabridgectl/src/config.rs b/tools/yabridgectl/src/config.rs
|
||||||
index fbb6b97..5499b6c 100644
|
index c1c89cf..d7bd822 100644
|
||||||
--- a/tools/yabridgectl/src/config.rs
|
--- a/tools/yabridgectl/src/config.rs
|
||||||
+++ b/tools/yabridgectl/src/config.rs
|
+++ b/tools/yabridgectl/src/config.rs
|
||||||
@@ -20,8 +20,10 @@ use anyhow::{anyhow, Context, Result};
|
@@ -23,6 +23,7 @@ use std::collections::{BTreeMap, BTreeSet};
|
||||||
use rayon::prelude::*;
|
use std::env;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
|
||||||
use std::collections::{BTreeMap, BTreeSet};
|
|
||||||
+use std::env;
|
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
+use std::iter;
|
+use std::iter;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use which::which;
|
use which::which;
|
||||||
use xdg::BaseDirectories;
|
use xdg::BaseDirectories;
|
||||||
@@ -176,14 +178,15 @@ impl Config {
|
@@ -216,34 +217,24 @@ impl Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
- // Search in the two common installation locations if no path was set explicitely.
|
- // Search in the system library locations and in `~/.local/share/yabridge` if no
|
||||||
- // We'll also search through `/usr/local/lib` just in case but since we advocate
|
- // path was set explicitely. We'll also search through `/usr/local/lib` just in case
|
||||||
- // against isntalling yabridge there we won't list this path in the error message
|
- // but since we advocate against installing yabridge there we won't list this path
|
||||||
- // when `libyabridge.so` can't be found.
|
- // in the error message when `libyabridge-vst2.so` can't be found.
|
||||||
- let system_path = Path::new("/usr/lib");
|
- let system_path = Path::new("/usr/lib");
|
||||||
- let system_path_alt = Path::new("/usr/local/lib");
|
|
||||||
+ // Search through NIX_PROFILES & data home directory if no path was set explicitly.
|
+ // Search through NIX_PROFILES & data home directory if no path was set explicitly.
|
||||||
+ let nix_profiles = env::var("NIX_PROFILES");
|
+ let nix_profiles = env::var("NIX_PROFILES");
|
||||||
let user_path = yabridge_directories()?.get_data_home();
|
let user_path = xdg_dirs.get_data_home();
|
||||||
- for directory in &[system_path, system_path_alt, &user_path] {
|
- let lib_directories = [
|
||||||
|
- system_path,
|
||||||
|
- // Used on Debian based distros
|
||||||
|
- Path::new("/usr/lib/x86_64-linux-gnu"),
|
||||||
|
- // Used on Fedora
|
||||||
|
- Path::new("/usr/lib64"),
|
||||||
|
- Path::new("/usr/local/lib"),
|
||||||
|
- Path::new("/usr/local/lib/x86_64-linux-gnu"),
|
||||||
|
- Path::new("/usr/local/lib64"),
|
||||||
|
- &user_path,
|
||||||
|
- ];
|
||||||
+ let lib_directories = nix_profiles.iter()
|
+ let lib_directories = nix_profiles.iter()
|
||||||
+ .flat_map(|profiles| profiles.split(' ')
|
+ .flat_map(|profiles| profiles.split(' ')
|
||||||
+ .map(|profile| Path::new(profile).join("lib")))
|
+ .map(|profile| Path::new(profile).join("lib")))
|
||||||
+ .chain(iter::once(user_path.clone()));
|
+ .chain(iter::once(user_path.clone()));
|
||||||
+
|
+
|
||||||
+ for directory in lib_directories {
|
let mut candidates = lib_directories
|
||||||
let candidate = directory.join(LIBYABRIDGE_NAME);
|
- .iter()
|
||||||
if candidate.exists() {
|
.map(|directory| directory.join(LIBYABRIDGE_VST2_NAME));
|
||||||
return Ok(candidate);
|
+
|
||||||
@@ -191,10 +194,9 @@ impl Config {
|
match candidates.find(|directory| directory.exists()) {
|
||||||
}
|
Some(candidate) => candidate,
|
||||||
|
_ => {
|
||||||
Err(anyhow!(
|
return Err(anyhow!(
|
||||||
- "Could not find '{}' in either '{}' or '{}'. You can override the default \
|
- "Could not find '{}' in either '{}' or '{}'. You can override the \
|
||||||
- search path using 'yabridgectl set --path=<path>'.",
|
- default search path using 'yabridgectl set --path=<path>'.",
|
||||||
+ "Could not find '{}' through 'NIX_PROFILES' or '{}'. You can override the \
|
+ "Could not find '{}' through 'NIX_PROFILES' or '{}'. You can override the \
|
||||||
+ default search path using 'yabridgectl set --path=<path>'.",
|
+ default search path using 'yabridgectl set --path=<path>'.",
|
||||||
LIBYABRIDGE_NAME,
|
LIBYABRIDGE_VST2_NAME,
|
||||||
- system_path.display(),
|
- system_path.display(),
|
||||||
user_path.display()
|
user_path.display()
|
||||||
))
|
));
|
||||||
}
|
}
|
||||||
diff --git a/tools/yabridgectl/src/main.rs b/tools/yabridgectl/src/main.rs
|
diff --git a/tools/yabridgectl/src/main.rs b/tools/yabridgectl/src/main.rs
|
||||||
index 649ce4e..0f1f0e7 100644
|
index 0db1bd4..221cdd0 100644
|
||||||
--- a/tools/yabridgectl/src/main.rs
|
--- a/tools/yabridgectl/src/main.rs
|
||||||
+++ b/tools/yabridgectl/src/main.rs
|
+++ b/tools/yabridgectl/src/main.rs
|
||||||
@@ -102,7 +102,7 @@ fn main() -> Result<()> {
|
@@ -102,7 +102,7 @@ fn main() -> Result<()> {
|
||||||
.about("Path to the directory containing 'libyabridge.so'")
|
.about("Path to the directory containing 'libyabridge-{vst2,vst3}.so'")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Path to the directory containing 'libyabridge.so'. If this is \
|
"Path to the directory containing 'libyabridge-{vst2,vst3}.so'. If this \
|
||||||
- not set, then yabridgectl will look in both '/usr/lib' and \
|
- is not set, then yabridgectl will look in both '/usr/lib' and \
|
||||||
+ not set, then yabridgectl will look through 'NIX_PROFILES' and \
|
+ is not set, then yabridgectl will look through 'NIX_PROFILES' and \
|
||||||
'~/.local/share/yabridge' by default.",
|
'~/.local/share/yabridge' by default.",
|
||||||
)
|
)
|
||||||
.validator(validate_path)
|
.validator(validate_path)
|
||||||
|
|
Loading…
Reference in a new issue