woodpecker-server, woodpecker-server.woodpecker-frontend: adapt update script to new nix-prefetch-github

At the same time, we opportunistically switch to using the newer "hash"
attribute.
This commit is contained in:
Theodore Ni 2023-07-07 23:02:30 -07:00
parent 636c605124
commit 47cc11849c
No known key found for this signature in database
GPG Key ID: 48B67583BDDD4474
3 changed files with 8 additions and 9 deletions

View File

@ -1,17 +1,17 @@
{ lib, fetchFromGitHub }:
let
version = "0.15.8";
srcSha256 = "sha256-7CTRx7I47VEKfPvkWhmpyHV3hkeLyHymFMrkyYQ1wl8=";
yarnSha256 = "sha256-PY0BIBbjyi2DG+n5x/IPc0AwrFSwII4huMDU+FeZ/Sc=";
srcHash = "sha256-7CTRx7I47VEKfPvkWhmpyHV3hkeLyHymFMrkyYQ1wl8=";
yarnHash = "sha256-PY0BIBbjyi2DG+n5x/IPc0AwrFSwII4huMDU+FeZ/Sc=";
in
{
inherit version yarnSha256;
inherit version yarnHash;
src = fetchFromGitHub {
owner = "woodpecker-ci";
repo = "woodpecker";
rev = "v${version}";
sha256 = srcSha256;
hash = srcHash;
};
postBuild = ''

View File

@ -11,7 +11,7 @@ mkYarnPackage {
packageJSON = ./woodpecker-package.json;
offlineCache = fetchYarnDeps {
yarnLock = "${common.src}/web/yarn.lock";
sha256 = common.yarnSha256;
hash = common.yarnHash;
};
buildPhase = ''

View File

@ -28,7 +28,7 @@ fi
version="${version#v}"
# Woodpecker repository
src_hash=$(nix-prefetch-github woodpecker-ci woodpecker --rev "v${version}" | jq -r .sha256)
src_hash=$(nix-prefetch-github woodpecker-ci woodpecker --rev "v${version}" | jq -r .hash)
# Front-end dependencies
woodpecker_src="https://raw.githubusercontent.com/woodpecker-ci/woodpecker/v$version"
@ -42,9 +42,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#srcSha256 = \".*\"#srcSha256 = \"$src_hash\"#" common.nix
sed -i -E -e "s#yarnSha256 = \".*\"#yarnSha256 = \"$yarn_hash\"#" common.nix
sed -i -E -e "s#srcHash = \".*\"#srcHash = \"$src_hash\"#" common.nix
sed -i -E -e "s#yarnHash = \".*\"#yarnHash = \"$yarn_hash\"#" common.nix