Skip to content

Instantly share code, notes, and snippets.

@CrystalGamma
Last active January 7, 2021 21:37
Show Gist options
  • Save CrystalGamma/c6a7252219b44cf2c6ddaf5e4c49b6da to your computer and use it in GitHub Desktop.
Save CrystalGamma/c6a7252219b44cf2c6ddaf5e4c49b6da to your computer and use it in GitHub Desktop.
KDE srcs.nix fetching script
# SPDX-License-Identifier: CC0-1.0
BEGIN {
print "{ fetchurl, mirror }: {"
}
{
print " " $2 " = {"
print " version = \"" $3 "\";"
print " src = fetchurl {"
filename = $2 "-" $3 ".tar.xz"
print " url = \"${mirror}/" path "/" filename "\";"
print " sha256 = \"" $1 "\";"
print " name = \"" filename "\";"
print " };"
print " };"
}
END {
print "}"
}
BEGIN {
print "{ fetchurl, mirror }: {"
}
{
print " " $2 " = {"
print " version = \"" $3 "\";"
print " src = fetchurl {"
filename = $2 "-" $3 ".tar.xz"
print " url = \"${mirror}/" path "/" filename "\";"
print " sha256 = \"" $1 "\";"
print " name = \"" filename "\";"
print " };"
print " };"
}
END {
print "}"
}
#!/bin/sh
# SPDX-License-Identifier: CC0-1.0
cat >$3 <<EOF
# DO NOT EDIT! This file is generated automatically.
# Command: $0 $1 $2 $3
EOF
mydir="$(dirname "$(realpath "$0")")"
echo $mydir
curl $1/$2/ \
| grep -E '\b[-[:alnum:]]+-[.0-9]+.tar.xz\b' -o \
| sort | uniq\
| awk '{print "url = \"'"$1"'/'"$2"'/" $0 ".sha256\""}'\
| curl -K -\
| sed 's/\([0-9a-f]\{32\}\) \+\([-a-z0-9]\+\)-\([.0-9]\+\).tar.xz/\1 \2 \3\n/g'\
| awk -f "$mydir/fetch-kde.awk" path="$2" >>$3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment