tandoor-recipes, tandoor-recipes.frontend: adapt update script to new nix-prefetch-github

We also take the opportunity also to migrate from "sha256" and
"yarnSha256" attributes to "hash" and "yarnHash" attributes.
This commit is contained in:
Theodore Ni 2023-07-07 23:02:18 -07:00
parent fab2d4d0b4
commit aab2097d2d
No known key found for this signature in database
GPG Key ID: 48B67583BDDD4474
3 changed files with 6 additions and 7 deletions

View File

@ -6,10 +6,10 @@ rec {
owner = "TandoorRecipes";
repo = "recipes";
rev = version;
sha256 = "sha256-cVrgmRDzuLzl2+4UcrLRdrP6ZFWMkavu9OEogNas2fA=";
hash = "sha256-cVrgmRDzuLzl2+4UcrLRdrP6ZFWMkavu9OEogNas2fA=";
};
yarnSha256 = "sha256-0u9P/OsoThP8gonrzcnO5zhIboWMI1mTsXHlbt7l9oE=";
yarnHash = "sha256-0u9P/OsoThP8gonrzcnO5zhIboWMI1mTsXHlbt7l9oE=";
meta = with lib; {
homepage = "https://tandoor.dev/";

View File

@ -10,7 +10,7 @@ stdenv.mkDerivation {
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${common.src}/vue/yarn.lock";
sha256 = common.yarnSha256;
hash = common.yarnHash;
};
nativeBuildInputs = [

View File

@ -23,7 +23,7 @@ fi
package_src="https://raw.githubusercontent.com/TandoorRecipes/recipes/$version"
src_hash=$(nix-prefetch-github TandoorRecipes recipes --rev "${version}" | jq -r .sha256)
src_hash=$(nix-prefetch-github TandoorRecipes recipes --rev "${version}" | jq -r .hash)
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
@ -34,9 +34,8 @@ yarn_hash=$(prefetch-yarn-deps yarn.lock)
popd
# Use friendlier hashes
src_hash=$(nix hash to-sri --type sha256 "$src_hash")
yarn_hash=$(nix hash to-sri --type sha256 "$yarn_hash")
sed -i -E -e "s#version = \".*\"#version = \"$version\"#" common.nix
sed -i -E -e "s#sha256 = \".*\"#sha256 = \"$src_hash\"#" common.nix
sed -i -E -e "s#yarnSha256 = \".*\"#yarnSha256 = \"$yarn_hash\"#" common.nix
sed -i -E -e "s#hash = \".*\"#hash = \"$src_hash\"#" common.nix
sed -i -E -e "s#yarnHash = \".*\"#yarnHash = \"$yarn_hash\"#" common.nix