2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, stdenvNoCC
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, wrapGAppsHook
|
|
|
|
, cargo
|
|
|
|
, rustc
|
|
|
|
, cargo-tauri
|
|
|
|
, pkg-config
|
|
|
|
, nodePackages
|
|
|
|
, esbuild
|
|
|
|
, buildGoModule
|
|
|
|
, jq
|
|
|
|
, moreutils
|
|
|
|
, libayatana-appindicator
|
|
|
|
, gtk3
|
|
|
|
, webkitgtk
|
|
|
|
, libsoup
|
|
|
|
, openssl
|
|
|
|
, xdotool
|
2024-01-02 11:29:13 +00:00
|
|
|
, cacert
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "pot";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "2.7.9";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pot-app";
|
|
|
|
repo = "pot-desktop";
|
|
|
|
rev = version;
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-Y2gFLvRNBjOGxdpIeoY1CXEip0Ht73aymWIP5wuc9kU=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
sourceRoot = "${src.name}/src-tauri";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
|
|
|
--replace "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
|
|
|
'';
|
|
|
|
|
|
|
|
pnpm-deps = stdenvNoCC.mkDerivation {
|
|
|
|
pname = "${pname}-pnpm-deps";
|
|
|
|
inherit src version;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
jq
|
|
|
|
moreutils
|
|
|
|
nodePackages.pnpm
|
2024-01-02 11:29:13 +00:00
|
|
|
cacert
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
pnpm config set store-dir $out
|
|
|
|
# use --ignore-script and --no-optional to avoid downloading binaries
|
|
|
|
# use --frozen-lockfile to avoid checking git deps
|
|
|
|
pnpm install --frozen-lockfile --no-optional --ignore-script
|
|
|
|
|
|
|
|
# Remove timestamp and sort the json files
|
|
|
|
rm -rf $out/v3/tmp
|
|
|
|
for f in $(find $out -name "*.json"); do
|
|
|
|
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
|
|
|
|
jq --sort-keys . $f | sponge $f
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontFixup = true;
|
|
|
|
outputHashMode = "recursive";
|
2024-04-21 15:54:59 +00:00
|
|
|
outputHash = "sha256-LuY5vh642DgSa91eUcA/AT+ovDcP9tZFE2dKyicCOeQ=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.importCargoLock {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
2023-10-09 19:29:22 +00:00
|
|
|
# All other crates in the same workspace reuse this hash.
|
2024-01-25 14:12:00 +00:00
|
|
|
"tauri-plugin-autostart-0.0.0" = "sha256-/uxaSBp+N1VjjSiwf6NwNnSH02Vk6gQZ/CzO+AyEI7o=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
cargo
|
|
|
|
rustc
|
|
|
|
cargo-tauri
|
|
|
|
wrapGAppsHook
|
|
|
|
nodePackages.pnpm
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
gtk3
|
|
|
|
libsoup
|
|
|
|
libayatana-appindicator
|
|
|
|
openssl
|
|
|
|
webkitgtk
|
|
|
|
xdotool
|
|
|
|
];
|
|
|
|
|
|
|
|
ESBUILD_BINARY_PATH = "${lib.getExe (esbuild.override {
|
|
|
|
buildGoModule = args: buildGoModule (args // rec {
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "0.18.20";
|
2023-07-15 17:15:38 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "evanw";
|
|
|
|
repo = "esbuild";
|
|
|
|
rev = "v${version}";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-mED3h+mY+4H465m02ewFK/BgA1i/PQ+ksUNxBlgpUoI=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
|
|
|
|
});
|
|
|
|
})}";
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
pnpm config set store-dir ${pnpm-deps}
|
2023-10-09 19:29:22 +00:00
|
|
|
chmod +w ..
|
2023-07-15 17:15:38 +00:00
|
|
|
pnpm install --offline --frozen-lockfile --no-optional --ignore-script
|
|
|
|
chmod -R +w ../node_modules
|
|
|
|
pnpm rebuild
|
|
|
|
# Use cargo-tauri from nixpkgs instead of pnpm tauri from npm
|
|
|
|
cargo tauri build -b deb
|
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
mv target/release/bundle/deb/*/data/usr/ $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A cross-platform translation software";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "pot";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://pot.pylogmon.com";
|
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ linsui ];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|