Commit 6abdbda9 authored by Robert Schütz's avatar Robert Schütz
Browse files
parent d09cd1d7
Loading
Loading
Loading
Loading
+3 −19
Original line number Diff line number Diff line
{ lib
, stdenv
, rust
, rustPlatform
, fetchFromGitHub
, substituteAll
@@ -22,23 +21,16 @@

rustPlatform.buildRustPackage rec {
  pname = "celeste";
  version = "0.5.8";
  version = "0.7.0";

  src = fetchFromGitHub {
    owner = "hwittenborn";
    repo = "celeste";
    rev = "v${version}";
    hash = "sha256-U/6aqQig+uuWj/B9CODnV6chxY+KfMH7DqnPtSTDSA0=";
    hash = "sha256-fqPAQCbuPnFyn3wioWDETmcXu53808nvnlEzcdUevI4=";
  };

  cargoHash = "sha256-69LK/oicfmSPbUGGzWV9kvXkHqMvEzCG8xCu61MxSdk=";

  patches = [
    (substituteAll {
      src = ./target-dir.patch;
      rustTarget = rust.toRustTarget stdenv.hostPlatform;
    })
  ];
  cargoHash = "sha256-mVl7CsCX7HMlGC2EIKEfHnPNjmrexjsrpDK/Uq/GwpY=";

  postPatch = ''
    pushd $cargoDepsCopy/librclone-sys
@@ -61,14 +53,6 @@ rustPlatform.buildRustPackage rec {
    cargo update --offline
  '';

  # We need to build celeste-tray first because celeste/src/launch.rs reads that file at build time.
  # Upstream does the same: https://github.com/hwittenborn/celeste/blob/765dfa2/justfile#L1-L3
  cargoBuildFlags = [ "--bin" "celeste-tray" ];
  postConfigure = ''
    cargoBuildHook
    cargoBuildFlags=
  '';

  RUSTC_BOOTSTRAP = 1;

  nativeBuildInputs = [
+0 −16
Original line number Diff line number Diff line
diff --git a/celeste/src/launch.rs b/celeste/src/launch.rs
index 5227170..e3cf189 100644
--- a/celeste/src/launch.rs
+++ b/celeste/src/launch.rs
@@ -172,10 +172,7 @@ impl TrayApp {
         perms.set_mode(0o755);
         file.set_permissions(perms).unwrap();
 
-        #[cfg(debug_assertions)]
-        let tray_file = include_bytes!("../../target/debug/celeste-tray");
-        #[cfg(not(debug_assertions))]
-        let tray_file = include_bytes!("../../target/release/celeste-tray");
+        let tray_file = include_bytes!(concat!("../../target/@rustTarget@/", env!("cargoBuildType"), "/celeste-tray"));
 
         file.write_all(tray_file).unwrap();
         drop(file);