coreboot-toolchain: Introduce script for generating sources file

Add and adjust update script from
https://git.petabyte.dev/petabyteboy/corenix.

The script is meant to be run from the package directory of the
coreboot-toolchain. The script generates a sources.nix files, which
contains all sources used for the coreboot toolchain and some other
tools. Thus, it needs to be stripped down to the necessary sources.

Signed-off-by: Felix Singer <felixsinger@posteo.net>
This commit is contained in:
Felix Singer 2021-10-03 17:10:06 +02:00
parent cff7863c34
commit 28383a922e

View file

@ -0,0 +1,31 @@
#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash -p nix cacert git getopt
rootdir="../../../../../"
src="$(nix-build $rootdir --no-out-link -A coreboot-toolchain.src)"
urls=$($src/util/crossgcc/buildgcc -u)
tmp=$(mktemp)
echo '{ fetchurl }: [' > $tmp
for url in $urls; do
name="$(basename $url)"
hash="$(nix-prefetch-url "$url")"
cat << EOF >> $tmp
{
name = "$name";
archive = fetchurl {
sha256 = "$hash";
url = "$url";
};
}
EOF
done
echo ']' >> $tmp
sed -ie 's/https\:\/\/ftpmirror\.gnu\.org/mirror\:\/\/gnu/g' $tmp
mv $tmp sources.nix