about summary refs log tree commit diff
path: root/pkgs/by-name/tr/trunk-io
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/tr/trunk-io')
-rw-r--r--pkgs/by-name/tr/trunk-io/package.nix29
-rwxr-xr-xpkgs/by-name/tr/trunk-io/update.sh7
2 files changed, 36 insertions, 0 deletions
diff --git a/pkgs/by-name/tr/trunk-io/package.nix b/pkgs/by-name/tr/trunk-io/package.nix
new file mode 100644
index 000000000000..cb02c0b393d0
--- /dev/null
+++ b/pkgs/by-name/tr/trunk-io/package.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "trunk-io";
+  version = "1.3.2";
+
+  src = fetchurl {
+    url = "https://trunk.io/releases/launcher/${finalAttrs.version}/trunk";
+    hash = "sha256-zrfnPWHFoFQkVtxPedKrL1Y1xLZSDX3JuF0qgo/hhnE=";
+  };
+
+  dontUnpack = true;
+  dontConfigure = true;
+  dontBuild = true;
+
+  installPhase = ''
+    install -D $src $out/bin/trunk
+  '';
+
+  passthru.updateScript = ./update.sh;
+
+  meta = with lib; {
+    homepage = "https://trunk.io/";
+    description = "Developer experience toolkit used to check, test, merge, and monitor code";
+    license = licenses.unfree;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ aaronjheng ];
+  };
+})
diff --git a/pkgs/by-name/tr/trunk-io/update.sh b/pkgs/by-name/tr/trunk-io/update.sh
new file mode 100755
index 000000000000..9110bb633527
--- /dev/null
+++ b/pkgs/by-name/tr/trunk-io/update.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl pcre common-updater-scripts
+
+set -eu -o pipefail
+
+version="$(curl -fsSL https://trunk.io/releases/trunk | grep -Fi 'readonly TRUNK_LAUNCHER_VERSION=' | pcregrep -o1 '"(\d+(?:\.\d+)+)"')"
+update-source-version trunk-io "$version"