mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
122 lines
2.5 KiB
Nix
122 lines
2.5 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
rustPlatform,
|
|
fetchFromGitHub,
|
|
nodejs,
|
|
pnpm_9,
|
|
wrapGAppsHook3,
|
|
cargo,
|
|
rustc,
|
|
cargo-tauri,
|
|
pkg-config,
|
|
esbuild,
|
|
buildGoModule,
|
|
libayatana-appindicator,
|
|
gtk3,
|
|
webkitgtk,
|
|
libsoup,
|
|
openssl,
|
|
xdotool,
|
|
}:
|
|
|
|
let
|
|
pnpm = pnpm_9;
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "pot";
|
|
version = "3.0.5";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "pot-app";
|
|
repo = "pot-desktop";
|
|
rev = finalAttrs.version;
|
|
hash = "sha256-Y0/N5xunEXOG+FuZE23xsSwFd6PL1XClV5UIckTYNPs=";
|
|
};
|
|
|
|
sourceRoot = "${finalAttrs.src.name}/src-tauri";
|
|
|
|
postPatch = ''
|
|
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
|
--replace "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
|
'';
|
|
|
|
pnpmDeps = pnpm.fetchDeps {
|
|
inherit (finalAttrs) pname version src;
|
|
hash = "sha256-AmMV8Nrn+zH/9bDkFX3Mx5xIQjkoXR8SzkdJRXkxTbA=";
|
|
};
|
|
|
|
pnpmRoot = "..";
|
|
|
|
cargoDeps = rustPlatform.importCargoLock {
|
|
lockFile = ./Cargo.lock;
|
|
outputHashes = {
|
|
# All other crates in the same workspace reuse this hash.
|
|
"tauri-plugin-autostart-0.0.0" = "sha256-fgJvoe3rKom2DdXXgd5rx7kzaWL/uvvye8jfL2SNhrM=";
|
|
};
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
rustPlatform.cargoSetupHook
|
|
cargo
|
|
rustc
|
|
cargo-tauri
|
|
nodejs
|
|
pnpm.configHook
|
|
wrapGAppsHook3
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = [
|
|
gtk3
|
|
libsoup
|
|
libayatana-appindicator
|
|
openssl
|
|
webkitgtk
|
|
xdotool
|
|
];
|
|
|
|
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=";
|
|
};
|
|
}
|
|
);
|
|
}
|
|
)}";
|
|
|
|
preConfigure = ''
|
|
# pnpm.configHook has to write to .., as our sourceRoot is set to src-tauri
|
|
# TODO: move frontend into its own drv
|
|
chmod +w ..
|
|
'';
|
|
|
|
preBuild = ''
|
|
# 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 = "Cross-platform translation software";
|
|
mainProgram = "pot";
|
|
homepage = "https://pot.pylogmon.com";
|
|
platforms = platforms.linux;
|
|
license = licenses.gpl3Only;
|
|
maintainers = with maintainers; [ linsui ];
|
|
};
|
|
})
|