yazi-unwrapped: fix update script
This commit is contained in:
@@ -26,7 +26,7 @@ let
|
||||
hash = "sha256-kEVXejDg4ChFoMNBvKlwdFEyUuTcY2VuK9j0PdafKus=";
|
||||
};
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "yazi";
|
||||
inherit version;
|
||||
|
||||
@@ -34,6 +34,7 @@ rustPlatform.buildRustPackage rec {
|
||||
code_src
|
||||
man_src
|
||||
];
|
||||
|
||||
sourceRoot = code_src.name;
|
||||
|
||||
useFetchCargoVendor = true;
|
||||
@@ -59,6 +60,7 @@ rustPlatform.buildRustPackage rec {
|
||||
'';
|
||||
|
||||
passthru.updateScript.command = [ ./update.sh ];
|
||||
passthru.srcs = { inherit code_src man_src; }; # for updating sources
|
||||
|
||||
meta = {
|
||||
description = "Blazing fast terminal file manager written in Rust, based on async I/O";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p bash nix-update curl coreutils jq common-updater-scripts nix-prefetch
|
||||
#!nix-shell -i bash -p bash nix-update curl coreutils jq common-updater-scripts gawk
|
||||
|
||||
set -eux
|
||||
|
||||
@@ -26,16 +26,27 @@ if [[ "$oldVersion" == "$latestVersion" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Updating Yazi"
|
||||
echo "Updating code sources"
|
||||
|
||||
# Version
|
||||
update-source-version yazi-unwrapped "${latestVersion}"
|
||||
update-source-version yazi-unwrapped "${latestVersion}" --source-key=passthru.srcs.code_src
|
||||
|
||||
pushd "$SCRIPT_DIR"
|
||||
# Build date
|
||||
echo "Updating build date"
|
||||
|
||||
sed -i 's#env.VERGEN_BUILD_DATE = "[^"]*"#env.VERGEN_BUILD_DATE = "'"${latestBuildDate}"'"#' package.nix
|
||||
|
||||
# Hashes
|
||||
cargoHash=$(nix-prefetch "{ sha256 }: (import $NIXPKGS_DIR {}).yazi-unwrapped.cargoDeps.overrideAttrs (_: { outputHash = sha256; })")
|
||||
sed -i -E 's#\bcargoHash = ".*?"#cargoHash = "'"$cargoHash"'"#' package.nix
|
||||
echo "Updating cargoHash"
|
||||
|
||||
# Set cargoHash to an empty string
|
||||
sed -i -E 's/cargoHash = ".*?"/cargoHash = ""/' package.nix
|
||||
|
||||
# Build and get new hash
|
||||
cargoHash=$( (nix-build "$NIXPKGS_DIR" -A yazi-unwrapped 2>&1 || true) | awk '/got/{print $2}')
|
||||
|
||||
if [ "$cargoHash" == "" ]; then
|
||||
echo "Failed to get cargoHash, please update it manually"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sed -i -E 's/cargoHash = ".*?"/cargoHash = "'"$cargoHash"'"/' package.nix
|
||||
popd
|
||||
|
||||
Reference in New Issue
Block a user