gg-jj: init at 0.20.0

This commit is contained in:
wxt 2024-10-02 18:20:31 +08:00
parent d5a0693815
commit 5eb022fdb2
No known key found for this signature in database
GPG Key ID: 8281D5EE2D1825A4
2 changed files with 111 additions and 0 deletions

View File

@ -0,0 +1,80 @@
{
rustPlatform,
callPackage,
pkg-config,
lib,
fetchFromGitHub,
libayatana-appindicator,
openssl,
webkitgtk_4_1,
}:
rustPlatform.buildRustPackage rec {
pname = "gg-jj";
version = "0.20.0";
src = fetchFromGitHub {
owner = "gulbanana";
repo = "gg";
rev = "refs/tags/v${version}";
hash = "sha256-xOi/AUlH0FeenTXz3hsDYixCEl+yr22PGy6Ow4TKxY0=";
};
sourceRoot = "${src.name}/src-tauri";
webui = callPackage ./webui.nix {
inherit
src
pname
version
meta
;
};
env = {
OPENSSL_NO_VENDOR = 1;
};
buildInputs = [
webkitgtk_4_1
openssl
];
nativeBuildInputs = [
pkg-config
];
cargoHash = "sha256-u3SkRA7327ZwqEnB+Xq2JDbI0k5HfeKzV17dvQ8B6xk=";
postPatch = ''
buildRoot=$(pwd)
pushd $cargoDepsCopy/libappindicator-sys
oldHash=$(sha256sum src/lib.rs | cut -d " " -f 1)
substituteInPlace src/lib.rs \
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
substituteInPlace .cargo-checksum.json \
--replace-fail $oldHash $(sha256sum src/lib.rs | cut -d " " -f 1)
popd
pushd $cargoDepsCopy/jj-cli
oldHash=$(sha256sum build.rs | cut -d " " -f 1)
substituteInPlace build.rs \
--replace-fail 'let path = std::env::var("CARGO_MANIFEST_DIR").unwrap();' "let path = \"$buildRoot\";"
substituteInPlace .cargo-checksum.json \
--replace-fail $oldHash $(sha256sum build.rs | cut -d " " -f 1)
popd
substituteInPlace ./tauri.conf.json \
--replace-fail '"frontendDist": "../dist"' '"frontendDist": "${webui}"' \
--replace-fail '"beforeBuildCommand": "npm run build"' '"beforeBuildCommand": ""'
'';
meta = {
homepage = "https://github.com/gulbanana/gg";
changelog = "https://github.com/gulbanana/gg/releases/tag/v${version}";
description = "GUI for jj users";
maintainers = with lib.maintainers; [ bot-wxt1221 ];
mainProgram = "gg";
license = lib.licenses.apsl20;
};
}

View File

@ -0,0 +1,31 @@
{
version,
src,
pname,
pnpm,
meta,
buildNpmPackage,
}:
buildNpmPackage {
inherit version src meta;
pname = "${pname}-webui";
npmDepsHash = "sha256-oHBFuX65D/FgnGa03jjpIKAdH8Q4c2NrpD64bhfe720=";
buildPhase = ''
runHook preBuild
node --max_old_space_size=1024000 ./node_modules/vite/bin/vite.js build
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r dist $out
runHook postInstall
'';
}