push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
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();

View File

@@ -0,0 +1,14 @@
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::<devices::Configs>(&config_content).unwrap();
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());
Ok(())
}
\ No newline at end of file

View File

@@ -0,0 +1,36 @@
{
lib,
fetchFromGitHub,
rustPlatform,
pkg-config,
libudev-zero,
}:
rustPlatform.buildRustPackage {
pname = "uni-sync";
version = "0.2.0";
src = fetchFromGitHub {
owner = "EightB1ts";
repo = "uni-sync";
rev = "ca349942c06fabcc028ce24e79fc6ce7c758452b";
hash = "sha256-K2zX3rKtTaKO6q76xlxX+rDLL0gEsJ2l8x/s1vsp+ZQ=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libudev-zero ];
patches = [
./config_path.patch
./ignore_read-only_filesystem.patch
];
cargoHash = "sha256-Qb0TPpYGDjsqHkI4B8QRz5c9rqZ+H98YjOg5K++zpBg=";
meta = with lib; {
description = "Synchronization tool for Lian Li Uni Controllers";
homepage = "https://github.com/EightB1ts/uni-sync";
license = licenses.mit;
maintainers = with maintainers; [ yunfachi ];
mainProgram = "uni-sync";
};
}