d2: bump to latest master bump d2plugin-tala to 0.3.3 version

This commit is contained in:
Dmitriy Pleshevskiy 2023-03-16 11:13:24 +03:00
parent 360d84d045
commit 4adabd8d4f
Signed by: pleshevskiy
GPG key ID: 79C4487B44403985
3 changed files with 47 additions and 9 deletions

View file

@ -4,7 +4,7 @@
, installShellFiles , installShellFiles
}: }:
let version = "2023-02-25"; in let version = "2023-03-16"; in
buildGoModule { buildGoModule {
pname = "d2"; pname = "d2";
inherit version; inherit version;
@ -12,11 +12,11 @@ buildGoModule {
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "terrastruct"; owner = "terrastruct";
repo = "d2"; repo = "d2";
rev = "a2503328a23613609275e9c9ae981e54c1e59f32"; rev = "6d5f2c4f5fcdc4b9aa0086fe5c2a76ff9136d48d";
sha256 = "sha256-zhvKB0Prmuai26IhEYK6mqa1XdT+LJUrLNCjsnn1vsk="; sha256 = "sha256-d8+8STBnNd+LD2rk2mQKbkurbCqEthI6nVVf4ELBeuE=";
}; };
vendorSha256 = "sha256-EqIRujKMqIO8XRJ2yAfLOwcDToDM2nkURqg3Sqyjqa0="; vendorSha256 = "sha256-h2OGd/Ql4BTX0tt91lQBvmm41h2kzPgQXawJnrkxn8Y=";
ldflags = [ ldflags = [
"-s" "-s"

View file

@ -1,10 +1,8 @@
{ system, stdenv, lib, fetchurl, installShellFiles }: { system, stdenv, lib, fetchurl, installShellFiles }:
let let
platform = if stdenv.isLinux then "linux" else "darwin"; rev = "0.3.3";
arch = if lib.hasPrefix "x86_" system then "amd64" else "arm64"; fileName = "tala-v${version}-linux-amd64.tar.gz";
version = "0.3.1";
fileName = "tala-v${version}-${platform}-${arch}.tar.gz";
in in
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "d2plugin-tala"; pname = "d2plugin-tala";
@ -12,7 +10,7 @@ stdenv.mkDerivation {
src = fetchurl { src = fetchurl {
url = "https://github.com/terrastruct/TALA/releases/download/v${version}/${fileName}"; url = "https://github.com/terrastruct/TALA/releases/download/v${version}/${fileName}";
sha256 = "sha256-xYHiYLow13c3WaAq7QiD0SL9LVWKAyc8E+gWJezN3L4="; sha256 = "sha256-Qa+7X3fkyqu0kFHXFlZzO805nOgGJY4XwcJI+njp8Ro=";
}; };
nativeBuildInputs = [ installShellFiles ]; nativeBuildInputs = [ installShellFiles ];

40
pkgs/d2/update.sh Executable file
View file

@ -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 <rev>"
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