about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/tr
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/by-name/tr')
-rw-r--r--nixpkgs/pkgs/by-name/tr/tradingview/package.nix91
-rw-r--r--nixpkgs/pkgs/by-name/tr/tradingview/update.sh70
-rw-r--r--nixpkgs/pkgs/by-name/tr/trealla/package.nix4
-rw-r--r--nixpkgs/pkgs/by-name/tr/trunk-ng/package.nix31
4 files changed, 194 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/by-name/tr/tradingview/package.nix b/nixpkgs/pkgs/by-name/tr/tradingview/package.nix
new file mode 100644
index 000000000000..7268b4386568
--- /dev/null
+++ b/nixpkgs/pkgs/by-name/tr/tradingview/package.nix
@@ -0,0 +1,91 @@
+{ lib
+, stdenv
+, fetchurl
+, autoPatchelfHook
+, squashfsTools
+, makeBinaryWrapper
+, alsa-lib
+, atk
+, at-spi2-atk
+, cups
+, gtk3
+, libdrm
+, libsecret
+, libxkbcommon
+, mesa
+, pango
+, sqlite
+, systemd
+, wayland
+, xorg
+}:
+
+stdenv.mkDerivation rec {
+  pname = "tradingview";
+  version = "2.6.1";
+  revision = "44";
+  src = fetchurl {
+    url = "https://api.snapcraft.io/api/v1/snaps/download/nJdITJ6ZJxdvfu8Ch7n5kH5P99ClzBYV_${revision}.snap";
+    hash = "sha512-Hd00TWjPskd0QDzpOSwQCuMw20nW4n1xxRkT1rA95pzbXtw7XFxrJdMWkzWDbucuokU2qR2b5tovAHAgw9E0tQ==";
+  };
+
+  nativeBuildInputs = [
+    autoPatchelfHook
+    makeBinaryWrapper
+    squashfsTools
+  ];
+
+  buildInputs = [
+    stdenv.cc.cc.lib
+    alsa-lib
+    atk
+    at-spi2-atk
+    cups
+    gtk3
+    libdrm
+    libsecret
+    libxkbcommon
+    mesa
+    pango
+    sqlite
+    systemd
+    wayland
+    xorg.libxcb
+    xorg.libX11
+    xorg.libXext
+  ];
+
+  unpackPhase = ''
+    runHook preUnpack
+    unsquashfs $src
+    runHook postUnpack
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out
+    cp -r squashfs-root/* $out
+
+    mkdir -p $out/share/applications
+    mv $out/meta/gui/tradingview.desktop $out/share/applications
+    substituteInPlace $out/share/applications/tradingview.desktop --replace \$\{SNAP} $out
+
+    mkdir $out/bin
+    makeBinaryWrapper $out/tradingview $out/bin/tradingview --prefix LD_LIBRARY_PATH : ${ lib.makeLibraryPath buildInputs }
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Charting platform for traders and investors";
+    homepage = "https://www.tradingview.com/desktop/";
+    changelog = "https://www.tradingview.com/support/solutions/43000673888/";
+    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
+    license = licenses.unfree;
+    maintainers = with maintainers; [ prominentretail ];
+    platforms = [ "x86_64-linux" ];
+    mainProgram = "tradingview";
+  };
+}
+
diff --git a/nixpkgs/pkgs/by-name/tr/tradingview/update.sh b/nixpkgs/pkgs/by-name/tr/tradingview/update.sh
new file mode 100644
index 000000000000..863521bfde92
--- /dev/null
+++ b/nixpkgs/pkgs/by-name/tr/tradingview/update.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env nix-shell
+#! nix-shell -i bash -p curl jq git gnused gnugrep
+
+#
+# Get latest version of TradingView from Snapcraft.
+#
+
+snap_info=($(
+  curl -s -H 'X-Ubuntu-Series: 16' \
+    'https://api.snapcraft.io/api/v1/snaps/details/tradingview' \
+  | jq --raw-output \
+    '.revision,.download_sha512,.version,.last_updated'
+))
+
+# "revision" is the actual version identifier; "version" is for human consumption.
+revision="${snap_info[0]}"
+sha512="${snap_info[1]}"
+sri=$(nix hash to-sri --type "sha512" $sha512)
+upstream_version="${snap_info[2]}"
+last_updated="${snap_info[3]}"
+
+echo "Latest release is $upstream_version from $last_updated."
+
+#
+# Read the current TradingView version.
+#
+
+nixpkgs="$(git rev-parse --show-toplevel)"
+tradingview_nix="$nixpkgs/pkgs/applications/finance/tradingview/default.nix"
+current_nix_version=$(
+  grep 'version\s*=' "$tradingview_nix" \
+  | sed -Ene 's/.*"(.*)".*/\1/p'
+)
+
+echo "Current nix version: $current_nix_version"
+
+if [[ "$current_nix_version" = "$upstream_version" ]]; then
+  echo "TradingView is already up-to-date"
+  exit 0
+fi
+
+#
+# Find and replace.
+#
+
+echo "Updating from ${current_nix_version} to ${upstream_version}, released ${last_updated}"
+
+sed --regexp-extended \
+  -e 's/revision\s*=\s*"[0-9]+"\s*;/revision = "'"${revision}"'";/' \
+  -e 's/hash\s*=\s*"[^"]*"\s*;/hash = "'"${sri}"'";/' \
+  -e 's/version\s*=\s*".*"\s*;/version = "'"${upstream_version}"'";/' \
+  -i "$tradingview_nix"
+
+#
+# Attempt a build.
+#
+
+export NIXPKGS_ALLOW_UNFREE=1
+
+if ! nix-build -A tradingview "$nixpkgs"; then
+  echo "The updated TradingView failed to build."
+  exit 1
+fi
+
+#
+# Commit changes.
+#
+git add "$tradingview_nix"
+git commit -m "tradingview: ${current_nix_version} -> ${upstream_version}"
+
diff --git a/nixpkgs/pkgs/by-name/tr/trealla/package.nix b/nixpkgs/pkgs/by-name/tr/trealla/package.nix
index 8ba9ebb7957d..1a9d5569f235 100644
--- a/nixpkgs/pkgs/by-name/tr/trealla/package.nix
+++ b/nixpkgs/pkgs/by-name/tr/trealla/package.nix
@@ -17,13 +17,13 @@
 assert lib.elem lineEditingLibrary [ "isocline" "readline" ];
 stdenv.mkDerivation (finalAttrs: {
   pname = "trealla";
-  version = "2.27.15";
+  version = "2.28.12";
 
   src = fetchFromGitHub {
     owner = "trealla-prolog";
     repo = "trealla";
     rev = "v${finalAttrs.version}";
-    hash = "sha256-b6OIp0UTBGl463wgwVCyTbC3Id0mgEIUnla+U3qv738=";
+    hash = "sha256-uWCpCjYFtK2pNeHHZWhWI6YZ+cllQpkKz//nHracl5s=";
   };
 
   postPatch = ''
diff --git a/nixpkgs/pkgs/by-name/tr/trunk-ng/package.nix b/nixpkgs/pkgs/by-name/tr/trunk-ng/package.nix
new file mode 100644
index 000000000000..0ba415d1bb96
--- /dev/null
+++ b/nixpkgs/pkgs/by-name/tr/trunk-ng/package.nix
@@ -0,0 +1,31 @@
+{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config
+, openssl, libiconv, CoreServices, Security }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "trunk-ng";
+  version = "0.17.8";
+
+  src = fetchFromGitHub {
+    owner = "ctron";
+    repo = "trunk";
+    rev = "v${version}";
+    hash = "sha256-ycZIqDBZccPapOK0ZI9Cvq94tRxChrsWX1rhyWh0S2c=";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = if stdenv.isDarwin
+    then [ libiconv CoreServices Security ]
+    else [ openssl ];
+
+  # requires network
+  checkFlags = [ "--skip=tools::tests::download_and_install_binaries" ];
+
+  cargoHash = "sha256-URHArTog34JcuxXHzTQBjQOFMffarNb51d9sUOfjm6c=";
+
+  meta = with lib; {
+    homepage = "https://github.com/ctron/trunk";
+    description = "Build, bundle & ship your Rust WASM application to the web";
+    maintainers = with maintainers; [ ctron ];
+    license = with licenses; [ asl20 ];
+  };
+}