vieb: add update script
This commit is contained in:
parent
8587ea5347
commit
c9222e23a9
3 changed files with 53 additions and 3 deletions
|
@ -1,14 +1,17 @@
|
|||
{ mkYarnPackage, fetchFromGitHub, electron, makeWrapper, makeDesktopItem, lib }:
|
||||
|
||||
let
|
||||
srcInfo = builtins.fromJSON (builtins.readFile ./pin.json);
|
||||
in
|
||||
mkYarnPackage rec {
|
||||
pname = "vieb";
|
||||
version = "9.5.0";
|
||||
inherit (srcInfo) version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Jelmerro";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-SWHjzrEvRlTn4HJnT81Le4KsFDypN3QH3F/z7zZ8p3E=";
|
||||
inherit (srcInfo) sha256;
|
||||
};
|
||||
|
||||
packageJSON = ./package.json;
|
||||
|
@ -52,11 +55,13 @@ mkYarnPackage rec {
|
|||
|
||||
distPhase = ":"; # disable useless $out/tarballs directory
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://vieb.dev/";
|
||||
changelog = "https://github.com/Jelmerro/Vieb/releases/tag/${version}";
|
||||
description = "Vim Inspired Electron Browser";
|
||||
maintainers = with maintainers; [ gebner fortuneteller2k ];
|
||||
maintainers = with maintainers; [ gebner fortuneteller2k tejing ];
|
||||
platforms = platforms.unix;
|
||||
license = licenses.gpl3Plus;
|
||||
};
|
||||
|
|
4
pkgs/applications/networking/browsers/vieb/pin.json
Normal file
4
pkgs/applications/networking/browsers/vieb/pin.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": "9.5.0",
|
||||
"sha256": "sha256-SWHjzrEvRlTn4HJnT81Le4KsFDypN3QH3F/z7zZ8p3E="
|
||||
}
|
41
pkgs/applications/networking/browsers/vieb/update.sh
Executable file
41
pkgs/applications/networking/browsers/vieb/update.sh
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p bash wget jq yarn yarn2nix nix-prefetch-github
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
if [ "$#" -gt 1 ] || [[ "${1:-}" == -* ]]; then
|
||||
echo "Regenerates packaging data for the vieb package."
|
||||
echo "Usage: $0 [git release tag]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version="${1:-}"
|
||||
|
||||
if [ -z "$version" ]; then
|
||||
version="$(wget -O- "https://api.github.com/repos/Jelmerro/Vieb/releases?per_page=1" | jq -r '.[0].tag_name')"
|
||||
fi
|
||||
|
||||
SRC="https://raw.githubusercontent.com/Jelmerro/Vieb/$version"
|
||||
|
||||
tmpdir="$(mktemp -d --tmpdir update-vieb-XXXXXX)"
|
||||
pushd "$tmpdir"
|
||||
|
||||
wget "$SRC/package-lock.json"
|
||||
wget "$SRC/package.json"
|
||||
yarn import
|
||||
yarn2nix >yarn.nix
|
||||
|
||||
popd
|
||||
cp -ft . "$tmpdir/"{package.json,yarn.lock,yarn.nix}
|
||||
rm -rf "$tmpdir"
|
||||
|
||||
src_hash=$(nix-prefetch-github Jelmerro Vieb --rev "${version}" | jq -r .sha256)
|
||||
|
||||
cat > pin.json << EOF
|
||||
{
|
||||
"version": "$version",
|
||||
"sha256": "$src_hash"
|
||||
}
|
||||
EOF
|
Loading…
Reference in a new issue