gaw: 20220315 -> 20250128 (#399902)

This commit is contained in:
Peder Bergebakken Sundt
2025-04-21 13:52:33 +02:00
committed by GitHub

View File

@@ -1,19 +1,78 @@
{
stdenv,
fetchurl,
runCommandLocal,
lib,
htmlq,
curl,
cacert,
gtk3,
pkg-config,
}:
stdenv.mkDerivation rec {
pname = "gaw";
version = "20220315";
pname = "gaw3";
version = "20250128";
src = fetchurl {
url = "https://download.tuxfamily.org/gaw/download/gaw3-${version}.tar.gz";
sha256 = "0j2bqi9444s1mfbr7x9rqp232xf7ab9z7ifsnl305jsklp6qmrbg";
};
# https://www.rvq.fr/php/ndl.php?id=gaw.*
# https://www.rvq.fr/php/ndl.php?id=gaw3-20250128.tar.gz
src =
runCommandLocal "gaw3-${version}.tar.gz"
{
BASE = "https://www.rvq.fr/php/ndl.php";
FNAME = "gaw3-${version}.tar.gz";
nativeBuildInputs = [
htmlq
curl
];
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-3uO+209+cmu231iabyYmABmgegyxAxswWDWA/v8WSy0=";
}
''
# fetch download page
html_form=$(
curl "$BASE?id=$FNAME" |
tr '\n' ' ' | tr -s ' ' | # minimize whitespace
htmlq tr | # select table rows, one per line
grep "<td>$FNAME</td>" | # filter for row of interest
head -n1 | # first match, just in case
htmlq form --base "$BASE"
)
declare -a curl_args=()
# hidden fields
declare -a input_names=()
readarray -td $'\n' input_names < <(
htmlq <<<"$html_form" "input[type=hidden]" -a name
)
for input_name in "''${input_names[@]}"; do
input_value=$(
htmlq <<<"$html_form" "input[type=hidden][name=''${input_name}]" -a value
)
echo "$input_name = $input_value"
curl_args+=( --form "$input_name=$input_value" )
done
# destination
curl_args+=(
"https://www.rvq.fr/$( htmlq <<<"$html_form" form -a action )"
)
# POST and download
(set -x
curl -X POST "''${curl_args[@]}" $NIX_CURL_FLAGS --output "$FNAME"
)
# unpack and strip root dir
mkdir unpack/
tar xvf "$FNAME" --directory=unpack/
[[ "$(printf "%s\n" unpack/* | wc -l)" -eq 1 ]]
cp -a unpack/* $out
'';
nativeBuildInputs = [ pkg-config ];
@@ -28,7 +87,7 @@ stdenv.mkDerivation rec {
input from sound cards. Data can be imported to gaw using files,
direct tcp/ip connection or directly from the sound card.
'';
homepage = "http://gaw.tuxfamily.org";
homepage = "https://www.rvq.fr/linux/gaw.php";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ fbeffa ];
platforms = platforms.linux;