depot/third_party/nixpkgs/pkgs/applications/office/portfolio/default.nix
Default email c7f94ff3ce Project import generated by Copybara.
GitOrigin-RevId: b85ed9dcbf187b909ef7964774f8847d554fab3b
2023-08-22 22:05:09 +02:00

80 lines
2.1 KiB
Nix

{ lib
, stdenv
, autoPatchelfHook
, fetchurl
, glib-networking
, glibc
, gcc-unwrapped
, gtk3
, jre
, libsecret
, makeDesktopItem
, webkitgtk
, wrapGAppsHook
, writeScript
}:
let
desktopItem = makeDesktopItem {
name = "Portfolio";
exec = "portfolio";
icon = "portfolio";
comment = "Calculate Investment Portfolio Performance";
desktopName = "Portfolio Performance";
categories = [ "Office" ];
};
runtimeLibs = lib.makeLibraryPath [ gtk3 webkitgtk ];
in
stdenv.mkDerivation rec {
pname = "PortfolioPerformance";
version = "0.65.1";
src = fetchurl {
url = "https://github.com/buchen/portfolio/releases/download/${version}/PortfolioPerformance-${version}-linux.gtk.x86_64.tar.gz";
hash = "sha256-VfYuqrz9YDHwY0atKXYkzHJW/lXlVWGgo5QjMTMeB+g=";
};
nativeBuildInputs = [
autoPatchelfHook
wrapGAppsHook
];
buildInputs = [
gcc-unwrapped
glib-networking
glibc
libsecret
];
installPhase = ''
mkdir -p $out/portfolio
cp -av ./* $out/portfolio
makeWrapper $out/portfolio/PortfolioPerformance $out/bin/portfolio \
--prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
--prefix PATH : ${jre}/bin
# Create desktop item
mkdir -p $out/share/applications
cp ${desktopItem}/share/applications/* $out/share/applications
mkdir -p $out/share/pixmaps
ln -s $out/portfolio/icon.xpm $out/share/pixmaps/portfolio.xpm
'';
passthru.updateScript = writeScript "update.sh" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts
version="$(curl -sL "https://api.github.com/repos/buchen/portfolio/tags" | jq '.[0].name' --raw-output)"
update-source-version portfolio "$version"
'';
meta = with lib; {
description = "A simple tool to calculate the overall performance of an investment portfolio";
homepage = "https://www.portfolio-performance.info/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.epl10;
maintainers = with maintainers; [ elohmeier oyren shawn8901 ];
mainProgram = "portfolio";
platforms = [ "x86_64-linux" ];
};
}