viddy: 0.4.0 -> 1.0.1
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com> Co-authored-by: Sandro <sandro.jaeckel@gmail.com> Co-authored-by: Franz Pletz <fpletz@fnordicwalking.de>
This commit is contained in:
parent
6f525d9278
commit
42e323cd79
@ -1,27 +1,33 @@
|
||||
{ lib, buildGoModule, fetchFromGitHub }:
|
||||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "viddy";
|
||||
version = "0.4.0";
|
||||
version = "1.0.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "sachaos";
|
||||
repo = pname;
|
||||
repo = "viddy";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-iF5b5e3HPT3GJLRDxz9wN1U5rO9Ey51Cpw4p2zjffTI=";
|
||||
hash = "sha256-HFqkWJu1whShwEsSUZe5orWTNYyY3oZ6tBzAJF3SFDw=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-/lx2D2FIByRnK/097M4SQKRlmqtPTvbFo1dwbThJ5Fs=";
|
||||
cargoHash = "sha256-oEzsJoVD9aSvphchm21dlmkwePMDSaxD7eoR850NbRk=";
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X"
|
||||
"main.version=${version}"
|
||||
];
|
||||
# requires nightly features
|
||||
env.RUSTC_BOOTSTRAP = 1;
|
||||
|
||||
env.VERGEN_BUILD_DATE = "2024-08-24"; # managed via the update script
|
||||
env.VERGEN_GIT_DESCRIBE = "Nixpkgs";
|
||||
|
||||
passthru.updateScript.command = [ ./update.sh ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Modern watch command";
|
||||
description = "Modern watch command, time machine and pager etc.";
|
||||
changelog = "https://github.com/sachaos/viddy/releases";
|
||||
homepage = "https://github.com/sachaos/viddy";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [
|
||||
|
44
pkgs/tools/misc/viddy/update.sh
Executable file
44
pkgs/tools/misc/viddy/update.sh
Executable file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p bash nix-update curl coreutils jq common-updater-scripts nix-prefetch
|
||||
|
||||
# adapted from pkgs/by-name/ya/yazi-unwrapped/update.sh
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
NIXPKGS_DIR="$PWD"
|
||||
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
# Get latest release
|
||||
VIDDY_RELEASE=$(
|
||||
curl --silent ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
|
||||
https://api.github.com/repos/sachaos/viddy/releases/latest
|
||||
)
|
||||
|
||||
# Get release information
|
||||
latestBuildDate=$(echo "$VIDDY_RELEASE" | jq -r ".published_at")
|
||||
latestVersion=$(echo "$VIDDY_RELEASE" | jq -r ".tag_name")
|
||||
|
||||
latestBuildDate="${latestBuildDate%T*}" # remove the timestamp and get the date
|
||||
latestVersion="${latestVersion:1}" # remove first char 'v'
|
||||
|
||||
oldVersion=$(nix eval --raw -f "$NIXPKGS_DIR" viddy.version)
|
||||
|
||||
if [[ "$oldVersion" == "$latestVersion" ]]; then
|
||||
echo "viddy is up-to-date: ${oldVersion}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Updating viddy"
|
||||
|
||||
# Version
|
||||
update-source-version viddy "${latestVersion}"
|
||||
|
||||
pushd "$SCRIPT_DIR"
|
||||
# Build date
|
||||
sed -i 's#env.VERGEN_BUILD_DATE = "[^"]*"#env.VERGEN_BUILD_DATE = "'"${latestBuildDate}"'"#' default.nix
|
||||
|
||||
# Hashes
|
||||
# https://github.com/msteen/nix-prefetch/issues/51
|
||||
cargoHash=$(nix-prefetch --option extra-experimental-features flakes "{ sha256 }: (import $NIXPKGS_DIR {}).viddy.cargoDeps.overrideAttrs (_: { outputHash = sha256; })")
|
||||
sed -i -E 's#\bcargoHash = ".*?"#cargoHash = "'"$cargoHash"'"#' default.nix
|
||||
popd
|
Loading…
Reference in New Issue
Block a user