Change environment variables to positional arguments in bash script #25

Merged
sb10q merged 1 commits from esavkin/artiq-extrapkg:func-args into master 2024-09-30 13:56:19 +08:00

View File

@ -24,7 +24,9 @@ pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf --cachedir $MSYS2DIR/
--sync --print-format "%l %n" mingw-w64-clang-x86_64-qt-installer-framework > $MSYS2DIR/qt_ifw_packages.txt
function generate_nix_packages_from_pacman() {
echo "{ pkgs } : [" > $OUT
local in=$1
local out=$2
echo "{ pkgs } : [" > $out
while IFS= read -r line; do
read -r url package <<< "$line"
hash=$(nix-prefetch-url $url --name $package)
@ -33,11 +35,11 @@ function generate_nix_packages_from_pacman() {
url = \"$url\";
name = \"$package\";
sha256 = \"$hash\";
})" >> $OUT
done < $IN
echo "]" >> $OUT
})" >> $out
done < $in
echo "]" >> $out
}
IN=$MSYS2DIR/packages.txt OUT=msys2_packages.nix generate_nix_packages_from_pacman
IN=$MSYS2DIR/qt_ifw_packages.txt OUT=msys2_qt_ifw_packages.nix generate_nix_packages_from_pacman
IN=$MSYS2DIR/artiq_dependency_packages.txt OUT=artiq_dependency_packages.nix generate_nix_packages_from_pacman
generate_nix_packages_from_pacman $MSYS2DIR/packages.txt msys2_packages.nix
generate_nix_packages_from_pacman $MSYS2DIR/qt_ifw_packages.txt msys2_qt_ifw_packages.nix
generate_nix_packages_from_pacman $MSYS2DIR/artiq_dependency_packages.txt artiq_dependency_packages.nix