update-luarocks: Use containing nixpkgs, ensure Lua drvs exist
This commit is contained in:
parent
274715cbc3
commit
671e53af67
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env nix-shell
|
||||||
#!nix-shell -p parallel nix-prefetch-scripts luarocks-nix -i bash
|
#!nix-shell update-luarocks-shell.nix -i bash
|
||||||
|
|
||||||
# You'll likely want to use
|
# You'll likely want to use
|
||||||
# ``
|
# ``
|
||||||
@ -13,6 +13,12 @@ set -eu -o pipefail
|
|||||||
|
|
||||||
CSV_FILE="maintainers/scripts/luarocks-packages.csv"
|
CSV_FILE="maintainers/scripts/luarocks-packages.csv"
|
||||||
TMP_FILE="$(mktemp)"
|
TMP_FILE="$(mktemp)"
|
||||||
|
# Set in the update-luarocks-shell.nix
|
||||||
|
NIXPKGS_PATH="$LUAROCKS_NIXPKGS_PATH"
|
||||||
|
|
||||||
|
# 10 is a pretty arbitrary number of simultaneous jobs, but it is generally
|
||||||
|
# impolite to hit a webserver with *too* many simultaneous connections :)
|
||||||
|
PARALLEL_JOBS=10
|
||||||
|
|
||||||
exit_trap() {
|
exit_trap() {
|
||||||
local lc="$BASH_COMMAND" rc=$?
|
local lc="$BASH_COMMAND" rc=$?
|
||||||
@ -96,7 +102,8 @@ function convert_pkg() {
|
|||||||
luarocks_args+=("--maintainers=$maintainers")
|
luarocks_args+=("--maintainers=$maintainers")
|
||||||
fi
|
fi
|
||||||
if [[ -n $lua_version ]]; then
|
if [[ -n $lua_version ]]; then
|
||||||
luarocks_args+=("--lua-dir=$(nix path-info "nixpkgs.$lua_version")/bin")
|
lua_drv_path=$(nix-build --no-out-link "$NIXPKGS_PATH" -A "$lua_version")
|
||||||
|
luarocks_args+=("--lua-dir=$lua_drv_path/bin")
|
||||||
fi
|
fi
|
||||||
luarocks_args+=("$lua_pkg_name")
|
luarocks_args+=("$lua_pkg_name")
|
||||||
if [[ -n $pkg_version ]]; then
|
if [[ -n $pkg_version ]]; then
|
||||||
@ -104,7 +111,6 @@ function convert_pkg() {
|
|||||||
fi
|
fi
|
||||||
echo "Running 'luarocks ${luarocks_args[*]}'" >&2
|
echo "Running 'luarocks ${luarocks_args[*]}'" >&2
|
||||||
if drv="$nix_pkg_name = $(luarocks "${luarocks_args[@]}")"; then
|
if drv="$nix_pkg_name = $(luarocks "${luarocks_args[@]}")"; then
|
||||||
# echo "$drv" | tee -a "$TMP_FILE"
|
|
||||||
echo "$drv"
|
echo "$drv"
|
||||||
else
|
else
|
||||||
echo "Failed to convert $nix_pkg_name" >&2
|
echo "Failed to convert $nix_pkg_name" >&2
|
||||||
@ -115,12 +121,11 @@ function convert_pkg() {
|
|||||||
# params needed when called via callPackage
|
# params needed when called via callPackage
|
||||||
echo "$HEADER" | tee "$TMP_FILE"
|
echo "$HEADER" | tee "$TMP_FILE"
|
||||||
|
|
||||||
|
# Ensure parallel can run our bash function
|
||||||
export -f convert_pkg
|
export -f convert_pkg
|
||||||
export SHELL=bash
|
export SHELL=bash
|
||||||
# Read each line in the csv file and run convert_pkg for each, in parallel
|
# Read each line in the csv file and run convert_pkg for each, in parallel
|
||||||
# 10 is a pretty arbitrary number of simultaneous jobs, but it is generally
|
parallel --group --keep-order --halt now,fail=1 --jobs "$PARALLEL_JOBS" --colsep ',' convert_pkg {} <"$CSV_FILE" | tee -a "$TMP_FILE"
|
||||||
# impolite to hit a webserver with *too* many simultaneous connections :)
|
|
||||||
parallel --group --keep-order --halt now,fail=1 --jobs 10 --colsep ',' convert_pkg {} <"$CSV_FILE" | tee -a "$TMP_FILE"
|
|
||||||
|
|
||||||
# close the set
|
# close the set
|
||||||
echo "$FOOTER" | tee -a "$TMP_FILE"
|
echo "$FOOTER" | tee -a "$TMP_FILE"
|
||||||
|
9
maintainers/scripts/update-luarocks-shell.nix
Normal file
9
maintainers/scripts/update-luarocks-shell.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{ nixpkgs ? import ../.. { }
|
||||||
|
}:
|
||||||
|
with nixpkgs;
|
||||||
|
mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
bash luarocks-nix nix-prefetch-scripts parallel
|
||||||
|
];
|
||||||
|
LUAROCKS_NIXPKGS_PATH = toString nixpkgs.path;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user