My Nix Configuration

[pkgs] bgutil-pot-server: init at 0.6.0

Changed files
+120
packages
+26
packages/bgutil-pot-server/librusty_v8.nix
···
+
# COPIED FROM nixpkgs/pkgs/by-name/router
+
{
+
lib,
+
stdenv,
+
fetchurl,
+
}:
+
+
let
+
fetch_librusty_v8 =
+
args:
+
fetchurl {
+
name = "librusty_v8-${args.version}";
+
url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${stdenv.hostPlatform.rust.rustcTarget}.a";
+
sha256 = args.shas.${stdenv.hostPlatform.system};
+
meta = {
+
inherit (args) version;
+
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
+
};
+
};
+
in
+
fetch_librusty_v8 {
+
version = "130.0.7";
+
shas = {
+
x86_64-linux = "sha256-pkdsuU6bAkcIHEZUJOt5PXdzK424CEgTLXjLtQ80t10=";
+
};
+
}
+49
packages/bgutil-pot-server/package.nix
···
+
{
+
lib,
+
callPackage,
+
rustPlatform,
+
fetchFromGitHub,
+
pkg-config,
+
openssl,
+
_experimental-update-script-combinators,
+
nix-update-script,
+
}:
+
rustPlatform.buildRustPackage (finalAttrs: {
+
pname = "bgutil-pot-server";
+
version = "0.6.0";
+
+
src = fetchFromGitHub {
+
owner = "jim60105";
+
repo = "bgutil-ytdlp-pot-provider-rs";
+
tag = "v${finalAttrs.version}";
+
hash = "sha256-kEu5WqOymH8yAyMhGKtVPOq3qlTRpFU/FO71uWEX/e8=";
+
};
+
+
cargoHash = "sha256-fJZeyIsFUfpWeC1MWsU1hANb6cqC9xHQOnhcohEMTeM=";
+
+
nativeBuildInputs = [
+
pkg-config
+
];
+
+
buildInputs = [
+
openssl
+
];
+
+
env.RUSTY_V8_ARCHIVE = callPackage ./librusty_v8.nix { };
+
+
doCheck = false;
+
+
passthru.updateScript = _experimental-update-script-combinators.sequence [
+
(nix-update-script { })
+
./update-librusty.sh
+
];
+
+
meta = {
+
changelog = "https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases/tag/v${finalAttrs.version}";
+
description = "Proof-of-origin token provider plugin for yt-dlp in Rust";
+
homepage = "https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs";
+
license = lib.licenses.gpl3Plus;
+
maintainers = with lib.maintainers; [ pyrox0 ];
+
mainProgram = "bgutil-pot";
+
};
+
})
+45
packages/bgutil-pot-server/update-librusty.sh
···
+
#!/usr/bin/env nix-shell
+
#!nix-shell -i bash -p gnugrep gnused nix jq
+
# shellcheck shell=bash
+
# COPIED FROM nixpkgs/pkgs/by-name/wi/windmill
+
+
set -eu -o pipefail
+
+
echo "librusty_v8: UPDATING"
+
+
BGUTIL_LATEST_VERSION=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} --silent --fail --location "https://api.github.com/repos/jim60105/bgutil-ytdlp-pot-provider-rs/releases/latest" | jq --raw-output .tag_name)
+
CARGO_LOCK=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} --silent --fail --location "https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/raw/$BGUTIL_LATEST_VERSION/Cargo.lock")
+
+
PACKAGE_DIR=$(dirname "$(readlink --canonicalize-existing "${BASH_SOURCE[0]}")")
+
OUTPUT_FILE="$PACKAGE_DIR/librusty_v8.nix"
+
NEW_VERSION=$(echo "$CARGO_LOCK" | grep --after-context 5 'name = "v8"' | grep 'version =' | sed -E 's/version = "//;s/"//')
+
+
CURRENT_VERSION=""
+
if [ -f "$OUTPUT_FILE" ]; then
+
CURRENT_VERSION="$(grep 'version =' "$OUTPUT_FILE" | sed -E 's/version = "//;s/"//')"
+
fi
+
+
if [ "$CURRENT_VERSION" == "$NEW_VERSION" ]; then
+
echo "No update needed, $CURRENT_VERSION is already latest"
+
exit 0
+
fi
+
+
x86Hash="$(nix-prefetch-url --type sha256 https://github.com/denoland/rusty_v8/releases/download/v"$NEW_V")"
+
TEMP_FILE="$OUTPUT_FILE.tmp"
+
cat >"$TEMP_FILE" <<EOF
+
# COPIED FROM nixpkgs/pkgs/by-name/wi/windmill
+
# auto-generated file -- DO NOT EDIT!
+
{ fetchLibrustyV8 }:
+
+
fetchLibrustyV8 {
+
version = "$NEW_VERSION";
+
shas = {
+
# NOTE; Follows supported platforms of package (see meta.platforms attribute)!
+
x86_64-linux = "$(nix hash convert --hash-algo sha256 --from nix32 "$x86Hash")";
+
};
+
}
+
EOF
+
+
mv "$TEMP_FILE" "$OUTPUT_FILE"
+
+
echo "librusty_v8: UPDATE DONE"