nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1#!/usr/bin/env nix-shell
2#!nix-shell -i bash -p curl -p unzip
3
4set -eu
5set -o pipefail
6
7root=$(pwd)
8
9if [ ! -f "./update.sh" ]; then
10 echo "Please run this script from within pkgs/misc/documentation-highlighter/!"
11 exit 1
12fi
13
14scratch=$(mktemp -d -t tmp.XXXXXXXXXX)
15function finish {
16 rm -rf "$scratch"
17}
18trap finish EXIT
19
20
21mkdir $scratch/src
22cd $scratch/src
23
24token=$(curl https://highlightjs.org/download/ -c "$scratch/jar" \
25 | grep csrf \
26 | cut -d"'" -f6)
27
28curl --header "Referer: https://highlightjs.org/download/"\
29 -b "$scratch/jar" \
30 --data "csrfmiddlewaretoken=$token&nix.js=on&bash.js=on" \
31 https://highlightjs.org/download/ > $scratch/out.zip
32
33unzip "$scratch/out.zip"
34out="$root/"
35mkdir -p "$out"
36cp ./{highlight.pack.js,LICENSE,styles/mono-blue.css} "$out"
37
38(
39 echo "This file was generated with pkgs/misc/documentation-highlighter/update.sh"
40 echo ""
41 cat README.md
42) > "$out/README.md"