From 94683e2876ebcec3b5d75d6d1afb8fbf8784f310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Fri, 19 Jul 2024 18:38:31 +0200 Subject: [PATCH] Add pob update script --- packages/pob.nix | 2 +- scripts/update-pob.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 scripts/update-pob.sh diff --git a/packages/pob.nix b/packages/pob.nix index 1871f5c..0a71786 100644 --- a/packages/pob.nix +++ b/packages/pob.nix @@ -19,7 +19,7 @@ let src = fetchFromGitHub { owner = "PathOfBuildingCommunity"; repo = "PathOfBuilding"; - rev = "acd1fb5abbdd571345e1dd960e72b9be12a555a8"; + rev = "520e4aea9583ce33bf2c1494fc1b5dc128696797"; hash = "sha256-E7UgJpsC0YnqG2KbZYxbYRDPoZ2+NfyYCn4fK+QN5WM="; }; diff --git a/scripts/update-pob.sh b/scripts/update-pob.sh new file mode 100755 index 0000000..a11e363 --- /dev/null +++ b/scripts/update-pob.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -eo pipefail + +# TODO: Update pobfrontend as well? + +if [ -z "$1" ]; then + nurl_output=$(nurl -j https://github.com/PathOfBuildingCommunity/PathOfBuilding 2>/dev/null) + rev=$(jq '.args.rev' <<< "$nurl_output") +else + nurl_output=$(nurl -j https://github.com/PathOfBuildingCommunity/PathOfBuilding "$1" 2>/dev/null) +fi + +hash=$(jq '.args.hash' <<< "$nurl_output") +echo "Updating pob to $rev" + +# Find lines to replace +line_numbers=$(grep -Fn "rev =" packages/pob.nix| cut -d":" -f1) +line_data=$(head -n1 <<< "$line_numbers") + +sed -i "${line_data}s/.*/ rev = $rev;/" packages/pob.nix +nixfmt packages/pob.nix