diff --git a/pkgs/by-name/un/uni-sync/config_path.patch b/pkgs/by-name/un/uni-sync/config_path.patch deleted file mode 100644 index c59bf80125ae..000000000000 --- a/pkgs/by-name/un/uni-sync/config_path.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/src/main.rs b/src/main.rs -index 357a33b..7073497 100644 ---- a/src/main.rs -+++ b/src/main.rs -@@ -1,4 +1,4 @@ --use std::env; -+use std::path::PathBuf; - - mod devices; - -@@ -8,12 +8,23 @@ fn main() -> Result<(), std::io::Error> { - configs: vec![] - }; - -- let mut config_path = env::current_exe()?; -- config_path.pop(); -- config_path.push("uni-sync.json"); -+ let mut config_path = PathBuf::from("/etc/uni-sync/uni-sync.json"); - - if !config_path.exists() { -- std::fs::write(&config_path, serde_json::to_string_pretty(&configs).unwrap())?; -+ match std::fs::create_dir_all(config_path.parent().unwrap()) { -+ Ok(result) => result, -+ Err(_) => { -+ println!("Please run uni-sync with elevated permissions."); -+ std::process::exit(0); -+ } -+ }; -+ match std::fs::write(&config_path, serde_json::to_string_pretty(&configs).unwrap()) { -+ Ok(result) => result, -+ Err(_) => { -+ println!("Please run uni-sync with elevated permissions."); -+ std::process::exit(0); -+ } -+ }; - } - - let config_content = std::fs::read_to_string(&config_path).unwrap(); diff --git a/pkgs/by-name/un/uni-sync/ignore_read-only_filesystem.patch b/pkgs/by-name/un/uni-sync/ignore_read-only_filesystem.patch index 3a0837d1d224..66cb807e1181 100644 --- a/pkgs/by-name/un/uni-sync/ignore_read-only_filesystem.patch +++ b/pkgs/by-name/un/uni-sync/ignore_read-only_filesystem.patch @@ -2,13 +2,12 @@ diff --git a/src/main.rs b/src/main.rs index f07cc64..357a33b 100644 --- a/src/main.rs +++ b/src/main.rs -@@ -20,7 +20,7 @@ fn main() -> Result<(), std::io::Error> { - configs = serde_json::from_str::(&config_content).unwrap(); - +@@ -46,7 +46,7 @@ fn main() -> Result<(), std::io::Error> { + configs = serde_json::from_str::(&config_content)?; + let new_configs = devices::run(configs); -- std::fs::write(&config_path, serde_json::to_string_pretty(&new_configs).unwrap())?; -+ std::fs::write(&config_path, serde_json::to_string_pretty(&new_configs).unwrap()); - +- std::fs::write(&config_path, serde_json::to_string_pretty(&new_configs)?)?; ++ let _ = std::fs::write(&config_path, serde_json::to_string_pretty(&new_configs)?); + Ok(()) } -\ No newline at end of file diff --git a/pkgs/by-name/un/uni-sync/package.nix b/pkgs/by-name/un/uni-sync/package.nix index ced8b96e4a02..b9a6c724c785 100644 --- a/pkgs/by-name/un/uni-sync/package.nix +++ b/pkgs/by-name/un/uni-sync/package.nix @@ -3,28 +3,27 @@ fetchFromGitHub, rustPlatform, pkg-config, - libudev-zero, + libusb1, }: -rustPlatform.buildRustPackage { +rustPlatform.buildRustPackage (finalAttrs: { pname = "uni-sync"; - version = "0.2.0"; + version = "0.3.1"; src = fetchFromGitHub { owner = "EightB1ts"; repo = "uni-sync"; - rev = "ca349942c06fabcc028ce24e79fc6ce7c758452b"; - hash = "sha256-K2zX3rKtTaKO6q76xlxX+rDLL0gEsJ2l8x/s1vsp+ZQ="; + rev = finalAttrs.version; + hash = "sha256-Qf4tDj55dBHcnCiSEoWt+uwq/gTm0DSTzlOvdw3QThU="; }; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ libudev-zero ]; + buildInputs = [ libusb1 ]; patches = [ - ./config_path.patch ./ignore_read-only_filesystem.patch ]; - cargoHash = "sha256-Qb0TPpYGDjsqHkI4B8QRz5c9rqZ+H98YjOg5K++zpBg="; + cargoHash = "sha256-ot2pbCddvw3njsz36WbFFJ9AAtmojUnRxlUbym1RcgU="; meta = with lib; { description = "Synchronization tool for Lian Li Uni Controllers"; @@ -33,4 +32,4 @@ rustPlatform.buildRustPackage { maintainers = with maintainers; [ yunfachi ]; mainProgram = "uni-sync"; }; -} +})