nixpkgs/pkgs/by-name/zo/zotero/linux.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

119 lines
2.6 KiB
Nix

{
pname,
version,
meta,
lib,
stdenv,
fetchurl,
wrapGAppsHook3,
makeDesktopItem,
alsa-lib,
atk,
cairo,
dbus-glib,
gdk-pixbuf,
glib,
gtk3,
libGL,
libva,
xorg,
mesa,
pango,
pciutils,
}:
stdenv.mkDerivation rec {
inherit pname version meta;
src = fetchurl {
url = "https://download.zotero.org/client/release/${version}/Zotero-${version}_linux-x86_64.tar.bz2";
hash = "sha256-utiqS4/PvlkQesqTOyEvj8uwW1sDxlqjnhv6GFfY5uk=";
};
dontPatchELF = true;
nativeBuildInputs = [ wrapGAppsHook3 ];
libPath =
lib.makeLibraryPath [
alsa-lib
atk
cairo
dbus-glib
gdk-pixbuf
glib
gtk3
libGL
libva
xorg.libX11
xorg.libXcomposite
xorg.libXcursor
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXi
xorg.libXrandr
xorg.libXtst
xorg.libxcb
mesa
pango
pciutils
]
+ ":"
+ lib.makeSearchPathOutput "lib" "lib64" [ stdenv.cc.cc ];
desktopItem = makeDesktopItem {
name = "zotero";
exec = "zotero -url %U";
icon = "zotero";
comment = meta.description;
desktopName = "Zotero";
genericName = "Reference Management";
categories = [
"Office"
"Database"
];
startupNotify = true;
mimeTypes = [
"x-scheme-handler/zotero"
"text/plain"
];
};
installPhase = ''
runHook preInstall
# Copy package contents to the output directory
mkdir -p "$prefix/usr/lib/zotero-bin-${version}"
cp -r * "$prefix/usr/lib/zotero-bin-${version}"
mkdir -p "$out/bin"
ln -s "$prefix/usr/lib/zotero-bin-${version}/zotero" "$out/bin/"
# Install desktop file and icons
mkdir -p $out/share/applications
cp ${desktopItem}/share/applications/* $out/share/applications/
for size in 32 64 128; do
install -Dm444 icons/icon''${size}.png \
$out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png
done
install -Dm444 icons/symbolic.svg \
$out/share/icons/hicolor/symbolic/apps/zotero-symbolic.svg
runHook postInstall
'';
postFixup = ''
for executable in \
zotero-bin plugin-container updater vaapitest \
minidump-analyzer glxtest
do
if [ -e "$out/usr/lib/zotero-bin-${version}/$executable" ]; then
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
"$out/usr/lib/zotero-bin-${version}/$executable"
fi
done
find . -executable -type f -exec \
patchelf --set-rpath "$libPath" \
"$out/usr/lib/zotero-bin-${version}/{}" \;
'';
}