refactor(nix): rely on cargo-tauri.hook standard phases (#1335)
Some checks failed
Main Branch Build / build (, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Main Branch Build / build (--bundles appimage,deb,rpm, ubuntu-24.04-arm, aarch64-unknown-linux-gnu) (push) Has been cancelled
Main Branch Build / build (--bundles appimage,rpm, ubuntu-24.04, x86_64-unknown-linux-gnu) (push) Has been cancelled
Main Branch Build / build (--bundles deb, ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Has been cancelled
Main Branch Build / build (--target aarch64-apple-darwin, macos-26, aarch64-apple-darwin) (push) Has been cancelled
Main Branch Build / build (--target aarch64-pc-windows-msvc, windows-11-arm, aarch64-pc-windows-msvc) (push) Has been cancelled
Main Branch Build / build (--target x86_64-apple-darwin, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
nix build check / nix-build (push) Has been cancelled
Some checks failed
Main Branch Build / build (, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Main Branch Build / build (--bundles appimage,deb,rpm, ubuntu-24.04-arm, aarch64-unknown-linux-gnu) (push) Has been cancelled
Main Branch Build / build (--bundles appimage,rpm, ubuntu-24.04, x86_64-unknown-linux-gnu) (push) Has been cancelled
Main Branch Build / build (--bundles deb, ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Has been cancelled
Main Branch Build / build (--target aarch64-apple-darwin, macos-26, aarch64-apple-darwin) (push) Has been cancelled
Main Branch Build / build (--target aarch64-pc-windows-msvc, windows-11-arm, aarch64-pc-windows-msvc) (push) Has been cancelled
Main Branch Build / build (--target x86_64-apple-darwin, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
nix build check / nix-build (push) Has been cancelled
Set buildAndTestSubdir + tauriBundleType so cargo-tauri.hook handles build/install correctly, and drop the manual overrides: - installPhase override (was needed because hook didn't know to pushd into src-tauri without buildAndTestSubdir; hook's install script now finds bundle/deb/.../data/usr/* on its own) - preBuild with `bun run build` (hook runs beforeBuildCommand from tauri.conf.json itself; bun2nix.hook has node_modules ready before buildPhase) - jq del(.build.beforeBuildCommand) in postPatch (no longer needed) Net change: +3/-18. End-to-end verified on NixOS x86_64-linux: GigaAM v3 ASR + Whisper large-v3-turbo on Vulkan both work.
This commit is contained in:
parent
085cd530a3
commit
a385371c32
1 changed files with 3 additions and 18 deletions
21
flake.nix
21
flake.nix
|
|
@ -92,6 +92,8 @@
|
||||||
src = self;
|
src = self;
|
||||||
|
|
||||||
cargoRoot = "src-tauri";
|
cargoRoot = "src-tauri";
|
||||||
|
buildAndTestSubdir = "src-tauri";
|
||||||
|
tauriBundleType = "deb";
|
||||||
|
|
||||||
cargoLock = {
|
cargoLock = {
|
||||||
lockFile = ./src-tauri/Cargo.lock;
|
lockFile = ./src-tauri/Cargo.lock;
|
||||||
|
|
@ -103,7 +105,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
${pkgs.jq}/bin/jq 'del(.build.beforeBuildCommand) | .bundle.createUpdaterArtifacts = false' \
|
${pkgs.jq}/bin/jq '.bundle.createUpdaterArtifacts = false' \
|
||||||
src-tauri/tauri.conf.json > $TMPDIR/tauri.conf.json
|
src-tauri/tauri.conf.json > $TMPDIR/tauri.conf.json
|
||||||
cp $TMPDIR/tauri.conf.json src-tauri/tauri.conf.json
|
cp $TMPDIR/tauri.conf.json src-tauri/tauri.conf.json
|
||||||
|
|
||||||
|
|
@ -150,27 +152,10 @@
|
||||||
shaderc
|
shaderc
|
||||||
];
|
];
|
||||||
|
|
||||||
preBuild = ''
|
|
||||||
# bun2nix.hook has already set up node_modules from pre-fetched cache.
|
|
||||||
# Build the frontend with bun (tsc + vite).
|
|
||||||
export HOME=$TMPDIR
|
|
||||||
bun run build
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Tests require runtime resources (audio devices, model files, GPU/Vulkan)
|
# Tests require runtime resources (audio devices, model files, GPU/Vulkan)
|
||||||
# not available in the Nix build sandbox
|
# not available in the Nix build sandbox
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
# The tauri hook's installPhase expects target/ in cwd, but our
|
|
||||||
# cargoRoot puts it under src-tauri/. Override to extract the DEB.
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
mkdir -p $out
|
|
||||||
cd src-tauri
|
|
||||||
mv target/${pkgs.stdenv.hostPlatform.rust.rustcTarget}/release/bundle/deb/*/data/usr/* $out/
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildInputs = commonNativeDeps pkgs ++ (with pkgs; [
|
buildInputs = commonNativeDeps pkgs ++ (with pkgs; [
|
||||||
glib-networking
|
glib-networking
|
||||||
libx11
|
libx11
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue