From 4adabd8d4f11bbb78cdf755e7ea0ca117c463ec3 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Thu, 16 Mar 2023 11:13:24 +0300 Subject: [PATCH] d2: bump to latest master bump d2plugin-tala to 0.3.3 version --- pkgs/d2/d2-unwrapped.nix | 8 ++++---- pkgs/d2/d2plugin-tala.nix | 8 +++----- pkgs/d2/update.sh | 40 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 9 deletions(-) create mode 100755 pkgs/d2/update.sh diff --git a/pkgs/d2/d2-unwrapped.nix b/pkgs/d2/d2-unwrapped.nix index 7bf975c..c4f1290 100644 --- a/pkgs/d2/d2-unwrapped.nix +++ b/pkgs/d2/d2-unwrapped.nix @@ -4,7 +4,7 @@ , installShellFiles }: -let version = "2023-02-25"; in +let version = "2023-03-16"; in buildGoModule { pname = "d2"; inherit version; @@ -12,11 +12,11 @@ buildGoModule { src = fetchFromGitHub { owner = "terrastruct"; repo = "d2"; - rev = "a2503328a23613609275e9c9ae981e54c1e59f32"; - sha256 = "sha256-zhvKB0Prmuai26IhEYK6mqa1XdT+LJUrLNCjsnn1vsk="; + rev = "6d5f2c4f5fcdc4b9aa0086fe5c2a76ff9136d48d"; + sha256 = "sha256-d8+8STBnNd+LD2rk2mQKbkurbCqEthI6nVVf4ELBeuE="; }; - vendorSha256 = "sha256-EqIRujKMqIO8XRJ2yAfLOwcDToDM2nkURqg3Sqyjqa0="; + vendorSha256 = "sha256-h2OGd/Ql4BTX0tt91lQBvmm41h2kzPgQXawJnrkxn8Y="; ldflags = [ "-s" diff --git a/pkgs/d2/d2plugin-tala.nix b/pkgs/d2/d2plugin-tala.nix index 32c7820..ae744fd 100644 --- a/pkgs/d2/d2plugin-tala.nix +++ b/pkgs/d2/d2plugin-tala.nix @@ -1,10 +1,8 @@ { system, stdenv, lib, fetchurl, installShellFiles }: let - platform = if stdenv.isLinux then "linux" else "darwin"; - arch = if lib.hasPrefix "x86_" system then "amd64" else "arm64"; - version = "0.3.1"; - fileName = "tala-v${version}-${platform}-${arch}.tar.gz"; + rev = "0.3.3"; + fileName = "tala-v${version}-linux-amd64.tar.gz"; in stdenv.mkDerivation { pname = "d2plugin-tala"; @@ -12,7 +10,7 @@ stdenv.mkDerivation { src = fetchurl { url = "https://github.com/terrastruct/TALA/releases/download/v${version}/${fileName}"; - sha256 = "sha256-xYHiYLow13c3WaAq7QiD0SL9LVWKAyc8E+gWJezN3L4="; + sha256 = "sha256-Qa+7X3fkyqu0kFHXFlZzO805nOgGJY4XwcJI+njp8Ro="; }; nativeBuildInputs = [ installShellFiles ]; diff --git a/pkgs/d2/update.sh b/pkgs/d2/update.sh new file mode 100755 index 0000000..20eb925 --- /dev/null +++ b/pkgs/d2/update.sh @@ -0,0 +1,40 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p nix-prefetch-github gnused jq wget + +function help() { + echo "Regenerates packaging data for the d2 packages." + echo "Usage: $0 " + exit 1 +} + +if [[ $# -gt 1 || $1 == -* ]]; then + help +fi + +set -x + +cd "$(dirname "$0")" +d2_version="$1" + +set -euo pipefail + +if [ -z "$d2_version" ]; then + help +fi + +tala_version="$(wget -O- "https://api.github.com/repos/terrastruct/TALA/releases?per_page=1" | jq -r '.[0].tag_name')" + +d2_hash=$(nix-prefetch-github terrastruct d2 --rev "${d2_version}" | jq -r .sha256) +d2_hash=$(nix hash to-sri --type sha256 "${d2_hash}") + +tala_hash=$(nix-prefetch-url "https://github.com/terrastruct/TALA/releases/download/${tala_version}/tala-${tala_version}-linux-amd64.tar.gz") +tala_hash=$(nix hash to-sri --type sha256 "${tala_hash}") + +sed -i -E -e "s#rev = \".*\"#rev = \"${d2_version}\"#" d2-unwrapped.nix +sed -i -E -e "s#sha256 = \".*\"#sha256 = \"${d2_hash}\"#" d2-unwrapped.nix +sed -i -E -e "s#version = \".*\"#version = \"$(date +%Y-%m-%d)\"#" d2-unwrapped.nix + +sed -i -E -e "s#version = \".*\"#rev = \"${tala_version#v}\"#" d2plugin-tala.nix +sed -i -E -e "s#sha256 = \".*\"#sha256 = \"${tala_hash}\"#" d2plugin-tala.nix + +