nixpkgs/pkgs/by-name/po/pot/package.nix
Jan Tojnar eb04659fc2 treewide: wrapGAppsHook → wrapGAppsHook3
This was achieved using the following command:

    sd 'wrapGAppsHook\b' wrapGAppsHook3 (rg -l 'wrapGAppsHook\b')

And then manually reverted the following changes:

- alias in top-level.nix
- function name in wrap-gapps-hook.sh
- comment in postFixup of at-spi2-core
- comment in gtk4
- comment in preFixup of 1password-gui/linux.nix
- comment in postFixup of qgis/unwrapped-ltr.nix and qgis/unwrapped.nix
- comment in postFixup of telegram-desktop
- comment in postFixup of fwupd
- buildCommand of mongodb-compass
- postFixup of xflux-gui
- comment in a patch in kdePackages.kde-gtk-config and plasma5Packages.kde-gtk-config
- description of programs.sway.wrapperFeatures.gtk NixOS option (manual rebuild)
2024-04-27 02:23:22 +02:00

139 lines
3.1 KiB
Nix

{ lib
, stdenv
, stdenvNoCC
, rustPlatform
, fetchFromGitHub
, wrapGAppsHook3
, cargo
, rustc
, cargo-tauri
, pkg-config
, nodePackages
, esbuild
, buildGoModule
, jq
, moreutils
, libayatana-appindicator
, gtk3
, webkitgtk
, libsoup
, openssl
, xdotool
, cacert
}:
stdenv.mkDerivation rec {
pname = "pot";
version = "2.7.9";
src = fetchFromGitHub {
owner = "pot-app";
repo = "pot-desktop";
rev = version;
hash = "sha256-Y2gFLvRNBjOGxdpIeoY1CXEip0Ht73aymWIP5wuc9kU=";
};
sourceRoot = "${src.name}/src-tauri";
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
cacert
];
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";
outputHash = "sha256-LuY5vh642DgSa91eUcA/AT+ovDcP9tZFE2dKyicCOeQ=";
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
outputHashes = {
# All other crates in the same workspace reuse this hash.
"tauri-plugin-autostart-0.0.0" = "sha256-/uxaSBp+N1VjjSiwf6NwNnSH02Vk6gQZ/CzO+AyEI7o=";
};
};
nativeBuildInputs = [
rustPlatform.cargoSetupHook
cargo
rustc
cargo-tauri
wrapGAppsHook3
nodePackages.pnpm
pkg-config
];
buildInputs = [
gtk3
libsoup
libayatana-appindicator
openssl
webkitgtk
xdotool
];
ESBUILD_BINARY_PATH = "${lib.getExe (esbuild.override {
buildGoModule = args: buildGoModule (args // rec {
version = "0.18.20";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-mED3h+mY+4H465m02ewFK/BgA1i/PQ+ksUNxBlgpUoI=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
});
})}";
preBuild = ''
export HOME=$(mktemp -d)
pnpm config set store-dir ${pnpm-deps}
chmod +w ..
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";
mainProgram = "pot";
homepage = "https://pot.pylogmon.com";
platforms = platforms.linux;
license = licenses.gpl3Only;
maintainers = with maintainers; [ linsui ];
};
}