overlayed: combine webui into main derivation, use cargo-tauri.hook (#407188)
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
{
|
||||
rustPlatform,
|
||||
lib,
|
||||
callPackage,
|
||||
pkg-config,
|
||||
openssl,
|
||||
libsoup_3,
|
||||
webkitgtk_4_1,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
|
||||
cargo-tauri,
|
||||
jq,
|
||||
moreutils,
|
||||
nodejs,
|
||||
pkg-config,
|
||||
pnpm_9,
|
||||
|
||||
libayatana-appindicator,
|
||||
nix-update-script,
|
||||
libsoup_3,
|
||||
openssl,
|
||||
webkitgtk_4_1,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
@@ -22,23 +27,31 @@ rustPlatform.buildRustPackage rec {
|
||||
hash = "sha256-3GFg8czBf1csojXUNC51xFXJnGuXltP6D46fCt6q24I=";
|
||||
};
|
||||
|
||||
sourceRoot = "${src.name}/apps/desktop/src-tauri";
|
||||
cargoRoot = "apps/desktop/src-tauri";
|
||||
buildAndTestSubdir = "apps/desktop/src-tauri";
|
||||
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-6wN4nZQWrY0J5E+auj17B3iJ/84hzBXYA/bJsX/N5pk=";
|
||||
|
||||
webui = callPackage ./webui.nix {
|
||||
inherit meta src version;
|
||||
pnpmDeps = pnpm_9.fetchDeps {
|
||||
inherit pname version src;
|
||||
hash = "sha256-+yyxoodcDfqJ2pkosd6sMk77/71RDsGthedo1Oigwto=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cargo-tauri.hook
|
||||
jq
|
||||
moreutils
|
||||
nodejs
|
||||
pkg-config
|
||||
pnpm_9.configHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libayatana-appindicator
|
||||
libsoup_3
|
||||
openssl
|
||||
webkitgtk_4_1
|
||||
libsoup_3
|
||||
];
|
||||
|
||||
env = {
|
||||
@@ -48,9 +61,10 @@ rustPlatform.buildRustPackage rec {
|
||||
postPatch = ''
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
substituteInPlace ./tauri.conf.json \
|
||||
--replace-fail '../dist' '${webui}' \
|
||||
--replace-fail 'pnpm build' ' '
|
||||
|
||||
# disable updater
|
||||
jq '.plugins.updater.endpoints = [ ] | .bundle.createUpdaterArtifacts = false' \
|
||||
apps/desktop/src-tauri/tauri.conf.json | sponge apps/desktop/src-tauri/tauri.conf.json
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
src,
|
||||
meta,
|
||||
version,
|
||||
stdenv,
|
||||
nodejs,
|
||||
pnpm_9,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
inherit version src meta;
|
||||
pname = "overlayed-webui";
|
||||
|
||||
pnpmDeps = pnpm_9.fetchDeps {
|
||||
inherit (finalAttrs) src pname version;
|
||||
hash = "sha256-+yyxoodcDfqJ2pkosd6sMk77/71RDsGthedo1Oigwto=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
pnpm_9.configHook
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
cd apps/desktop
|
||||
node --max_old_space_size=1024000 ./node_modules/vite/bin/vite.js build
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp -r dist $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
})
|
||||
Reference in New Issue
Block a user