treewide: build via nix

This commit is contained in:
2025-06-27 20:31:45 +09:00
parent f16ef88f9f
commit 42c21ad906
16 changed files with 213 additions and 11022 deletions

View File

@@ -3,10 +3,6 @@
set -o errexit -o nounset -o pipefail
shopt -s dotglob extglob globstar
if [[ ${GITHUB_ACTIONS:-false} != true ]]; then
source venv/bin/activate
fi
if [[ $# -eq 1 ]]; then
fd=$1
else
@@ -21,17 +17,10 @@ fi
export PATH="$PWD/node_modules/.bin:$PATH"
# can use file:// to avoid network requests
[[ -f releases-base ]] && RELEASES_BASE=$(cat releases-base)
RELEASES_BASE=${RELEASES_BASE:-https://releases.grapheneos.org}
rm -rf nginx-tmp
cp -a nginx nginx-tmp
rm -rf static-tmp
cp -a static static-tmp
./process-templates static-tmp
python3 process-templates.py static-tmp
for file in static-tmp/**/*.@(json|webmanifest); do
json_verify < "$file" >/dev/null
@@ -60,21 +49,7 @@ for file in static-tmp/**/*.css static-tmp/js/*.js static-tmp/**/!(bimi|favicon)
replace+=";s@\[\[integrity|/${file#*/}\]\]@${sri_hash}@g"
replace+=";s@\[\[path|/${file#*/}\]\]@/${dest#*/}@g"
done
sed -i "$replace" static-tmp/**/*.html nginx-tmp/nginx.conf nginx-tmp/snippets/preload.conf
replace=
devices=(tegu comet komodo caiman tokay akita husky shiba felix tangorpro lynx cheetah panther bluejay raven oriole barbet redfin bramble sunfish coral flame)
channels=(stable beta alpha)
for device in ${devices[@]}; do
for channel in ${channels[@]}; do
metadata=$(curl -s $RELEASES_BASE/$device-$channel)
build_number=$(echo -n $metadata | cut -d ' ' -f 1)
replace+=";s@\[\[$device-$channel-BUILD_NUMBER\]\]@$build_number@g"
done
done
sed -i "$replace" static-tmp/releases.html
gixy nginx-tmp/nginx.conf
sed -i "$replace" static-tmp/**/*.html
xmllint --noout static-tmp/**/*.@(html|svg|xml)
java -jar node_modules/vnu-jar/build/dist/vnu.jar --errors-only static-tmp/**/*.html
@@ -86,8 +61,6 @@ find static-tmp -name '*.html' -exec html-minifier-terser --collapse-whitespace
--remove-redundant-attributes --remove-script-type-attributes \
--remove-style-link-type-attributes --sort-attributes --sort-class-name {} -o {} \;
./generate-feed
for file in static-tmp/**/*.@(atom|xml); do
xmllint --noblanks "$file" --output "$file"
done