1
0
forked from M-Labs/nac3
nac3/nix/windows/make_msys2_packages.sh

28 lines
1.1 KiB
Bash
Raw Normal View History

2022-03-22 18:03:25 +08:00
#!/usr/bin/env bash
set -e
cd $(dirname $0)
MSYS2DIR=`pwd`/msys2
mkdir -p $MSYS2DIR/var/lib/pacman $MSYS2DIR/msys/etc
curl -L https://mirror.msys2.org/msys/x86_64/pacman-mirrors-20220205-1-any.pkg.tar.zst | tar xvf - -C $MSYS2DIR --zstd
2023-01-14 16:08:39 +08:00
curl -L https://raw.githubusercontent.com/msys2/MSYS2-packages/master/pacman/pacman.conf | sed "s|SigLevel = Required|SigLevel = Never|g" | sed "s|/etc/pacman.d|$MSYS2DIR/etc/pacman.d|g" > $MSYS2DIR/etc/pacman.conf
2022-03-22 18:03:25 +08:00
fakeroot pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf -Syy
2023-09-13 09:50:33 +08:00
pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf --cachedir $MSYS2DIR/msys/cache -Sp mingw-w64-x86_64-rust mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-python3.11 mingw-w64-x86_64-python-numpy mingw-w64-x86_64-python-setuptools > $MSYS2DIR/packages.txt
2022-03-22 18:03:25 +08:00
echo "{ pkgs } : [" > msys2_packages.nix
while read package; do
2023-01-14 16:09:00 +08:00
basename=${package##*/}
name=${basename//\~/}
hash=$(nix-prefetch-url $package --name $name)
2022-03-22 18:03:25 +08:00
echo "
(pkgs.fetchurl {
url = \"$package\";
sha256 = \"$hash\";
2023-01-14 16:09:00 +08:00
name = \"$name\";
2022-03-22 18:03:25 +08:00
})" >> msys2_packages.nix
done < $MSYS2DIR/packages.txt
echo "]" >> msys2_packages.nix