Skip to content

Commit

Permalink
insulator2: use cargo-tauri.hook & yarnConfigHook
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo committed Sep 12, 2024
1 parent 4dc8ac1 commit d90ecf8
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions pkgs/applications/misc/insulator2/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{ lib
, cmake
, dbus
, fetchFromGitHub
, fetchYarnDeps
Expand All @@ -13,12 +12,14 @@
, cyrus_sasl
, stdenv
, fixup_yarn_lock
, yarn
, yarnConfigHook
, nodejs-slim
, cargo-tauri
, cargo
, rustPlatform
, rustc
, jq
, moreutils
}:

stdenv.mkDerivation rec {
Expand All @@ -32,6 +33,11 @@ stdenv.mkDerivation rec {
hash = "sha256-Bi9GCQr7yox5Plc7o0svRKYi1XoK/HDGj1VbW1z4jac=";
};

# Yarn *really* wants us to use corepack if this is set
postPatch = ''
jq 'del(.packageManager)' package.json | sponge package.json
'';

yarnOfflineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
hash = "sha256-ih5NSOvYje981SkVfPHm/u2sS1B36kgxpfe9LmQaxdo=";
Expand All @@ -47,37 +53,22 @@ stdenv.mkDerivation rec {
};
};

configurePhase = ''
export HOME=$(mktemp -d)
yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
fixup_yarn_lock yarn.lock
yarn install --offline --frozen-lockfile --ignore-scripts --no-progress --non-interactive
patchShebangs node_modules/
yarn run postinstall --offline
'';

preBuild = ''
yarn tauri build -b deb
'';

cargoRoot = "backend/";

preInstall = ''
mv backend/target/release/bundle/deb/*/data/usr/ "$out"
'';
buildAndTestDir = cargoRoot;

nativeBuildInputs = [
cmake
pkg-config
perl
rustPlatform.cargoSetupHook
cargo
rustc
cargo-tauri
cargo-tauri.hook
fixup_yarn_lock
yarn
yarnConfigHook
nodejs-slim
cyrus_sasl
jq
moreutils # for sponge
];

buildInputs = [
Expand Down

0 comments on commit d90ecf8

Please sign in to comment.