about summary refs log tree commit diff
path: root/pkgs/by-name/po/portfolio/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/po/portfolio/package.nix')
-rw-r--r--pkgs/by-name/po/portfolio/package.nix83
1 files changed, 83 insertions, 0 deletions
diff --git a/pkgs/by-name/po/portfolio/package.nix b/pkgs/by-name/po/portfolio/package.nix
new file mode 100644
index 0000000000000..1bc1d68a2970e
--- /dev/null
+++ b/pkgs/by-name/po/portfolio/package.nix
@@ -0,0 +1,83 @@
+{
+  lib,
+  stdenv,
+  autoPatchelfHook,
+  fetchurl,
+  glib-networking,
+  glibc,
+  gcc-unwrapped,
+  gtk3,
+  openjdk17,
+  libsecret,
+  makeDesktopItem,
+  webkitgtk,
+  wrapGAppsHook3,
+  gitUpdater,
+}:
+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.69.1";
+
+  src = fetchurl {
+    url = "https://github.com/buchen/portfolio/releases/download/${version}/PortfolioPerformance-${version}-linux.gtk.x86_64.tar.gz";
+    hash = "sha256-Q36pQkxFMwwb6qHZYqer/em6G4TlFmFwtFhB0YUsOlw=";
+  };
+
+  nativeBuildInputs = [
+    autoPatchelfHook
+    wrapGAppsHook3
+  ];
+
+  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 : ${openjdk17}/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 = gitUpdater { url = "https://github.com/buchen/portfolio.git"; };
+
+  meta = with lib; {
+    description = "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; [
+      kilianar
+      oyren
+      shawn8901
+    ];
+    mainProgram = "portfolio";
+    platforms = [ "x86_64-linux" ];
+  };
+}