tetrio-plus: split tpsecore into seperate package

main purpose of this is to allow tpsecore to be built by hydra
adding tetrio-plus to top level packages didn't cause it to be built,
since tetrio-plus is marked unfree

also includes a minor version bump for tetrio-plus/tpsecore itself
this update for tpsecore fixes #352897 as it includes a version bump for
wasm-bindgen, allowing us to also increase wasm-bindgen-cli version
This commit is contained in:
huantian 2024-11-03 18:18:51 -08:00
parent c29a8c6aa5
commit ff546ee4f3
No known key found for this signature in database
GPG Key ID: 4A0318E04E555DE5
2 changed files with 71 additions and 56 deletions

View File

@ -2,74 +2,25 @@
lib,
stdenv,
fetchFromGitLab,
rustPlatform,
rustc,
wasm-pack,
wasm-bindgen-cli,
binaryen,
fetchYarnDeps,
yarn,
fixup-yarn-lock,
nodejs,
asar,
tpsecore,
tetrio-desktop,
}:
let
version = "0.27.4";
version = "0.27.5";
rev = "electron-v${version}-tetrio-v${tetrio-desktop.version}";
src = fetchFromGitLab {
owner = "UniQMG";
repo = "tetrio-plus";
inherit rev;
hash = "sha256-HwGFg8dxqtqghdP+PXWXr6Fi5vfgopThs+QNa3N1awk=";
fetchSubmodules = true;
};
wasm-bindgen-82 = wasm-bindgen-cli.override {
version = "0.2.82";
hash = "sha256-BQ8v3rCLUvyCCdxo5U+NHh30l9Jwvk9Sz8YQv6fa0SU=";
cargoHash = "sha256-mP85+qi2KA0GieaBzbrQOBqYxBZNRJipvd2brCRGyOM=";
};
tpsecore = rustPlatform.buildRustPackage {
pname = "tpsecore";
inherit version src;
sourceRoot = "${src.name}/tpsecore";
cargoHash = "sha256-zqeoPeGZvSz7W3c7MXnvvq73hvavg1RGzPc3iTqAjBo=";
nativeBuildInputs = [
wasm-pack
wasm-bindgen-82
binaryen
rustc.llvmPackages.lld
];
buildPhase = ''
HOME=$(mktemp -d) wasm-pack build --target web --release
'';
installPhase = ''
cp -r pkg/ $out
'';
doCheck = false;
meta = {
description = "Self contained toolkit for creating, editing, and previewing TPSE files";
homepage = "https://gitlab.com/UniQMG/tpsecore";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
huantian
wackbyte
];
platforms = lib.platforms.linux;
};
hash = "sha256-hbHofrC2dJOh2kh3VLb/d0dHrcszyqTyID1PAaGApxY=";
};
offlineCache = fetchYarnDeps {
@ -119,16 +70,12 @@ stdenv.mkDerivation (finalAttrs: {
# Actually install tetrio-plus where the above patch script expects
cp -r $src out/tetrioplus
chmod -R u+w out/tetrioplus
# Install tpsecore
cp ${tpsecore}/{tpsecore_bg.wasm,tpsecore.js} out/tetrioplus/source/lib/
# Remove uneeded tpsecore source code
rm -rf out/tetrioplus/tpsecore/
# Disable useless uninstall button in the tetrio-plus popup
substituteInPlace out/tetrioplus/desktop-manifest.js \
--replace-fail '"show_uninstaller_button": true' '"show_uninstaller_button": false'
# Display 'nixpkgs' next to version in tetrio-plus popup
echo "nixpkgs" > out/tetrioplus/resources/override-commit

View File

@ -0,0 +1,68 @@
{
lib,
fetchFromGitLab,
rustPlatform,
rustc,
wasm-pack,
wasm-bindgen-cli,
binaryen,
}:
let
version = "0.1.1";
wasm-bindgen-cli-95 = wasm-bindgen-cli.override {
version = "0.2.95";
hash = "sha256-prMIreQeAcbJ8/g3+pMp1Wp9H5u+xLqxRxL+34hICss=";
cargoHash = "sha256-6iMebkD7FQvixlmghGGIvpdGwFNLfnUcFke/Rg8nPK4=";
};
in
rustPlatform.buildRustPackage {
pname = "tpsecore";
inherit version;
src = fetchFromGitLab {
owner = "UniQMG";
repo = "tpsecore";
rev = "v${version}";
hash = "sha256-+OynnLMBEiYwdFzxGzgkcBN6xrHoH1Q6O5i+OW7RBLo=";
};
cargoHash = "sha256-mPaWXiDjJd/uTBpktauKWg8X9sNBb3FXw5BSGB33NxI=";
nativeBuildInputs = [
wasm-pack
wasm-bindgen-cli-95
binaryen
rustc.llvmPackages.lld
];
buildPhase = ''
runHook preBuild
HOME=$(mktemp -d) wasm-pack build --target web --release
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r pkg/ $out
runHook postInstall
'';
doCheck = false;
meta = {
description = "Self contained toolkit for creating, editing, and previewing TPSE files";
homepage = "https://gitlab.com/UniQMG/tpsecore";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
huantian
wackbyte
];
platforms = lib.platforms.linux;
};
}