celeste: init at 0.4.6

authored by Robert Schütz and committed by Robert Schütz ea0070a5 6d9f07d8

+163
+114
pkgs/applications/networking/sync/celeste/default.nix
··· 1 + { lib 2 + , stdenv 3 + , rust 4 + , rustPlatform 5 + , fetchFromGitHub 6 + , substituteAll 7 + , fetchpatch 8 + , pkg-config 9 + , wrapGAppsHook4 10 + , cairo 11 + , gdk-pixbuf 12 + , glib 13 + , graphene 14 + , gtk3 15 + , gtk4 16 + , libadwaita 17 + , libappindicator-gtk3 18 + , librclone 19 + , pango 20 + , rclone 21 + }: 22 + 23 + let 24 + # https://github.com/trevyn/librclone/pull/8 25 + librclone-mismatched-types-patch = fetchpatch { 26 + name = "use-c_char-to-be-platform-independent.patch"; 27 + url = "https://github.com/trevyn/librclone/commit/91fdf3fa5f5eea0dfd06981ba72e09034974fdad.patch"; 28 + hash = "sha256-8YDyUNP/ISP5jCliT6UCxZ89fdRFud+6u6P29XdPy58="; 29 + }; 30 + in rustPlatform.buildRustPackage rec { 31 + pname = "celeste"; 32 + version = "0.4.6"; 33 + 34 + src = fetchFromGitHub { 35 + owner = "hwittenborn"; 36 + repo = "celeste"; 37 + rev = "v${version}"; 38 + hash = "sha256-VEyQlycpqsGKqtV/QvqBfVHqQhl/H6HsWPRDBtQO3qM="; 39 + }; 40 + 41 + cargoHash = "sha256-fqt0XklJJAXi2jO7eo0tIwRo2Y3oM56qYwoaelKY8iU="; 42 + 43 + patches = [ 44 + (substituteAll { 45 + src = ./target-dir.patch; 46 + rustTarget = rust.toRustTarget stdenv.hostPlatform; 47 + }) 48 + ]; 49 + 50 + postPatch = '' 51 + pushd $cargoDepsCopy/librclone-sys 52 + oldHash=$(sha256sum build.rs | cut -d " " -f 1) 53 + patch -p2 < ${./librclone-path.patch} 54 + substituteInPlace build.rs \ 55 + --subst-var-by librclone ${librclone} 56 + substituteInPlace .cargo-checksum.json \ 57 + --replace $oldHash $(sha256sum build.rs | cut -d " " -f 1) 58 + popd 59 + pushd $cargoDepsCopy/librclone 60 + oldHash=$(sha256sum src/lib.rs | cut -d " " -f 1) 61 + patch -p1 < ${librclone-mismatched-types-patch} 62 + substituteInPlace .cargo-checksum.json \ 63 + --replace $oldHash $(sha256sum src/lib.rs | cut -d " " -f 1) 64 + popd 65 + ''; 66 + 67 + # Cargo.lock is outdated 68 + preConfigure = '' 69 + cargo update --offline 70 + ''; 71 + 72 + # We need to build celeste-tray first because celeste/src/launch.rs reads that file at build time. 73 + # Upstream does the same: https://github.com/hwittenborn/celeste/blob/765dfa2/justfile#L1-L3 74 + cargoBuildFlags = [ "--bin" "celeste-tray" ]; 75 + postConfigure = '' 76 + cargoBuildHook 77 + cargoBuildFlags= 78 + ''; 79 + 80 + RUSTC_BOOTSTRAP = 1; 81 + 82 + nativeBuildInputs = [ 83 + pkg-config 84 + rustPlatform.bindgenHook 85 + wrapGAppsHook4 86 + ]; 87 + 88 + buildInputs = [ 89 + cairo 90 + gdk-pixbuf 91 + glib 92 + graphene 93 + gtk3 94 + gtk4 95 + libadwaita 96 + librclone 97 + pango 98 + ]; 99 + 100 + preFixup = '' 101 + gappsWrapperArgs+=( 102 + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libappindicator-gtk3 ]}" 103 + --prefix PATH : "${lib.makeBinPath [ rclone ]}" 104 + ) 105 + ''; 106 + 107 + meta = { 108 + changelog = "https://github.com/hwittenborn/celeste/blob/${src.rev}/CHANGELOG.md"; 109 + description = "GUI file synchronization client that can sync with any cloud provider"; 110 + homepage = "https://github.com/hwittenborn/celeste"; 111 + license = lib.licenses.gpl3Only; 112 + maintainers = with lib.maintainers; [ dotlambda ]; 113 + }; 114 + }
+31
pkgs/applications/networking/sync/celeste/librclone-path.patch
··· 1 + diff --git a/librclone-sys/build.rs b/librclone-sys/build.rs 2 + index 10e45bc..7d04c08 100644 3 + --- a/librclone-sys/build.rs 4 + +++ b/librclone-sys/build.rs 5 + @@ -16,15 +16,8 @@ fn main() { 6 + println!("cargo:rerun-if-changed=go.mod"); 7 + println!("cargo:rerun-if-changed=go.sum"); 8 + 9 + - Command::new("go") 10 + - .args(["build", "--buildmode=c-archive", "-o"]) 11 + - .arg(&format!("{}/librclone.a", out_dir)) 12 + - .arg("github.com/rclone/rclone/librclone") 13 + - .status() 14 + - .expect("`go build` failed. Is `go` installed and latest version?"); 15 + - 16 + - println!("cargo:rustc-link-search=native={}", out_dir); 17 + - println!("cargo:rustc-link-lib=static=rclone"); 18 + + println!("cargo:rustc-link-search=native={}", "@librclone@/lib"); 19 + + println!("cargo:rustc-link-lib=dylib=rclone"); 20 + 21 + if target_triple.ends_with("darwin") { 22 + println!("cargo:rustc-link-lib=framework=CoreFoundation"); 23 + @@ -32,7 +25,7 @@ fn main() { 24 + } 25 + 26 + let bindings = bindgen::Builder::default() 27 + - .header(format!("{}/librclone.h", out_dir)) 28 + + .header(format!("{}/librclone.h", "@librclone@/include")) 29 + .allowlist_function("RcloneRPC") 30 + .allowlist_function("RcloneInitialize") 31 + .allowlist_function("RcloneFinalize")
+16
pkgs/applications/networking/sync/celeste/target-dir.patch
··· 1 + diff --git a/celeste/src/launch.rs b/celeste/src/launch.rs 2 + index 5227170..e3cf189 100644 3 + --- a/celeste/src/launch.rs 4 + +++ b/celeste/src/launch.rs 5 + @@ -172,10 +172,7 @@ impl TrayApp { 6 + perms.set_mode(0o755); 7 + file.set_permissions(perms).unwrap(); 8 + 9 + - #[cfg(debug_assertions)] 10 + - let tray_file = include_bytes!("../../target/debug/celeste-tray"); 11 + - #[cfg(not(debug_assertions))] 12 + - let tray_file = include_bytes!("../../target/release/celeste-tray"); 13 + + let tray_file = include_bytes!(concat!("../../target/@rustTarget@/", env!("cargoBuildType"), "/celeste-tray")); 14 + 15 + file.write_all(tray_file).unwrap(); 16 + drop(file);
+2
pkgs/top-level/all-packages.nix
··· 28895 28895 inherit (darwin.apple_sdk.frameworks) Carbon; 28896 28896 }; 28897 28897 28898 + celeste = callPackage ../applications/networking/sync/celeste { }; 28899 + 28898 28900 cyan = callPackage ../applications/graphics/cyan {}; 28899 28901 28900 28902 cyanrip = callPackage ../applications/audio/cyanrip { };