Unverified Commit b553e47e authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

atuin-desktop: 0.2.11 -> 0.2.19 (#479590)

parents e23c5076 15cdb1d0
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
From 7534c427f720ce2134a4fba7b7c3f8cddadf9069 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Chocholat=C3=BD?= <chocholaty.david@protonmail.com>
Date: Sat, 31 Jan 2026 11:04:04 +0100
Subject: [PATCH] fix: Remove duplicate dependency entry for tauri-build

---
 Cargo.lock | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 80a7920f..92a7bef6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -590,7 +590,6 @@ dependencies = [
  "sqlx",
  "syntect",
  "tauri",
- "tauri-build 2.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "tauri-plugin-deep-link",
  "tauri-plugin-dialog",
  "tauri-plugin-fs",
@@ -8932,28 +8931,6 @@ dependencies = [
  "windows 0.61.1",
 ]
 
-[[package]]
-name = "tauri-build"
-version = "2.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17fcb8819fd16463512a12f531d44826ce566f486d7ccd211c9c8cebdaec4e08"
-dependencies = [
- "anyhow",
- "cargo_toml",
- "dirs 6.0.0",
- "glob",
- "heck 0.5.0",
- "json-patch",
- "schemars",
- "semver",
- "serde",
- "serde_json",
- "tauri-utils",
- "tauri-winres",
- "toml 0.9.8",
- "walkdir",
-]
-
 [[package]]
 name = "tauri-build"
 version = "2.5.3"
-- 
2.51.2
+94 −19
Original line number Diff line number Diff line
@@ -9,9 +9,8 @@
  cargo-tauri,
  nodejs,
  pkg-config,
  fetchPnpmDeps,
  pnpmConfigHook,
  pnpm,
  bun,
  writableTmpDirAsHomeHook,

  alsa-lib,
  glib-networking,
@@ -21,31 +20,88 @@
}:
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "atuin-desktop";
  # TODO When updating the version, check if the version-mismatch workaround in preBuild is still needed
  version = "0.2.11";
  version = "0.2.19";

  src = fetchFromGitHub {
    owner = "atuinsh";
    repo = "desktop";
    tag = "v${finalAttrs.version}";
    hash = "sha256-tVIT3GUJ1qcv6HSvO+nqAz+VMfd8g9AjgaqE6+GSa+I=";
    hash = "sha256-itfpRG8znMz0IRK9n4BMxkhkWR7CIjkEY4JQXBgCeYQ=";
  };

  cargoRoot = "./.";
  cargoHash = "sha256-T3cPvwph71lpqlGcugAO4Ua8Y5TNZSySbQatxcvoT4E=";
  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit (finalAttrs)
      # TMP: Include patches from root to ensure Cargo.lock consistency between root and deps.
      patches
      src
      ;
    hash = "sha256-bSTBfnSUID1+G4maLqtLEgqYuFkpIi6KN++/QBtte/0=";
  };

  patches = [
    # TMP: Until a duplicate entry for `tauri-build` dependency in `Cargo.lock` is resolved
    #  (https://github.com/atuinsh/desktop/issues/364), remove one of the duplicated entries.
    ./0001-fix-Remove-duplicate-dependency-entry-for-tauri-build.patch
  ];

  node_modules = stdenv.mkDerivation {
    inherit (finalAttrs) src version;
    pname = "${finalAttrs.pname}-node_modules";

    impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
      "GIT_PROXY_COMMAND"
      "SOCKS_SERVER"
    ];

    nativeBuildInputs = [
      bun
      writableTmpDirAsHomeHook
    ];

    dontConfigure = true;
    dontFixup = true;
    dontPatchShebangs = true; # Patch shebangs manually in configurePhase after copying node_modules in the main derivation.

    buildPhase = ''
      runHook preBuild

  pnpmDeps = fetchPnpmDeps {
    inherit (finalAttrs) pname version src;
    fetcherVersion = 2;
    hash = "sha256-XqKGAx2Q9cWO1oG4mP1cKM2Y9Pib5haFYEaq0PAfAdQ=";
      export BUN_INSTALL_CACHE_DIR=$(mktemp -d)

      # Install dependencies without running lifecycle scripts:
      #  - Skip scripts to avoid running ts-tiny-activerecord's prepare script with unpatched shebangs.
      #  - Rebuild in the main derivation after shebangs are patched there manually.
      bun install \
        --force \
        --no-progress \
        --frozen-lockfile \
        --ignore-scripts

      runHook postBuild
    '';
    installPhase = ''
      runHook preInstall

      cp -R ./node_modules $out

      runHook postInstall
    '';
    outputHash =
      {
        aarch64-darwin = "sha256-YbjDAa2KG8U0ODqIYc5h7iNr5px+6+iforDrPomOVDo=";
        aarch64-linux = "sha256-JoUPAfBF4xdQxtx+J/VNpYomBACNsL7Wes0XXuGByGk=";
        x86_64-darwin = "sha256-YzxQyZPfcQci8QsGEDRTcc2A9tmvem3cHkv/OBFlWDQ=";
        x86_64-linux = "sha256-w8fMS6f+F+23EtMjjl0RsHMm6b5jOXSwUDAc21vqLAg=";
      }
      .${stdenv.hostPlatform.system}
        or (throw "${finalAttrs.pname}: Platform ${stdenv.hostPlatform.system} is not packaged yet.");
    outputHashMode = "recursive";
  };

  nativeBuildInputs = [
    cargo-tauri.hook
    pnpmConfigHook
    pnpm
    rustPlatform.bindgenHook

    bun
    nodejs
    pkg-config
  ]
@@ -60,7 +116,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
  ];

  env = {
    # Used upstream: https://github.com/atuinsh/desktop/blob/6ddebdf66c70042defe5587f7f6c433f889b9ef4/.envrc#L1
    # Used upstream: https://github.com/atuinsh/desktop/blob/v0.2.19/.envrc#L1
    NODE_OPTIONS = "--max-old-space-size=6144";

    # TMP: Fix build failure with GCC 15.
@@ -71,16 +127,35 @@ rustPlatform.buildRustPackage (finalAttrs: {
  tauriConf = builtins.toJSON { bundle.createUpdaterArtifacts = false; };
  passAsFile = [ "tauriConf" ];
  preBuild = ''
    npm rebuild ts-tiny-activerecord
    tauriBuildFlags+=(
      "--config"
      "$tauriConfPath"
      # Skips the version mismatch check (and accepts the consequences)
      # ref: https://github.com/atuinsh/desktop/issues/313
      "--ignore-version-mismatches"
    )
  '';

  configurePhase = ''
    runHook preConfigure

    cp -R ${finalAttrs.node_modules} node_modules/

    # Bun takes executables from this folder
    chmod -R u+rw node_modules
    chmod -R u+x node_modules/.bin

    patchShebangs node_modules

    # Run lifecycle scripts for ts-tiny-activerecord with patched shebangs:
    #  - ts-tiny-activerecord has a `prepare` script that compiles TypeScript into JavaScript.
    cd node_modules/ts-tiny-activerecord
    npm run prepare
    cd ../..

    export HOME=$TMPDIR
    export PATH="$PWD/node_modules/.bin:$PATH"

    runHook postConfigure
  '';

  passthru.updateScript = nix-update-script { };

  checkFlags = [