1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p bash nix-update curl coreutils jq common-updater-scripts nix-prefetch
7 SCRIPT_DIR
="$(dirname "${BASH_SOURCE[0]}")"
11 curl
--silent ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
12 https
://api.github.com
/repos
/sxyazi
/yazi
/releases
/latest
15 # Get release information
16 latestBuildDate
=$
(echo "$YAZI_RELEASE" | jq
-r ".published_at")
17 latestVersion
=$
(echo "$YAZI_RELEASE" | jq
-r ".tag_name")
19 latestBuildDate
="${latestBuildDate%T*}" # remove the timestamp and get the date
20 latestVersion
="${latestVersion:1}" # remove first char 'v'
22 oldVersion
=$
(nix
eval --raw -f "$NIXPKGS_DIR" yazi-unwrapped.version
)
24 if [[ "$oldVersion" == "$latestVersion" ]]; then
25 echo "Yazi is up-to-date: ${oldVersion}"
32 update-source-version yazi-unwrapped
"${latestVersion}"
36 sed -i 's#env.VERGEN_BUILD_DATE = "[^"]*"#env.VERGEN_BUILD_DATE = "'"${latestBuildDate}"'"#' package.nix
39 cargoHash
=$
(nix-prefetch
"{ sha256 }: (import $NIXPKGS_DIR {}).yazi-unwrapped.cargoDeps.overrideAttrs (_: { outputHash = sha256; })")
40 sed -i -E 's#\bcargoHash = ".*?"#cargoHash = "'"$cargoHash"'"#' package.nix