2024-09-19 14:19:46 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
rustPlatform,
|
|
|
|
fetchFromGitHub,
|
|
|
|
nodejs,
|
|
|
|
pnpm_9,
|
|
|
|
wrapGAppsHook3,
|
|
|
|
cargo,
|
|
|
|
rustc,
|
|
|
|
cargo-tauri,
|
|
|
|
pkg-config,
|
|
|
|
esbuild,
|
|
|
|
buildGoModule,
|
|
|
|
libayatana-appindicator,
|
|
|
|
gtk3,
|
|
|
|
webkitgtk,
|
|
|
|
libsoup,
|
|
|
|
openssl,
|
|
|
|
xdotool,
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
let
|
|
|
|
pnpm = pnpm_9;
|
|
|
|
in
|
2024-06-20 14:57:18 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2023-07-15 17:15:38 +00:00
|
|
|
pname = "pot";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "3.0.5";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pot-app";
|
|
|
|
repo = "pot-desktop";
|
2024-06-20 14:57:18 +00:00
|
|
|
rev = finalAttrs.version;
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-Y0/N5xunEXOG+FuZE23xsSwFd6PL1XClV5UIckTYNPs=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
sourceRoot = "${finalAttrs.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"
|
|
|
|
'';
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
pnpmDeps = pnpm.fetchDeps {
|
|
|
|
inherit (finalAttrs) pname version src;
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-AmMV8Nrn+zH/9bDkFX3Mx5xIQjkoXR8SzkdJRXkxTbA=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
pnpmRoot = "..";
|
|
|
|
|
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-09-19 14:19:46 +00:00
|
|
|
"tauri-plugin-autostart-0.0.0" = "sha256-fgJvoe3rKom2DdXXgd5rx7kzaWL/uvvye8jfL2SNhrM=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
cargo
|
|
|
|
rustc
|
2024-10-04 16:56:33 +00:00
|
|
|
cargo-tauri.hook
|
2024-06-20 14:57:18 +00:00
|
|
|
nodejs
|
|
|
|
pnpm.configHook
|
2024-05-15 15:35:15 +00:00
|
|
|
wrapGAppsHook3
|
2023-07-15 17:15:38 +00:00
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
gtk3
|
|
|
|
libsoup
|
|
|
|
libayatana-appindicator
|
|
|
|
openssl
|
|
|
|
webkitgtk
|
|
|
|
xdotool
|
|
|
|
];
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
env.ESBUILD_BINARY_PATH = "${lib.getExe (
|
|
|
|
esbuild.override {
|
|
|
|
buildGoModule =
|
|
|
|
args:
|
|
|
|
buildGoModule (
|
|
|
|
args
|
|
|
|
// rec {
|
|
|
|
version = "0.21.5";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "evanw";
|
|
|
|
repo = "esbuild";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-FpvXWIlt67G8w3pBKZo/mcp57LunxDmRUaCU/Ne89B8=";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
)}";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
preConfigure = ''
|
|
|
|
# pnpm.configHook has to write to .., as our sourceRoot is set to src-tauri
|
|
|
|
# TODO: move frontend into its own drv
|
2023-10-09 19:29:22 +00:00
|
|
|
chmod +w ..
|
2024-06-20 14:57:18 +00:00
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "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 ];
|
|
|
|
};
|
2024-06-20 14:57:18 +00:00
|
|
|
})
|