memos: adapt update script to new nix-prefetch-github

This commit is contained in:
Theodore Ni 2023-07-07 23:03:01 -07:00
parent 68d6f72e59
commit 412b28f7b2
No known key found for this signature in database
GPG key ID: 48B67583BDDD4474
2 changed files with 5 additions and 5 deletions

View file

@ -6,7 +6,7 @@ let
owner = "usememos";
repo = "memos";
rev = "v${version}";
sha256 = "lcOZg5mlFPp04ZCm5GDhQfSwE2ahSmGhmdAw+pygK0A=";
hash = "sha256-lcOZg5mlFPp04ZCm5GDhQfSwE2ahSmGhmdAw+pygK0A=";
};
frontend = buildNpmPackage {
@ -32,7 +32,7 @@ buildGoModule rec {
# check will unable to access network in sandbox
doCheck = false;
vendorSha256 = "sha256-UM/xeRvfvlq+jGzWpc3EU5GJ6Dt7RmTbSt9h3da6f8w=";
vendorHash = "sha256-UM/xeRvfvlq+jGzWpc3EU5GJ6Dt7RmTbSt9h3da6f8w=";
# Inject frontend assets into go embed
prePatch = ''

View file

@ -34,12 +34,12 @@ sed -e "s/version =.*;/version = \"$TARGET_VERSION\";/g" \
# update hash
SRC_HASH="$(nix-instantiate --eval -A memos.src.outputHash | tr -d '"')"
NEW_HASH="$(nix-prefetch-github usememos memos --rev v$TARGET_VERSION | jq -r .sha256)"
NEW_HASH="$(nix-prefetch-github usememos memos --rev v$TARGET_VERSION | jq -r .hash)"
replaceHash "$SRC_HASH" "$NEW_HASH"
GO_HASH="$(nix-instantiate --eval -A memos.vendorSha256 | tr -d '"')"
EMPTY_HASH="$(nix-instantiate --eval -A lib.fakeSha256 | tr -d '"')"
GO_HASH="$(nix-instantiate --eval -A memos.vendorHash | tr -d '"')"
EMPTY_HASH="$(nix-instantiate --eval -A lib.fakeHash | tr -d '"')"
replaceHash "$GO_HASH" "$EMPTY_HASH"
replaceHash "$EMPTY_HASH" "$(extractVendorHash "$GO_HASH")"